From e0e75f2da661bdf2194e6c19054506e2c8817775 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Apr 2022 07:00:07 +0000 Subject: [PATCH 001/176] Auto-generated commit 67725d82bb758ea74b483daf2b0d75948a8fa239 --- CONTRIBUTORS | 28 + LICENSE | 481 +++++++++ NOTICE | 1 + README.md | 283 ++++++ index.d.ts | 171 ++++ index.mjs | 4 + index.mjs.map | 1 + package.json | 46 + stats.html | 2689 +++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 3704 insertions(+) create mode 100644 CONTRIBUTORS create mode 100644 LICENSE create mode 100644 NOTICE create mode 100644 README.md create mode 100644 index.d.ts create mode 100644 index.mjs create mode 100644 index.mjs.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..35cfd22 --- /dev/null +++ b/README.md @@ -0,0 +1,283 @@ + + +# Complex Typed Arrays + +[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] + +> Create a complex number typed array. + + + +
+ +
+ + + + + + + +
+ +## Usage + +```javascript +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +``` + +#### complexarray( \[dtype] ) + +Creates a complex number typed array having a specified data type `dtype`. + +```javascript +var arr = complexarray(); +// returns +``` + +The function recognizes the following data types: + +- `complex128`: double-precision complex floating-point numbers +- `complex64`: single-precision complex floating-point numbers + +By default, the output complex number typed array data type is `complex128`. To specify an alternative data type, provide a `dtype` argument. + +```javascript +var arr = complexarray( 'complex64' ); +// returns +``` + +#### complexarray( length\[, dtype] ) + +Returns a complex number typed array having a specified `length`. + +```javascript +var arr1 = complexarray( 5 ); +// returns + +var arr2 = complexarray( 5, 'complex64' ); +// returns +``` + +#### complexarray( complexarray\[, dtype] ) + +Creates a complex number typed array from another complex number typed array. + +```javascript +var arr1 = complexarray( [ 5.0, -3.0, 2.0, 1.0 ] ); +// returns + +var arr2 = complexarray( arr1 ); +// returns + +var arr3 = complexarray( arr1, 'complex64' ); +// returns +``` + +#### complexarray( obj\[, dtype] ) + +Creates a complex number typed array from an array-like object or iterable. + +```javascript +var arr1 = complexarray( [ 0.5, 0.5, 0.5, 0.5 ] ); +// returns + +var arr2 = complexarray( [ 0.5, 0.5, 0.5, 0.5 ], 'complex64' ); +// returns +``` + +If a provided array-like object contains interleaved real and imaginary components, the array-like object must have a length which is a multiple of two. + +#### complexarray( buffer\[, byteOffset\[, length]]\[, dtype] ) + +Returns a complex number typed array view of an [`ArrayBuffer`][mdn-arraybuffer]. + +```javascript +import ArrayBuffer from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-buffer@esm/index.mjs'; +var buf = new ArrayBuffer( 64 ); + +var arr1 = complexarray( buf ); +// returns + +var arr2 = complexarray( buf, 'complex64' ); +// returns + +var arr3 = complexarray( buf, 32 ); +// returns + +var arr4 = complexarray( buf, 32, 'complex64' ); +// returns + +var arr5 = complexarray( buf, 32, 1 ); +// returns + +var arr6 = complexarray( buf, 24, 4, 'complex64' ); +// returns +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## Examples + + + +```html + + + + + + +``` + +
+ + + + + +
+ +
+ + + + + + + + + + + + +
+ +* * * + +## Notice + +This package is part of [stdlib][stdlib], a standard library 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/index.d.ts b/index.d.ts new file mode 100644 index 0000000..2ce70e6 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,171 @@ +/* +* @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. +*/ + +// TypeScript Version: 2.0 + +// tslint:disable:unified-signatures + +/// + +import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; +import ArrayBuffer = require( '@stdlib/array-buffer' ); + +/** +* Creates a complex number typed array. +* +* @param dtype - data type (default: 'complex128') +* @returns complex number typed array +* +* @example +* var arr = complexarray(); +* // returns +* +* @example +* var arr = complexarray( 'complex64'); +* // returns +*/ +declare function complexarray( dtype?: DataType ): ComplexTypedArray; + +/** +* Creates a complex number typed array. +* +* @param length - typed array length +* @param dtype - data type (default: 'complex128') +* @returns typed array +* +* @example +* var arr = complexarray( 2 ); +* // returns +* +* @example +* var arr = complexarray( 2, 'complex64' ); +* // returns +*/ +declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length + +/** +* Creates a complex number typed array. +* +* @param complexarray - complex number typed array from which to generate another complex number typed array +* @param dtype - data type (default: 'complex128') +* @returns complex number typed array +* +* @example +* var arr = complexarray( new Complex128Array( 2 ) ); +* // returns +* +* @example +* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); +* // returns +*/ +declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length + +/** +* Creates a complex number typed array. +* +* @param obj - array-like object or iterable from which to generate a typed array +* @param dtype - data type (default: 'complex128') +* @throws array length must be a multiple of two +* @returns complex number typed array +* +* @example +* var arr = complexarray( [ 0.5, 0.5 ] ); +* // returns +* +* @example +* var arr = complexarray( [ 5, -3 ], 'complex64' ); +* // returns +*/ +declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length + +/** +* Creates a complex number typed array. +* +* @param buffer - underlying ArrayBuffer +* @param dtype - data type (default: 'complex128') +* @returns complex number typed array +* +* @example +* var ArrayBuffer = require( `@stdlib/array/buffer` ); +* +* var buf = new ArrayBuffer( 32 ); +* var arr = complexarray( buf ); +* // returns +* +* @example +* var ArrayBuffer = require( `@stdlib/array/buffer` ); +* +* var buf = new ArrayBuffer( 32 ); +* var arr = complexarray( buf, 'complex64' ); +* // returns +*/ +declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length + +/** +* Creates a complex number typed array. +* +* @param buffer - underlying ArrayBuffer +* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) +* @param dtype - data type (default: 'complex128') +* @returns complex number typed array +* +* @example +* var ArrayBuffer = require( `@stdlib/array/buffer` ); +* +* var buf = new ArrayBuffer( 32 ); +* var arr = complexarray( buf, 16 ); +* // returns +* +* @example +* var ArrayBuffer = require( `@stdlib/array/buffer` ); +* +* var buf = new ArrayBuffer( 32 ); +* var arr = complexarray( buf, 16, 'complex64' ); +* // returns +*/ +declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length + +/** +* Creates a complex number typed array. +* +* @param buffer - underlying ArrayBuffer +* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) +* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer +* @param dtype - data type (default: 'complex128') +* @returns complex number typed array +* +* @example +* var ArrayBuffer = require( `@stdlib/array/buffer` ); +* +* var buf = new ArrayBuffer( 64 ); +* var arr = complexarray( buf, 16, 2 ); +* // returns +* +* @example +* var ArrayBuffer = require( `@stdlib/array/buffer` ); +* +* var buf = new ArrayBuffer( 64 ); +* var arr = complexarray( buf, 16, 2, 'complex64' ); +* // returns +*/ +declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length + + +// EXPORTS // + +export = complexarray; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d538f6f --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import e from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";var s=e.isPrimitive,i=t,n=r;var d=function(){var e,t,r;if(t=(e=arguments.length)&&s(arguments[e-1])?arguments[e-=1]:"complex128",null===(r=n(t)))throw new TypeError(i("invalid argument. Must provide a recognized data type. Value: `%s`.",t));return e<=0?new r(0):1===e?new r(arguments[0]):2===e?new r(arguments[0],arguments[1]):new r(arguments[0],arguments[1],arguments[2])};export{d as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..76edf06 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/index.js"],"sourcesContent":["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],"names":["isString","require$$0","isPrimitive","format","require$$1","ctors","require$$2","lib","nargs","dtype","ctor","arguments","length","TypeError"],"mappings":";;kQAsBA,IAAIA,EAAWC,EAAsCC,YACjDC,EAASC,EACTC,EAAQC,EAsHZ,ICjBAC,EDdA,WACC,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJZ,EAAUW,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOL,EAAOI,IAEb,MAAM,IAAII,UAAWV,EAAQ,sEAAuEM,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..8bfb6e8 --- /dev/null +++ b/package.json @@ -0,0 +1,46 @@ +{ + "name": "@stdlib/array-typed-complex", + "version": "0.0.0", + "description": "Create a complex number typed array.", + "license": "Apache-2.0", + "type": "module", + "main": "./index.mjs", + "homepage": "https://stdlib.io", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/array-typed-complex.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "keywords": [ + "stdlib", + "stdtypes", + "types", + "data", + "structure", + "typed", + "array", + "typed array", + "typed-array", + "vector", + "ndarray", + "matrix", + "complex64array", + "complex128array", + "double", + "precision", + "double-precision", + "single", + "float", + "single-precision", + "float32", + "ieee754", + "complex", + "cmplx" + ], + "funding": { + "type": "patreon", + "url": "https://www.patreon.com/athan" + } +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..c442e86 --- /dev/null +++ b/stats.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + From 9a9b61cd5a958e16e748129f0ed6d966c697ed7c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 30 Jun 2022 23:10:37 +0000 Subject: [PATCH 002/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..40f4962 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '00v2k', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 60d6bf5..34ba74a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.0.x", "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/string-format": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x", "@stdlib/types": "^0.0.x" }, "devDependencies": { From 701171b356897158b9374e1744e1c0ba0d9143b1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 07:31:42 +0000 Subject: [PATCH 003/176] Remove files --- index.d.ts | 171 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2865 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 2ce70e6..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 2.0 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index d538f6f..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import e from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";var s=e.isPrimitive,i=t,n=r;var d=function(){var e,t,r;if(t=(e=arguments.length)&&s(arguments[e-1])?arguments[e-=1]:"complex128",null===(r=n(t)))throw new TypeError(i("invalid argument. Must provide a recognized data type. Value: `%s`.",t));return e<=0?new r(0):1===e?new r(arguments[0]):2===e?new r(arguments[0],arguments[1]):new r(arguments[0],arguments[1],arguments[2])};export{d as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 76edf06..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js","../lib/index.js"],"sourcesContent":["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],"names":["isString","require$$0","isPrimitive","format","require$$1","ctors","require$$2","lib","nargs","dtype","ctor","arguments","length","TypeError"],"mappings":";;kQAsBA,IAAIA,EAAWC,EAAsCC,YACjDC,EAASC,EACTC,EAAQC,EAsHZ,ICjBAC,EDdA,WACC,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJZ,EAAUW,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOL,EAAOI,IAEb,MAAM,IAAII,UAAWV,EAAQ,sEAAuEM,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index c442e86..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 634d20ee7376a3b5139498b3fb204227582f5cfd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 07:32:21 +0000 Subject: [PATCH 004/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - docs/repl.txt | 137 -- docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 -- package.json | 66 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 603 ----- 39 files changed, 2715 insertions(+), 4358 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.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 35f3788..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-06-30T22:53:49.220Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 e49fe92..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/typed-complex) 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 + + ```
@@ -224,7 +217,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 9e66c91..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/typed-complex" -click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index f482216..2ce70e6 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..9498478 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..e39b3b3 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;0RA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 40f4962..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '00v2k', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 34ba74a..40441e0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.0.x", - "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x", - "@stdlib/types": "^0.0.x" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.0.x", - "@stdlib/array-complex128": "^0.0.x", - "@stdlib/array-complex64": "^0.0.x", - "@stdlib/array-float64": "^0.0.x", - "@stdlib/assert-instance-of": "^0.0.x", - "@stdlib/assert-is-complex-typed-array": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/blas-ext-base-gfill-by": "^0.0.x", - "@stdlib/complex-float64": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/random-base-discrete-uniform": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex128": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex64": "^0.0.x", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..c592c9c --- /dev/null +++ b/stats.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From cc6c4df259d16245f9068ae5dda2b7948ff94a63 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 16:44:43 +0000 Subject: [PATCH 005/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..40f4962 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '00v2k', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 60d6bf5..34ba74a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.0.x", "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/string-format": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x", "@stdlib/types": "^0.0.x" }, "devDependencies": { From 158f10ee12aa0eeb2479bf50e30154c46e6da5f8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Jul 2022 03:59:48 +0000 Subject: [PATCH 006/176] Remove files --- index.d.ts | 171 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2865 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 2ce70e6..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 2.0 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 9498478..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index e39b3b3..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;0RA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index c592c9c..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From abb6e8eca1bcd6307c2e6b0746300f28e48a1da8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Jul 2022 04:00:53 +0000 Subject: [PATCH 007/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - docs/repl.txt | 137 -- docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 -- package.json | 66 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 603 ----- 39 files changed, 2715 insertions(+), 4358 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.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 5b28d5e..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-07-01T01:43:08.661Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 e49fe92..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/typed-complex) 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 + + ```
@@ -224,7 +217,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 9e66c91..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/typed-complex" -click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index f482216..2ce70e6 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..9498478 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..e39b3b3 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;0RA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 40f4962..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '00v2k', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 34ba74a..40441e0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.0.x", - "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x", - "@stdlib/types": "^0.0.x" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.0.x", - "@stdlib/array-complex128": "^0.0.x", - "@stdlib/array-complex64": "^0.0.x", - "@stdlib/array-float64": "^0.0.x", - "@stdlib/assert-instance-of": "^0.0.x", - "@stdlib/assert-is-complex-typed-array": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/blas-ext-base-gfill-by": "^0.0.x", - "@stdlib/complex-float64": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/random-base-discrete-uniform": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex128": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex64": "^0.0.x", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..7d78a65 --- /dev/null +++ b/stats.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 2934076ddd6544cbf1e3913f7736fbe59b8faac2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 Jul 2022 18:45:01 +0000 Subject: [PATCH 008/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..40f4962 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '00v2k', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 60d6bf5..34ba74a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.0.x", "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/string-format": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x", "@stdlib/types": "^0.0.x" }, "devDependencies": { From 92e395a4e8d83a864fc8a2e5361e0b4230ccd3e0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 Jul 2022 19:16:34 +0000 Subject: [PATCH 009/176] Remove files --- index.d.ts | 171 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2865 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 2ce70e6..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 2.0 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 9498478..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index e39b3b3..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;0RA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 7d78a65..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 2a58dd8dd68cd5bbeb4477240843cd66360b9f13 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 Jul 2022 19:17:28 +0000 Subject: [PATCH 010/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - docs/repl.txt | 137 -- docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 -- package.json | 66 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 603 ----- 38 files changed, 2715 insertions(+), 4323 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 e49fe92..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/typed-complex) 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 + + ```
@@ -224,7 +217,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 9e66c91..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/typed-complex" -click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index f482216..2ce70e6 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..9498478 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..e39b3b3 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;0RA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 40f4962..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '00v2k', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 34ba74a..40441e0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.0.x", - "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x", - "@stdlib/types": "^0.0.x" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.0.x", - "@stdlib/array-complex128": "^0.0.x", - "@stdlib/array-complex64": "^0.0.x", - "@stdlib/array-float64": "^0.0.x", - "@stdlib/assert-instance-of": "^0.0.x", - "@stdlib/assert-is-complex-typed-array": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/blas-ext-base-gfill-by": "^0.0.x", - "@stdlib/complex-float64": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/random-base-discrete-uniform": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex128": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex64": "^0.0.x", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed10449 --- /dev/null +++ b/stats.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From deee999a8fa1bdb4277c453b593107909c8183af Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 03:58:29 +0000 Subject: [PATCH 011/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..40f4962 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '00v2k', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 60d6bf5..34ba74a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.0.x", "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/string-format": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x", "@stdlib/types": "^0.0.x" }, "devDependencies": { From 3e84e9dc91401dd59a9f3f6a2cdd640e83578c59 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 11:28:21 +0000 Subject: [PATCH 012/176] Remove files --- index.d.ts | 171 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2865 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 2ce70e6..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 2.0 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 9498478..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index e39b3b3..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;0RA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed10449..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From a1f134ff8c1b632879ecf4d47217ed5557d23faa Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 11:29:14 +0000 Subject: [PATCH 013/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - docs/repl.txt | 137 -- docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 -- package.json | 66 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 603 ----- 39 files changed, 2715 insertions(+), 4397 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.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 c941ca1..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-08-01T01:45:15.402Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 e49fe92..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/typed-complex) 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 + + ```
@@ -224,7 +217,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 9e66c91..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/typed-complex" -click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index f482216..2ce70e6 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b6669fb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..a160d2d --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 40f4962..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '00v2k', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 34ba74a..40441e0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.0.x", - "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x", - "@stdlib/types": "^0.0.x" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.0.x", - "@stdlib/array-complex128": "^0.0.x", - "@stdlib/array-complex64": "^0.0.x", - "@stdlib/array-float64": "^0.0.x", - "@stdlib/assert-instance-of": "^0.0.x", - "@stdlib/assert-is-complex-typed-array": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/blas-ext-base-gfill-by": "^0.0.x", - "@stdlib/complex-float64": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/random-base-discrete-uniform": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex128": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex64": "^0.0.x", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4de1c35 --- /dev/null +++ b/stats.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From f9b54a3ad5714e71595b06f86a5baf4ec1ad5023 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 03:50:13 +0000 Subject: [PATCH 014/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..40f4962 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '00v2k', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 60d6bf5..34ba74a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.0.x", "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/string-format": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x", "@stdlib/types": "^0.0.x" }, "devDependencies": { From 88f4d9895b47e742e02bcbac84dbbd7883807409 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 11:18:39 +0000 Subject: [PATCH 015/176] Remove files --- index.d.ts | 171 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2865 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 2ce70e6..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 2.0 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b6669fb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index a160d2d..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4de1c35..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 368e81eaecfa54bd661b6f4af1992bb8fcefe1f6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 11:19:31 +0000 Subject: [PATCH 016/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - docs/repl.txt | 137 -- docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 -- package.json | 66 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 603 ----- 39 files changed, 2715 insertions(+), 4413 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.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 6f03fd9..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-09-01T01:45:32.989Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 e49fe92..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/typed-complex) 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 + + ```
@@ -224,7 +217,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 9e66c91..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/typed-complex" -click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index f482216..2ce70e6 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b6669fb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..a160d2d --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 40f4962..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '00v2k', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 34ba74a..40441e0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.0.x", - "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x", - "@stdlib/types": "^0.0.x" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.0.x", - "@stdlib/array-complex128": "^0.0.x", - "@stdlib/array-complex64": "^0.0.x", - "@stdlib/array-float64": "^0.0.x", - "@stdlib/assert-instance-of": "^0.0.x", - "@stdlib/assert-is-complex-typed-array": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/blas-ext-base-gfill-by": "^0.0.x", - "@stdlib/complex-float64": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/random-base-discrete-uniform": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex128": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex64": "^0.0.x", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..6f168e0 --- /dev/null +++ b/stats.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 257e270777fec73609b7553791bc561e9c9f82ac Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 04:18:56 +0000 Subject: [PATCH 017/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..40f4962 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '00v2k', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 60d6bf5..34ba74a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.0.x", "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/string-format": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x", "@stdlib/types": "^0.0.x" }, "devDependencies": { From fe8b4b75017743e0c83eecd2f7129ffa9420664f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 23:57:35 +0000 Subject: [PATCH 018/176] Remove files --- index.d.ts | 171 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2865 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 2ce70e6..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 2.0 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b6669fb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index a160d2d..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 6f168e0..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 7161ac60f54316dc3b7c147ecca2c03c4e071a36 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 23:58:24 +0000 Subject: [PATCH 019/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - docs/repl.txt | 137 -- docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 -- package.json | 66 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 603 ----- 39 files changed, 2715 insertions(+), 4413 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.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 bd28978..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-10-01T02:13:23.434Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 e49fe92..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/typed-complex) 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 + + ```
@@ -224,7 +217,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 9e66c91..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/typed-complex" -click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index f482216..2ce70e6 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b6669fb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..a160d2d --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 40f4962..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '00v2k', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 34ba74a..40441e0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.0.x", - "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x", - "@stdlib/types": "^0.0.x" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.0.x", - "@stdlib/array-complex128": "^0.0.x", - "@stdlib/array-complex64": "^0.0.x", - "@stdlib/array-float64": "^0.0.x", - "@stdlib/assert-instance-of": "^0.0.x", - "@stdlib/assert-is-complex-typed-array": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/blas-ext-base-gfill-by": "^0.0.x", - "@stdlib/complex-float64": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/random-base-discrete-uniform": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex128": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex64": "^0.0.x", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..87ef87b --- /dev/null +++ b/stats.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 0988627c107b4033bb22f28f503b42071937b26b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 04:02:42 +0000 Subject: [PATCH 020/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..40f4962 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '00v2k', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 60d6bf5..34ba74a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.0.x", "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/string-format": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x", "@stdlib/types": "^0.0.x" }, "devDependencies": { From e40db7e2a287c7aea816e13fedf6a8195ac332a1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 12:08:31 +0000 Subject: [PATCH 021/176] Remove files --- index.d.ts | 171 ---- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2865 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 2ce70e6..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 2.0 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b6669fb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index a160d2d..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 87ef87b..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From b993dc6f2b77cbcbcbe24ed4bb88744a768b6186 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 12:09:30 +0000 Subject: [PATCH 022/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 603 --- 39 files changed, 4070 insertions(+), 4413 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.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 5993910..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-11-01T01:58:33.196Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 e49fe92..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/typed-complex) 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 dfcd255..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: '53 17 * * 4' - - # 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 + + ```
@@ -224,7 +217,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 9e66c91..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/typed-complex" -click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index f482216..2ce70e6 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b6669fb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f7dcadc --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 40f4962..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '00v2k', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 34ba74a..40441e0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.0.x", - "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x", - "@stdlib/types": "^0.0.x" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.0.x", - "@stdlib/array-complex128": "^0.0.x", - "@stdlib/array-complex64": "^0.0.x", - "@stdlib/array-float64": "^0.0.x", - "@stdlib/assert-instance-of": "^0.0.x", - "@stdlib/assert-is-complex-typed-array": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/blas-ext-base-gfill-by": "^0.0.x", - "@stdlib/complex-float64": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/random-base-discrete-uniform": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex128": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex64": "^0.0.x", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..6293cfc --- /dev/null +++ b/stats.html @@ -0,0 +1,4044 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From f5439d0cd33b56a76ee86a631934e47c6881820a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 4 Nov 2022 00:48:01 +0000 Subject: [PATCH 023/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..40f4962 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '00v2k', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 60d6bf5..34ba74a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.0.x", "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/string-format": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x", "@stdlib/types": "^0.0.x" }, "devDependencies": { From fdb5cac52fd0b50b223704292ceda1c69ba92604 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 4 Nov 2022 14:58:06 +0000 Subject: [PATCH 024/176] Remove files --- index.d.ts | 171 --- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4044 ------------------------------------------------- 4 files changed, 4220 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 2ce70e6..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 2.0 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b6669fb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f7dcadc..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 6293cfc..0000000 --- a/stats.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From b8c0a064ff95aa8bb637b4230d5de010c279c670 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 4 Nov 2022 14:59:02 +0000 Subject: [PATCH 025/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 603 --- 39 files changed, 4070 insertions(+), 4434 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.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 3caf9f0..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-11-03T23:01:14.969Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 e49fe92..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/typed-complex) 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 dfcd255..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: '53 17 * * 4' - - # 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 + + ```
@@ -224,7 +217,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 9e66c91..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/typed-complex" -click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index f482216..2ce70e6 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b6669fb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f7dcadc --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 40f4962..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '00v2k', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 34ba74a..40441e0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.0.x", - "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x", - "@stdlib/types": "^0.0.x" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.0.x", - "@stdlib/array-complex128": "^0.0.x", - "@stdlib/array-complex64": "^0.0.x", - "@stdlib/array-float64": "^0.0.x", - "@stdlib/assert-instance-of": "^0.0.x", - "@stdlib/assert-is-complex-typed-array": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/blas-ext-base-gfill-by": "^0.0.x", - "@stdlib/complex-float64": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/random-base-discrete-uniform": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex128": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex64": "^0.0.x", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..daa1204 --- /dev/null +++ b/stats.html @@ -0,0 +1,4044 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 1fd6a61bb04fe80f2030a0364ce2e93bf9ab22c6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 04:41:28 +0000 Subject: [PATCH 026/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..40f4962 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '00v2k', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 2eaa03a..4297082 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.0.x", "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/string-format": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x", "@stdlib/types": "^0.0.x" }, "devDependencies": { From 7d8f5ffa84a3a269b0e94bdcd71cd72957a513fc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 18:48:08 +0000 Subject: [PATCH 027/176] Remove files --- index.d.ts | 171 --- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4044 ------------------------------------------------- 4 files changed, 4220 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 2ce70e6..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 2.0 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b6669fb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f7dcadc..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string' ;\nimport format from '@stdlib/error-tools-fmtprodmsg' ;\nimport ctors from '@stdlib/array-typed-complex-ctors' ;\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer' ;\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index daa1204..0000000 --- a/stats.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From cb263d7703f2d16b85cd628f3fe51538523e89d1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 18:49:14 +0000 Subject: [PATCH 028/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 603 --- 39 files changed, 4070 insertions(+), 4439 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.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 04e3740..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-12-01T02:49:40.741Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 e49fe92..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/typed-complex) 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 dfcd255..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: '53 17 * * 4' - - # 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 + + ```
@@ -224,7 +217,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 9e66c91..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/typed-complex" -click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index f482216..2ce70e6 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b6669fb --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..809d380 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 40f4962..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '00v2k', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 4297082..40441e0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.0.x", - "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x", - "@stdlib/types": "^0.0.x" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.0.x", - "@stdlib/array-complex128": "^0.0.x", - "@stdlib/array-complex64": "^0.0.x", - "@stdlib/array-float64": "^0.0.x", - "@stdlib/assert-instance-of": "^0.0.x", - "@stdlib/assert-is-complex-typed-array": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/blas-ext-base-gfill-by": "^0.0.x", - "@stdlib/complex-float64": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/random-base-discrete-uniform": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex128": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex64": "^0.0.x", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f87156a --- /dev/null +++ b/stats.html @@ -0,0 +1,4044 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From a6fe4c522ecba0eb1df40c0f96905abf6decad86 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 04:14:43 +0000 Subject: [PATCH 029/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..40f4962 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '00v2k', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 539743a..5f5d49d 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.0.x", "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/string-format": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x", "@stdlib/types": "^0.0.x" }, "devDependencies": { From 5de6c21c1ac30d6b965b1c88e6728e8b6ff3a1c0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 16:00:13 +0000 Subject: [PATCH 030/176] Remove files --- index.d.ts | 171 --- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4044 ------------------------------------------------- 4 files changed, 4220 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 2ce70e6..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 2.0 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b6669fb..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2022 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 809d380..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index f87156a..0000000 --- a/stats.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 055d72de505965f1c26244503974071d9e08d4e4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 16:01:05 +0000 Subject: [PATCH 031/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 603 -- 39 files changed, 6203 insertions(+), 4450 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.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 5696bdc..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-02-01T02:29:56.702Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 e49fe92..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/typed-complex) 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 dfcd255..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: '53 17 * * 4' - - # 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 + + ```
@@ -224,7 +217,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 9e66c91..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/typed-complex" -click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index f482216..2ce70e6 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..b2f6d2a --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..809d380 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 40f4962..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '00v2k', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5f5d49d..40441e0 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.0.x", - "@stdlib/assert-is-string": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x", - "@stdlib/types": "^0.0.x" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.0.x", - "@stdlib/array-complex128": "^0.0.x", - "@stdlib/array-complex64": "^0.0.x", - "@stdlib/array-float64": "^0.0.x", - "@stdlib/assert-instance-of": "^0.0.x", - "@stdlib/assert-is-complex-typed-array": "^0.0.x", - "@stdlib/bench": "^0.0.x", - "@stdlib/blas-ext-base-gfill-by": "^0.0.x", - "@stdlib/complex-float64": "^0.0.x", - "@stdlib/math-base-special-pow": "^0.0.x", - "@stdlib/random-base-discrete-uniform": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex128": "^0.0.x", - "@stdlib/strided-base-reinterpret-complex64": "^0.0.x", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..25e456b --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 8c796b49d0bcc5a85d754d8ac56f7874559faa9c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 19 Aug 2023 01:54:23 +0000 Subject: [PATCH 032/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..e528f56 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y,KZ', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index de230c1..1bc0f3a 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.0.6", "@stdlib/assert-is-string": "^0.0.8", - "@stdlib/string-format": "^0.0.3", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2", "@stdlib/types": "^0.0.14" }, "devDependencies": { From 94daafbfd9c67dcf4a056c321a371eaad2c8eff4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 19 Aug 2023 02:00:57 +0000 Subject: [PATCH 033/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 2ce70e6..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 2.0 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index b2f6d2a..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=r(n)))throw new TypeError(t("00v2k",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 809d380..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '00v2k', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 25e456b..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From bdc6f0e122ec280c9b8b458e4ba4d5663774b9fd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 19 Aug 2023 02:02:00 +0000 Subject: [PATCH 034/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 603 -- 41 files changed, 6203 insertions(+), 4590 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 e49fe92..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/typed-complex) 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 dfcd255..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: '53 17 * * 4' - - # 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 + + ```
@@ -224,7 +217,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 022c452..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d09ee6d..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var a=u(function(c,n){ -var i=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/error-tools-fmtprodmsg/dist'),m=require('@stdlib/array-typed-complex-ctors/dist');function g(){var r,e,t;if(r=arguments.length,r&&i(arguments[r-1])?(r-=1,e=arguments[r]):e="complex128",t=m(e),t===null)throw new TypeError(s('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}n.exports=g -});var o=a();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 1a115b4..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,mCAAoC,EAuFzD,SAASC,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASJ,EAAU,UAAWI,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQ,aAETC,EAAOJ,EAAOG,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAP,EAAO,QAAUI,ICtBjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "format", "ctors", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 904cc76..9feee85 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..e3498f7 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..0171191 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e528f56..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y,KZ', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 1bc0f3a..f5909fc 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.0.6", - "@stdlib/assert-is-string": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2", - "@stdlib/types": "^0.0.14" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.0.6", - "@stdlib/array-complex128": "^0.0.6", - "@stdlib/array-complex64": "^0.0.6", - "@stdlib/array-float64": "^0.0.6", - "@stdlib/assert-instance-of": "^0.0.8", - "@stdlib/assert-is-complex-typed-array": "^0.0.6", - "@stdlib/bench": "^0.0.12", - "@stdlib/blas-ext-base-gfill-by": "^0.0.10", - "@stdlib/complex-float64": "^0.0.8", - "@stdlib/math-base-special-pow": "^0.0.7", - "@stdlib/random-base-discrete-uniform": "^0.0.6", - "@stdlib/strided-base-reinterpret-complex128": "^0.0.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.0.2", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..d02e89f --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 786c892358604ff4870b5af75759a2bfc3c10fd3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 16:06:06 +0000 Subject: [PATCH 035/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..e528f56 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y,KZ', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index f031ca8..32c76f5 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.0.6", "@stdlib/assert-is-string": "^0.1.0", - "@stdlib/string-format": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.0", "@stdlib/types": "^0.1.0" }, "devDependencies": { From 0f06703b03af5120b14ca051f0e8a52ffce38b5c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 16:30:35 +0000 Subject: [PATCH 036/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 9feee85..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index e3498f7..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 0171191..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;iSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index d02e89f..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 7eb6dcb7d6db7062d4ebca91f763b23b6cd206b4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 16:32:37 +0000 Subject: [PATCH 037/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 603 -- 42 files changed, 6203 insertions(+), 4625 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 e49fe92..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/typed-complex) 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 dfcd255..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: '53 17 * * 4' - - # 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 + + ```
@@ -235,7 +228,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 022c452..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d09ee6d..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var a=u(function(c,n){ -var i=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/error-tools-fmtprodmsg/dist'),m=require('@stdlib/array-typed-complex-ctors/dist');function g(){var r,e,t;if(r=arguments.length,r&&i(arguments[r-1])?(r-=1,e=arguments[r]):e="complex128",t=m(e),t===null)throw new TypeError(s('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}n.exports=g -});var o=a();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 1a115b4..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,mCAAoC,EAuFzD,SAASC,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASJ,EAAU,UAAWI,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQ,aAETC,EAAOJ,EAAOG,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAP,EAAO,QAAUI,ICtBjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "format", "ctors", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 904cc76..9feee85 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..cc863b7 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.0-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..f899dff --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e528f56..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y,KZ', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 32c76f5..d449cc9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.0.6", - "@stdlib/assert-is-string": "^0.1.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.0", - "@stdlib/types": "^0.1.0" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.1.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.0", - "@stdlib/assert-instance-of": "^0.1.0", - "@stdlib/assert-is-complex-typed-array": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/blas-ext-base-gfill-by": "^0.0.10", - "@stdlib/complex-float64": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.0.6", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4174734 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 9e3989d8d7fa90aa68d85244115ca79f06dcbbd2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 16:42:09 +0000 Subject: [PATCH 038/176] Update README.md for ESM bundle v0.1.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 69d2367..d8fff60 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.1.0-esm/index.mjs'; ``` #### complexarray( \[dtype] ) @@ -174,7 +174,7 @@ import discreteUniform from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-d import gfillBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gfill-by@esm/index.mjs'; import Complex128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64@esm/index.mjs'; import reinterpret128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@esm/index.mjs'; -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.1.0-esm/index.mjs'; function rand() { var re = discreteUniform( -10, 10 ); From 44b38e37e9cbd97b63bc692f35fe3985146006f3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 24 Sep 2023 16:42:09 +0000 Subject: [PATCH 039/176] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d8fff60..2520ef1 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,11 @@ limitations under the License. ## Usage +```javascript +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-typed-complex/tags). For example, + ```javascript import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.1.0-esm/index.mjs'; ``` @@ -174,7 +179,7 @@ import discreteUniform from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-d import gfillBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gfill-by@esm/index.mjs'; import Complex128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64@esm/index.mjs'; import reinterpret128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@esm/index.mjs'; -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.1.0-esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; function rand() { var re = discreteUniform( -10, 10 ); From f776de4b136fa8a2b4e35e50c4ace9daadbc7dd2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Oct 2023 16:33:15 +0000 Subject: [PATCH 040/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..e528f56 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y,KZ', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 3955e7a..5d2e491 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.1.0", "@stdlib/assert-is-string": "^0.1.0", - "@stdlib/string-format": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.0", "@stdlib/types": "^0.1.0" }, "devDependencies": { From 25e5fb0af9cfbeb13c7440b1ca5863eb9f23053b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 3 Oct 2023 01:51:06 +0000 Subject: [PATCH 041/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 9feee85..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index cc863b7..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.0-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index f899dff..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4174734..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a544b9ba75c5ac07a33a5a3976604f6f91b0d3c2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 3 Oct 2023 01:54:09 +0000 Subject: [PATCH 042/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 603 -- test/test.js | 603 -- 44 files changed, 6203 insertions(+), 5287 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 d301473..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-10-01T05:17:58.002Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 40b1e70..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: '53 17 * * 4' - - # 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 + + ```
@@ -235,7 +228,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 022c452..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d09ee6d..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var a=u(function(c,n){ -var i=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/error-tools-fmtprodmsg/dist'),m=require('@stdlib/array-typed-complex-ctors/dist');function g(){var r,e,t;if(r=arguments.length,r&&i(arguments[r-1])?(r-=1,e=arguments[r]):e="complex128",t=m(e),t===null)throw new TypeError(s('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}n.exports=g -});var o=a();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 1a115b4..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,mCAAoC,EAuFzD,SAASC,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASJ,EAAU,UAAWI,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQ,aAETC,EAAOJ,EAAOG,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAP,EAAO,QAAUI,ICtBjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "format", "ctors", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 904cc76..9feee85 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..353656a --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.0-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..9cfab45 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e528f56..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y,KZ', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5d2e491..d449cc9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.1.0", - "@stdlib/assert-is-string": "^0.1.0", - "@stdlib/error-tools-fmtprodmsg": "^0.1.0", - "@stdlib/types": "^0.1.0" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.1.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.0", - "@stdlib/assert-instance-of": "^0.1.0", - "@stdlib/assert-is-complex-typed-array": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/blas-ext-base-gfill-by": "^0.1.0", - "@stdlib/complex-float64": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9aabe79 --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index 7b57d75..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 56070dad67df4366f26fa6b552c7ab1452ebc58d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 5 Oct 2023 19:42:17 +0000 Subject: [PATCH 043/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..e528f56 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y,KZ', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 122ce61..b087bff 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.1.0", "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/string-format": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1", "@stdlib/types": "^0.1.0" }, "devDependencies": { From 841d105cb11715048cf485b9e4ce1722904fdf31 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 7 Oct 2023 02:35:45 +0000 Subject: [PATCH 044/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 9feee85..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 353656a..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.0-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 9cfab45..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 9aabe79..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 78c0c64cfbc5cad73aa58c05eabaa3677a41102e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 7 Oct 2023 02:39:20 +0000 Subject: [PATCH 045/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 603 -- test/test.js | 603 -- 43 files changed, 6203 insertions(+), 5286 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 40b1e70..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: '53 17 * * 4' - - # 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 + + ```
@@ -235,7 +228,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 022c452..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d09ee6d..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var a=u(function(c,n){ -var i=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/error-tools-fmtprodmsg/dist'),m=require('@stdlib/array-typed-complex-ctors/dist');function g(){var r,e,t;if(r=arguments.length,r&&i(arguments[r-1])?(r-=1,e=arguments[r]):e="complex128",t=m(e),t===null)throw new TypeError(s('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}n.exports=g -});var o=a();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 1a115b4..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,mCAAoC,EAuFzD,SAASC,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASJ,EAAU,UAAWI,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQ,aAETC,EAAOJ,EAAOG,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAP,EAAO,QAAUI,ICtBjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "format", "ctors", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 904cc76..9feee85 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..f3637ef --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..9cfab45 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e528f56..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y,KZ', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index b087bff..d449cc9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.1.0", - "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1", - "@stdlib/types": "^0.1.0" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.1.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.0", - "@stdlib/assert-instance-of": "^0.1.1", - "@stdlib/assert-is-complex-typed-array": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/blas-ext-base-gfill-by": "^0.1.0", - "@stdlib/complex-float64": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..16bad5c --- /dev/null +++ b/stats.html @@ -0,0 +1,6177 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/test/dist/test.js b/test/dist/test.js deleted file mode 100644 index 7b57d75..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../../dist' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From c0e88ac2c6315778ce69a2f30345f97ee96c76cc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Nov 2023 17:23:16 +0000 Subject: [PATCH 046/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..e528f56 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y,KZ', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index e6a17ee..ec39527 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.1.0", "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/string-format": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1", "@stdlib/types": "^0.1.0" }, "devDependencies": { From 6eacec06cdfb323a6a9ec91e529834abef20a2a3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 3 Nov 2023 01:57:14 +0000 Subject: [PATCH 047/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 9feee85..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index f3637ef..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 9cfab45..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 16bad5c..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 652b31c57d69c009ac8c76d6105e86cd35c730a4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 3 Nov 2023 02:00:32 +0000 Subject: [PATCH 048/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 -- 44 files changed, 6203 insertions(+), 4725 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 815afd5..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-11-01T05:37:36.799Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 40b1e70..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: '53 17 * * 4' - - # 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 + + ```
@@ -235,7 +228,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 022c452..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d09ee6d..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var a=u(function(c,n){ -var i=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/error-tools-fmtprodmsg/dist'),m=require('@stdlib/array-typed-complex-ctors/dist');function g(){var r,e,t;if(r=arguments.length,r&&i(arguments[r-1])?(r-=1,e=arguments[r]):e="complex128",t=m(e),t===null)throw new TypeError(s('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}n.exports=g -});var o=a();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 1a115b4..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,mCAAoC,EAuFzD,SAASC,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASJ,EAAU,UAAWI,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQ,aAETC,EAAOJ,EAAOG,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAP,EAAO,QAAUI,ICtBjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "format", "ctors", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 904cc76..9feee85 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..f3637ef --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..9cfab45 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e528f56..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y,KZ', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index ec39527..d449cc9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.1.0", - "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1", - "@stdlib/types": "^0.1.0" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.1.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.1", - "@stdlib/assert-instance-of": "^0.1.1", - "@stdlib/assert-is-complex-typed-array": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/blas-ext-base-gfill-by": "^0.1.0", - "@stdlib/complex-float64": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed51ad9 --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 3db1432b6b745bdc1f8cd3ae74a118499e57cd4a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 3 Nov 2023 12:57:58 +0000 Subject: [PATCH 049/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..e528f56 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y,KZ', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index e6a17ee..ec39527 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.1.0", "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/string-format": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1", "@stdlib/types": "^0.1.0" }, "devDependencies": { From 0b4c2cc125dfb17862f1f752740b72fa8daf379f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 3 Nov 2023 17:35:48 +0000 Subject: [PATCH 050/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 9feee85..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; // tslint:disable-line:max-line-length - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index f3637ef..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 9cfab45..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed51ad9..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From af9570d0fea4b932d70c44745ba2443075491ff0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 3 Nov 2023 17:39:35 +0000 Subject: [PATCH 051/176] 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 | 43 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 -- 43 files changed, 6203 insertions(+), 4724 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 40b1e70..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: '53 17 * * 4' - - # 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 + + ```
@@ -235,7 +228,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 022c452..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d09ee6d..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var a=u(function(c,n){ -var i=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/error-tools-fmtprodmsg/dist'),m=require('@stdlib/array-typed-complex-ctors/dist');function g(){var r,e,t;if(r=arguments.length,r&&i(arguments[r-1])?(r-=1,e=arguments[r]):e="complex128",t=m(e),t===null)throw new TypeError(s('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}n.exports=g -});var o=a();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 1a115b4..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,mCAAoC,EAuFzD,SAASC,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASJ,EAAU,UAAWI,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQ,aAETC,EAAOJ,EAAOG,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAP,EAAO,QAAUI,ICtBjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "format", "ctors", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index c7d76ad..d27b5d3 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..f3637ef --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..9cfab45 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e528f56..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y,KZ', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index ec39527..d449cc9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.1.0", - "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1", - "@stdlib/types": "^0.1.0" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.1.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.1", - "@stdlib/assert-instance-of": "^0.1.1", - "@stdlib/assert-is-complex-typed-array": "^0.1.0", - "@stdlib/bench": "^0.1.0", - "@stdlib/blas-ext-base-gfill-by": "^0.1.0", - "@stdlib/complex-float64": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..2e08d09 --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From e4ec2ee898d2b8185ee8eca792f8e7b9c72d2d9a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 9 Nov 2023 10:12:16 +0000 Subject: [PATCH 052/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..e528f56 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y,KZ', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 53fba4f..553350f 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.1.0", "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/string-format": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1", "@stdlib/types": "^0.2.0" }, "devDependencies": { From 273895266fd5ae09b97cedcca680116c39e0d491 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 9 Nov 2023 12:54:13 +0000 Subject: [PATCH 053/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index d27b5d3..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index f3637ef..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 9cfab45..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 2e08d09..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 4c5d8603871728d30e48c9cce4c7f1f99c407be9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 9 Nov 2023 12:56:37 +0000 Subject: [PATCH 054/176] 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 | 47 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 -- 43 files changed, 6205 insertions(+), 4726 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 40b1e70..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: '53 17 * * 4' - - # 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 + + ```
@@ -242,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -306,9 +299,9 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 022c452..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d09ee6d..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var a=u(function(c,n){ -var i=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/error-tools-fmtprodmsg/dist'),m=require('@stdlib/array-typed-complex-ctors/dist');function g(){var r,e,t;if(r=arguments.length,r&&i(arguments[r-1])?(r-=1,e=arguments[r]):e="complex128",t=m(e),t===null)throw new TypeError(s('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}n.exports=g -});var o=a();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 1a115b4..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,mCAAoC,EAuFzD,SAASC,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASJ,EAAU,UAAWI,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQ,aAETC,EAAOJ,EAAOG,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAP,EAAO,QAAUI,ICtBjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "format", "ctors", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index c7d76ad..d27b5d3 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ // tslint:disable:unified-signatures -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..f3637ef --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..9cfab45 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e528f56..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y,KZ', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 553350f..d449cc9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.1.0", - "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1", - "@stdlib/types": "^0.2.0" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.1.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.1", - "@stdlib/assert-instance-of": "^0.1.1", - "@stdlib/assert-is-complex-typed-array": "^0.1.0", - "@stdlib/bench": "^0.2.0", - "@stdlib/blas-ext-base-gfill-by": "^0.1.0", - "@stdlib/complex-float64": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..74c4b40 --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From fe139368f4d5c07c6bbcd941277c7d8d97329a51 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 12 Nov 2023 21:29:04 +0000 Subject: [PATCH 055/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..e528f56 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y,KZ', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 53fba4f..553350f 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.1.0", "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/string-format": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1", "@stdlib/types": "^0.2.0" }, "devDependencies": { From a6d35c551df55e81c657c0a40b68d89eb1902e2d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 12 Nov 2023 22:08:17 +0000 Subject: [PATCH 056/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index d27b5d3..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -// tslint:disable:unified-signatures - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index f3637ef..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 9cfab45..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 74c4b40..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From f023eddeaa8b3d6c43cba4b23ddfca3bc681d794 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 12 Nov 2023 22:11:52 +0000 Subject: [PATCH 057/176] 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 | 47 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 -- 43 files changed, 6205 insertions(+), 4726 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 40b1e70..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: '53 17 * * 4' - - # 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 + + ```
@@ -242,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -306,9 +299,9 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 022c452..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d09ee6d..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var a=u(function(c,n){ -var i=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/error-tools-fmtprodmsg/dist'),m=require('@stdlib/array-typed-complex-ctors/dist');function g(){var r,e,t;if(r=arguments.length,r&&i(arguments[r-1])?(r-=1,e=arguments[r]):e="complex128",t=m(e),t===null)throw new TypeError(s('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}n.exports=g -});var o=a();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 1a115b4..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,mCAAoC,EAuFzD,SAASC,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASJ,EAAU,UAAWI,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQ,aAETC,EAAOJ,EAAOG,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAP,EAAO,QAAUI,ICtBjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "format", "ctors", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index ae38287..21f366c 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..f3637ef --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..9cfab45 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e528f56..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y,KZ', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 553350f..d449cc9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.1.0", - "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1", - "@stdlib/types": "^0.2.0" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.1.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.1", - "@stdlib/assert-instance-of": "^0.1.1", - "@stdlib/assert-is-complex-typed-array": "^0.1.0", - "@stdlib/bench": "^0.2.0", - "@stdlib/blas-ext-base-gfill-by": "^0.1.0", - "@stdlib/complex-float64": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..fff393a --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From e55b0823f516a87be41d4734d66992fbae59c532 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Dec 2023 13:33:35 +0000 Subject: [PATCH 058/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index c566996..e528f56 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); var ctors = require( '@stdlib/array-typed-complex-ctors' ); @@ -123,7 +123,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y,KZ', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 90fca0c..b95682b 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.1.0", "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/string-format": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1", "@stdlib/types": "^0.2.0" }, "devDependencies": { From c741f5e07f434dd9bc83173f32aa0d277ff0dbf4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 11:45:13 +0000 Subject: [PATCH 059/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 21f366c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index f3637ef..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 9cfab45..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index fff393a..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 9d7eac5686814fd4666405ea58787f5bc4f8ec30 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 11:48:03 +0000 Subject: [PATCH 060/176] 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 | 47 +- benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 -- 44 files changed, 6205 insertions(+), 4722 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 8a5acfd..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-12-01T05:42:59.772Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 40b1e70..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: '53 17 * * 4' - - # 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 + + ```
@@ -242,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -306,9 +299,9 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 6df7a85..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index c990869..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68a27fb..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 022c452..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d09ee6d..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var a=u(function(c,n){ -var i=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/error-tools-fmtprodmsg/dist'),m=require('@stdlib/array-typed-complex-ctors/dist');function g(){var r,e,t;if(r=arguments.length,r&&i(arguments[r-1])?(r-=1,e=arguments[r]):e="complex128",t=m(e),t===null)throw new TypeError(s('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}n.exports=g -});var o=a();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 1a115b4..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,mCAAoC,EAuFzD,SAASC,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASJ,EAAU,UAAWI,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQ,aAETC,EAAOJ,EAAOG,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAP,EAAO,QAAUI,ICtBjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "format", "ctors", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index ae38287..21f366c 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..f3637ef --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..9cfab45 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e528f56..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/error-tools-fmtprodmsg' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y,KZ', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index b95682b..d449cc9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.1.0", - "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1", - "@stdlib/types": "^0.2.0" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.1.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.1", - "@stdlib/assert-instance-of": "^0.1.1", - "@stdlib/assert-is-complex-typed-array": "^0.1.0", - "@stdlib/bench": "^0.2.1", - "@stdlib/blas-ext-base-gfill-by": "^0.1.0", - "@stdlib/complex-float64": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..14a9e4a --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 01658945b24fa70459c9535adb93433b4acb0211 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 31 Dec 2023 11:03:23 +0000 Subject: [PATCH 061/176] Transform error messages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d1bc28..a71fc8f 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.1.0", "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/string-format": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1", "@stdlib/types": "^0.2.0" }, "devDependencies": { From dbfccb73679988d8c405979a65f6c7d617309ac7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 31 Dec 2023 11:07:54 +0000 Subject: [PATCH 062/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 21f366c..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index f3637ef..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,o;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(o=t(n)))throw new TypeError(r("01r2Y,KZ",n));return s<=0?new o(0):1===s?new o(arguments[0]):2===s?new o(arguments[0],arguments[1]):new o(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 9cfab45..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/error-tools-fmtprodmsg';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y,KZ', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+SA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,WAAYP,IAE1C,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 14a9e4a..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c096a7a69d6e845d47944fc079a97205d54a9d4e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 31 Dec 2023 11:08:36 +0000 Subject: [PATCH 063/176] 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 | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 47 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 -- 44 files changed, 6205 insertions(+), 4727 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 b2818cf..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: '53 17 * * 4' - - # 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 + + ```
@@ -242,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -306,9 +299,9 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 022c452..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d09ee6d..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var a=u(function(c,n){ -var i=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/error-tools-fmtprodmsg/dist'),m=require('@stdlib/array-typed-complex-ctors/dist');function g(){var r,e,t;if(r=arguments.length,r&&i(arguments[r-1])?(r-=1,e=arguments[r]):e="complex128",t=m(e),t===null)throw new TypeError(s('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}n.exports=g -});var o=a();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 1a115b4..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,mCAAoC,EAuFzD,SAASC,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASJ,EAAU,UAAWI,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQ,aAETC,EAAOJ,EAAOG,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAP,EAAO,QAAUI,ICtBjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "format", "ctors", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 1818305..54e61a2 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..bdc214e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,i;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(i=r(n)))throw new TypeError(t("invalid argument. Must provide a recognized data type. Value: `%s`.",n));return s<=0?new i(0):1===s?new i(arguments[0]):2===s?new i(arguments[0],arguments[1]):new i(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..b6a5d9d --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/string-format';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;sSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,sEAAuEP,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index c566996..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index a71fc8f..d449cc9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.1.0", - "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1", - "@stdlib/types": "^0.2.0" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.1.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.1", - "@stdlib/assert-instance-of": "^0.1.1", - "@stdlib/assert-is-complex-typed-array": "^0.1.0", - "@stdlib/blas-ext-base-gfill-by": "^0.1.0", - "@stdlib/complex-float64": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..90d6d39 --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 2c64e14e17f49375e65718943c247e729ba9098a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 08:04:42 +0000 Subject: [PATCH 064/176] Transform error messages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d1bc28..a71fc8f 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.1.0", "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/string-format": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1", "@stdlib/types": "^0.2.0" }, "devDependencies": { From 429eb32dfceb65462d02fc2f41a063a2587e781e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 14:42:10 +0000 Subject: [PATCH 065/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 54e61a2..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index bdc214e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2023 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,i;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(i=r(n)))throw new TypeError(t("invalid argument. Must provide a recognized data type. Value: `%s`.",n));return s<=0?new i(0):1===s?new i(arguments[0]):2===s?new i(arguments[0],arguments[1]):new i(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index b6a5d9d..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/string-format';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;sSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,sEAAuEP,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 90d6d39..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 1e82c42e8436caeeb4cb04b9589e24de4de037b0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 14:42:48 +0000 Subject: [PATCH 066/176] 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 | 47 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 -- 45 files changed, 6205 insertions(+), 4728 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 ec02dd1..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-01-01T05:12:07.724Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 b2818cf..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: '53 17 * * 4' - - # 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 + + ```
@@ -242,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -306,9 +299,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 022c452..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d09ee6d..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var a=u(function(c,n){ -var i=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/error-tools-fmtprodmsg/dist'),m=require('@stdlib/array-typed-complex-ctors/dist');function g(){var r,e,t;if(r=arguments.length,r&&i(arguments[r-1])?(r-=1,e=arguments[r]):e="complex128",t=m(e),t===null)throw new TypeError(s('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}n.exports=g -});var o=a();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 1a115b4..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,mCAAoC,EAuFzD,SAASC,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASJ,EAAU,UAAWI,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQ,aAETC,EAAOJ,EAAOG,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAP,EAAO,QAAUI,ICtBjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "format", "ctors", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 1818305..54e61a2 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..304eb55 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,i;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(i=r(n)))throw new TypeError(t("invalid argument. Must provide a recognized data type. Value: `%s`.",n));return s<=0?new i(0):1===s?new i(arguments[0]):2===s?new i(arguments[0],arguments[1]):new i(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..b6a5d9d --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/string-format';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;sSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,sEAAuEP,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index c566996..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index a71fc8f..d449cc9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.1.0", - "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1", - "@stdlib/types": "^0.2.0" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.1.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.1", - "@stdlib/assert-instance-of": "^0.1.1", - "@stdlib/assert-is-complex-typed-array": "^0.1.0", - "@stdlib/blas-ext-base-gfill-by": "^0.1.0", - "@stdlib/complex-float64": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..66ee62a --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 121548787a199ecc50b3c638c2ef7b35eb468289 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:19:25 +0000 Subject: [PATCH 067/176] Transform error messages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2d1bc28..a71fc8f 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,7 @@ "dependencies": { "@stdlib/array-typed-complex-ctors": "^0.1.0", "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/string-format": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1", "@stdlib/types": "^0.2.0" }, "devDependencies": { From 5f9f71f85a91b3f4c3d610843ce5b6146c1e674c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:48:38 +0000 Subject: [PATCH 068/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 54e61a2..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( `@stdlib/array/buffer` ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 304eb55..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,i;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(i=r(n)))throw new TypeError(t("invalid argument. Must provide a recognized data type. Value: `%s`.",n));return s<=0?new i(0):1===s?new i(arguments[0]):2===s?new i(arguments[0],arguments[1]):new i(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index b6a5d9d..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/string-format';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;sSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,sEAAuEP,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 66ee62a..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 06953e6fd1efc54f7166a309c05cf19ae3448b37 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 7 Jan 2024 22:48:54 +0000 Subject: [PATCH 069/176] 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 | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 47 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 143 - package.json | 66 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 -- 44 files changed, 6205 insertions(+), 4727 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 b2818cf..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: '53 17 * * 4' - - # 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 + + ```
@@ -242,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -306,9 +299,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 022c452..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index d09ee6d..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var u=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var a=u(function(c,n){ -var i=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/error-tools-fmtprodmsg/dist'),m=require('@stdlib/array-typed-complex-ctors/dist');function g(){var r,e,t;if(r=arguments.length,r&&i(arguments[r-1])?(r-=1,e=arguments[r]):e="complex128",t=m(e),t===null)throw new TypeError(s('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}n.exports=g -});var o=a();module.exports=o; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 1a115b4..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar format = require( '@stdlib/string-format' );\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAS,QAAS,uBAAwB,EAC1CC,EAAQ,QAAS,mCAAoC,EAuFzD,SAASC,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASJ,EAAU,UAAWI,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQ,aAETC,EAAOJ,EAAOG,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAP,EAAO,QAAUI,ICtBjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "format", "ctors", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 6b6c9a3..87ddfb4 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..304eb55 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,i;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(i=r(n)))throw new TypeError(t("invalid argument. Must provide a recognized data type. Value: `%s`.",n));return s<=0?new i(0):1===s?new i(arguments[0]):2===s?new i(arguments[0],arguments[1]):new i(arguments[0],arguments[1],arguments[2])}export{s as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..b6a5d9d --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/string-format';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;sSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,sEAAuEP,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index c566996..0000000 --- a/lib/main.js +++ /dev/null @@ -1,143 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var format = require( '@stdlib/string-format' ); -var ctors = require( '@stdlib/array-typed-complex-ctors' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = 'complex128'; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index a71fc8f..d449cc9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,45 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-typed-complex-ctors": "^0.1.0", - "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1", - "@stdlib/types": "^0.2.0" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.1.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.1", - "@stdlib/assert-instance-of": "^0.1.1", - "@stdlib/assert-is-complex-typed-array": "^0.1.0", - "@stdlib/blas-ext-base-gfill-by": "^0.1.0", - "@stdlib/complex-float64": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..b676729 --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From badb7196ac182096c8416415af61dd9356ac4ea7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 16 Jan 2024 08:39:35 +0000 Subject: [PATCH 070/176] Transform error messages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f50d87b..17397bd 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.1.0", "@stdlib/array-typed-complex-ctors": "^0.1.0", "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/string-format": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1", "@stdlib/types": "^0.2.0" }, "devDependencies": { From 7379797017d477d2fe6d44873766a110b412fddc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 16 Jan 2024 08:41:33 +0000 Subject: [PATCH 071/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 87ddfb4..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 304eb55..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as e}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";function s(){var s,n,i;if(n=(s=arguments.length)&&e(arguments[s-1])?arguments[s-=1]:"complex128",null===(i=r(n)))throw new TypeError(t("invalid argument. Must provide a recognized data type. Value: `%s`.",n));return s<=0?new i(0):1===s?new i(arguments[0]):2===s?new i(arguments[0],arguments[1]):new i(arguments[0],arguments[1],arguments[2])}export{s as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index b6a5d9d..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport format from '@stdlib/string-format';\nimport ctors from '@stdlib/array-typed-complex-ctors';\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = 'complex128';\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;sSA+GA,SAASA,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGD,aAGK,QADdE,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,sEAAuEP,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index b676729..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From ab544b4219a0eeb27a5ae85c2ccdcf9834a2ff73 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 16 Jan 2024 08:42:12 +0000 Subject: [PATCH 072/176] 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 | 228 - .npmrc | 28 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 47 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 67 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 -- 44 files changed, 6205 insertions(+), 4734 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 b2818cf..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: '53 17 * * 4' - - # 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 + + ```
@@ -242,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -306,9 +299,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 022c452..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 86555c5..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){ -var u=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/array-typed-complex-ctors/dist'),g=require('@stdlib/array-defaults/dist'),m=require('@stdlib/error-tools-fmtprodmsg/dist'),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v -});var l=n();module.exports=l; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 6b6c9a3..87ddfb4 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d478192 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.1.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("invalid argument. Must provide a recognized data type. Value: `%s`.",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..6a7db90 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+XA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,sEAAuEP,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 2b853c6..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 17397bd..d449cc9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,46 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.1.0", - "@stdlib/array-typed-complex-ctors": "^0.1.0", - "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1", - "@stdlib/types": "^0.2.0" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.1.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.1", - "@stdlib/assert-instance-of": "^0.1.1", - "@stdlib/assert-is-complex-typed-array": "^0.1.0", - "@stdlib/blas-ext-base-gfill-by": "^0.1.0", - "@stdlib/complex-float64": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..efdee82 --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 51f819c3f60f9deeff9a5b7fc53924b574e15825 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 08:37:47 +0000 Subject: [PATCH 073/176] Transform error messages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f50d87b..17397bd 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.1.0", "@stdlib/array-typed-complex-ctors": "^0.1.0", "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/string-format": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1", "@stdlib/types": "^0.2.0" }, "devDependencies": { From 6882b20bf8ea910e6be018b6c4d180128b20e2a9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 14:02:44 +0000 Subject: [PATCH 074/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 87ddfb4..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index d478192..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.1.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("invalid argument. Must provide a recognized data type. Value: `%s`.",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 6a7db90..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+XA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,sEAAuEP,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index efdee82..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 8281d9806bcfd455bcb5388c2e74fa054a3cf4d3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 14:03:10 +0000 Subject: [PATCH 075/176] 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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 67 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 -- 45 files changed, 6205 insertions(+), 4740 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 43a4369..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-02-01T06:02:16.107Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 b2818cf..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 86555c5..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){ -var u=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/array-typed-complex-ctors/dist'),g=require('@stdlib/array-defaults/dist'),m=require('@stdlib/error-tools-fmtprodmsg/dist'),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v -});var l=n();module.exports=l; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 6b6c9a3..87ddfb4 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d478192 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.1.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("invalid argument. Must provide a recognized data type. Value: `%s`.",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..6a7db90 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+XA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,sEAAuEP,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 2b853c6..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 17397bd..d449cc9 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,46 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.1.0", - "@stdlib/array-typed-complex-ctors": "^0.1.0", - "@stdlib/assert-is-string": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1", - "@stdlib/types": "^0.2.0" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.1.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.1.1", - "@stdlib/assert-instance-of": "^0.1.1", - "@stdlib/assert-is-complex-typed-array": "^0.1.0", - "@stdlib/blas-ext-base-gfill-by": "^0.1.0", - "@stdlib/complex-float64": "^0.1.1", - "@stdlib/math-base-special-pow": "^0.1.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.1.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.1.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..24b534a --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 7f986acff7db36b012557052b11e2e58e5a2f928 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 00:22:08 +0000 Subject: [PATCH 076/176] Transform error messages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 730b4fd..bc65ab7 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.2.0", "@stdlib/array-typed-complex-ctors": "^0.2.0", "@stdlib/assert-is-string": "^0.2.0", - "@stdlib/string-format": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.2.0", "@stdlib/types": "^0.3.1" }, "devDependencies": { From 11a14837cb15ad29ddc9db42077f7a2320161604 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 03:12:08 +0000 Subject: [PATCH 077/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 87ddfb4..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index d478192..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.1.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.1.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("invalid argument. Must provide a recognized data type. Value: `%s`.",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 6a7db90..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+XA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,sEAAuEP,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 24b534a..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 305f414ecfc3893de737e349524076352dded990 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 03:12:53 +0000 Subject: [PATCH 078/176] 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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 67 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 -- 44 files changed, 6205 insertions(+), 4743 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 9364520..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 86555c5..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){ -var u=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/array-typed-complex-ctors/dist'),g=require('@stdlib/array-defaults/dist'),m=require('@stdlib/error-tools-fmtprodmsg/dist'),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v -});var l=n();module.exports=l; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 7d79795..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType ComplexTypedArray - complexarray( 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( 10, 'complex64' ); // $ExpectType ComplexTypedArray - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType ComplexTypedArray -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 6b6c9a3..87ddfb4 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataType as DataType } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..9e45e49 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.0-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("invalid argument. Must provide a recognized data type. Value: `%s`.",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..6a7db90 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+XA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,sEAAuEP,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 2b853c6..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index bc65ab7..06becf4 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,46 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.2.0", - "@stdlib/array-typed-complex-ctors": "^0.2.0", - "@stdlib/assert-is-string": "^0.2.0", - "@stdlib/error-tools-fmtprodmsg": "^0.2.0", - "@stdlib/types": "^0.3.1" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.0", - "@stdlib/array-complex128": "^0.1.0", - "@stdlib/array-complex64": "^0.1.0", - "@stdlib/array-float64": "^0.2.0", - "@stdlib/assert-instance-of": "^0.2.0", - "@stdlib/assert-is-complex-typed-array": "^0.2.0", - "@stdlib/blas-ext-base-gfill-by": "^0.1.0", - "@stdlib/complex-float64": "^0.2.0", - "@stdlib/math-base-special-pow": "^0.2.0", - "@stdlib/random-base-discrete-uniform": "^0.1.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.0", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..344a15b --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 00986f71b39131e8f20dde93395ba4d72349df7a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 04:53:09 +0000 Subject: [PATCH 079/176] Update README.md for ESM bundle v0.2.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 409d4ac..d2226d3 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.0-esm/index.mjs'; ``` #### complexarray( \[dtype] ) @@ -174,7 +174,7 @@ import discreteUniform from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-d import gfillBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gfill-by@esm/index.mjs'; import Complex128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64@esm/index.mjs'; import reinterpret128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@esm/index.mjs'; -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.0-esm/index.mjs'; function rand() { var re = discreteUniform( -10, 10 ); From ce07c7a9446858e0268059263eeea4d1a86804a8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 15 Feb 2024 04:53:09 +0000 Subject: [PATCH 080/176] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index d2226d3..d126dce 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,11 @@ limitations under the License. ## Usage +```javascript +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-typed-complex/tags). For example, + ```javascript import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.0-esm/index.mjs'; ``` @@ -174,7 +179,7 @@ import discreteUniform from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-d import gfillBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gfill-by@esm/index.mjs'; import Complex128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64@esm/index.mjs'; import reinterpret128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@esm/index.mjs'; -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.0-esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; function rand() { var re = discreteUniform( -10, 10 ); From 920bcbbc9b5532d60222edf22cbf4789ccf91db4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 22 Feb 2024 22:04:10 +0000 Subject: [PATCH 081/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index cd7c6f8..ce73e9f 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.2.0", "@stdlib/array-typed-complex-ctors": "^0.2.0", "@stdlib/assert-is-string": "^0.2.1", - "@stdlib/string-format": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1", "@stdlib/types": "^0.3.2" }, "devDependencies": { From 6da323d60c173261a5bdbeab51b6e71893fbc54f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 22 Feb 2024 22:45:13 +0000 Subject: [PATCH 082/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6353 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 87ddfb4..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataType as DataType } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: DataType ): ComplexTypedArray; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: DataType ): ComplexTypedArray; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 9e45e49..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.0-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.1.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("invalid argument. Must provide a recognized data type. Value: `%s`.",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 6a7db90..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/string-format';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;+XA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,sEAAuEP,IAErG,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 344a15b..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 1bf6616b0e8af51dad144aa81ba361c8560b888e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 22 Feb 2024 22:46:54 +0000 Subject: [PATCH 083/176] 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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 67 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 44 files changed, 4870 insertions(+), 4737 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 86555c5..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){ -var u=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/array-typed-complex-ctors/dist'),g=require('@stdlib/array-defaults/dist'),m=require('@stdlib/error-tools-fmtprodmsg/dist'),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v -});var l=n();module.exports=l; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a646e68 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index ce73e9f..06becf4 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.0", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,46 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.2.0", - "@stdlib/array-typed-complex-ctors": "^0.2.0", - "@stdlib/assert-is-string": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1", - "@stdlib/types": "^0.3.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.0", - "@stdlib/array-complex128": "^0.2.0", - "@stdlib/array-complex64": "^0.2.0", - "@stdlib/array-float64": "^0.2.1", - "@stdlib/assert-instance-of": "^0.2.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.0", - "@stdlib/blas-ext-base-gfill-by": "^0.2.0", - "@stdlib/complex-float64": "^0.2.0", - "@stdlib/math-base-special-pow": "^0.2.0", - "@stdlib/random-base-discrete-uniform": "^0.2.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..7ed5325 --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 970a4bbc068604276dbf0a1c8664f72730df1cd3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 19:11:52 +0000 Subject: [PATCH 084/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 8837b9d..db3fee7 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.2.1", "@stdlib/array-typed-complex-ctors": "^0.2.1", "@stdlib/assert-is-string": "^0.2.1", - "@stdlib/string-format": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1", "@stdlib/types": "^0.3.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, From f9c382298cc854cdca7aab5da4df729ead5652e0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 20:13:58 +0000 Subject: [PATCH 085/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index a646e68..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 7ed5325..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 3143539356e1c4cc3c4cad9c4219bcf63cb091f4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 20:14:24 +0000 Subject: [PATCH 086/176] 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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 44 files changed, 4870 insertions(+), 4738 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 86555c5..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){ -var u=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/array-typed-complex-ctors/dist'),g=require('@stdlib/array-defaults/dist'),m=require('@stdlib/error-tools-fmtprodmsg/dist'),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v -});var l=n();module.exports=l; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..96a55db --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index db3fee7..bc277cd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.2.1", - "@stdlib/array-typed-complex-ctors": "^0.2.1", - "@stdlib/assert-is-string": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1", - "@stdlib/types": "^0.3.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.1", - "@stdlib/array-complex128": "^0.2.0", - "@stdlib/array-complex64": "^0.2.0", - "@stdlib/array-float64": "^0.2.1", - "@stdlib/assert-instance-of": "^0.2.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.1", - "@stdlib/blas-ext-base-gfill-by": "^0.2.0", - "@stdlib/complex-float64": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.0", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..dc6657c --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From ec30d5e063d6ce3054b6e2fc7e407d671ba532db Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 20:53:34 +0000 Subject: [PATCH 087/176] Update README.md for ESM bundle v0.2.1 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 384024b..18aeac2 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.1-esm/index.mjs'; ``` #### complexarray( \[dtype] ) @@ -174,7 +174,7 @@ import discreteUniform from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-d import gfillBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gfill-by@esm/index.mjs'; import Complex128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64@esm/index.mjs'; import reinterpret128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@esm/index.mjs'; -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.1-esm/index.mjs'; function rand() { var re = discreteUniform( -10, 10 ); From 4dc50ccb1962562e58452303e76529c43853da5c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 25 Feb 2024 20:53:34 +0000 Subject: [PATCH 088/176] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 18aeac2..54908a5 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,11 @@ limitations under the License. ## Usage +```javascript +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-typed-complex/tags). For example, + ```javascript import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.1-esm/index.mjs'; ``` @@ -174,7 +179,7 @@ import discreteUniform from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-d import gfillBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gfill-by@esm/index.mjs'; import Complex128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64@esm/index.mjs'; import reinterpret128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@esm/index.mjs'; -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.1-esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; function rand() { var re = discreteUniform( -10, 10 ); From 94d0842264db9cf99387295ef51a5cc4036b19c6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 07:56:54 +0000 Subject: [PATCH 089/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index fa4c9ba..d74ecbb 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.2.1", "@stdlib/array-typed-complex-ctors": "^0.2.1", "@stdlib/assert-is-string": "^0.2.1", - "@stdlib/string-format": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1", "@stdlib/types": "^0.3.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, From b6998c5652e25ff17c6516ea4290313e013b6542 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 13:37:21 +0000 Subject: [PATCH 090/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 96a55db..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.0-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index dc6657c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 7cc6f33db034fb66bf2b5c0a412538f9680f8128 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 13:37:42 +0000 Subject: [PATCH 091/176] 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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 45 files changed, 4870 insertions(+), 4740 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 b78c7e6..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-03-01T05:43:49.283Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 86555c5..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){ -var u=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/array-typed-complex-ctors/dist'),g=require('@stdlib/array-defaults/dist'),m=require('@stdlib/error-tools-fmtprodmsg/dist'),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v -});var l=n();module.exports=l; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..01a0c07 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index d74ecbb..bc277cd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.2.1", - "@stdlib/array-typed-complex-ctors": "^0.2.1", - "@stdlib/assert-is-string": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1", - "@stdlib/types": "^0.3.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.1", - "@stdlib/array-complex128": "^0.2.1", - "@stdlib/array-complex64": "^0.2.1", - "@stdlib/array-float64": "^0.2.1", - "@stdlib/assert-instance-of": "^0.2.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.1", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..717b588 --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From aa4af0851d57804df6105364a7fa249f5e89520c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 07:14:06 +0000 Subject: [PATCH 092/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index fa4c9ba..d74ecbb 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.2.1", "@stdlib/array-typed-complex-ctors": "^0.2.1", "@stdlib/assert-is-string": "^0.2.1", - "@stdlib/string-format": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1", "@stdlib/types": "^0.3.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, From 0e775a4aa5f6f48a288e3e80345da2a6f2a1426f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 12:36:14 +0000 Subject: [PATCH 093/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 01a0c07..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 717b588..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 5df8cbf7936800006575fe1ac79e16e91cb990df Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 12:36:33 +0000 Subject: [PATCH 094/176] 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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 45 files changed, 4870 insertions(+), 4743 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 dc9f9fe..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-04-01T05:01:45.997Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 86555c5..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){ -var u=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/array-typed-complex-ctors/dist'),g=require('@stdlib/array-defaults/dist'),m=require('@stdlib/error-tools-fmtprodmsg/dist'),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v -});var l=n();module.exports=l; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..01a0c07 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index d74ecbb..bc277cd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.2.1", - "@stdlib/array-typed-complex-ctors": "^0.2.1", - "@stdlib/assert-is-string": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1", - "@stdlib/types": "^0.3.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.1", - "@stdlib/array-complex128": "^0.2.1", - "@stdlib/array-complex64": "^0.2.1", - "@stdlib/array-float64": "^0.2.1", - "@stdlib/assert-instance-of": "^0.2.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.1", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..717b588 --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 0614308226d2435547deb44a5bc59f6bc64a7e70 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 03:31:21 +0000 Subject: [PATCH 095/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index fa4c9ba..d74ecbb 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.2.1", "@stdlib/array-typed-complex-ctors": "^0.2.1", "@stdlib/assert-is-string": "^0.2.1", - "@stdlib/string-format": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1", "@stdlib/types": "^0.3.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, From 3a623939da6f6df3944d0ab576034b8c189e7cdd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 08:56:18 +0000 Subject: [PATCH 096/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 01a0c07..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 717b588..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From e5ca12403315a0383275861223c052af154d4ebc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 08:56:35 +0000 Subject: [PATCH 097/176] 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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 44 files changed, 4870 insertions(+), 4744 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 86555c5..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){ -var u=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/array-typed-complex-ctors/dist'),g=require('@stdlib/array-defaults/dist'),m=require('@stdlib/error-tools-fmtprodmsg/dist'),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v -});var l=n();module.exports=l; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 95c1889..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..01a0c07 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index d74ecbb..bc277cd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.2.1", - "@stdlib/array-typed-complex-ctors": "^0.2.1", - "@stdlib/assert-is-string": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1", - "@stdlib/types": "^0.3.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.1", - "@stdlib/array-complex128": "^0.2.1", - "@stdlib/array-complex64": "^0.2.1", - "@stdlib/array-float64": "^0.2.1", - "@stdlib/assert-instance-of": "^0.2.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.1", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64": "^0.2.1", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..717b588 --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From fa9d0e474361c51f5359b9de7807ae85056eb37e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 25 May 2024 08:56:20 +0000 Subject: [PATCH 098/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index b85e510..4ea0c7e 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.2.1", "@stdlib/array-typed-complex-ctors": "^0.2.1", "@stdlib/assert-is-string": "^0.2.1", - "@stdlib/string-format": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1", "@stdlib/types": "^0.3.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, From 2f3d1246bbaa2956cbb6acb7a54b2ce1b1b98308 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 25 May 2024 08:58:52 +0000 Subject: [PATCH 099/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 01a0c07..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 717b588..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 39072a15a6308db859d8ed47916b295a81bea645 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 25 May 2024 08:59:07 +0000 Subject: [PATCH 100/176] 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 | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 44 files changed, 4870 insertions(+), 4751 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 86555c5..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){ -var u=require('@stdlib/assert-is-string/dist').isPrimitive,s=require('@stdlib/array-typed-complex-ctors/dist'),g=require('@stdlib/array-defaults/dist'),m=require('@stdlib/error-tools-fmtprodmsg/dist'),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m('01r2Y',e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v -});var l=n();module.exports=l; -/** @license Apache-2.0 */ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..01a0c07 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 4ea0c7e..bc277cd 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.2.1", - "@stdlib/array-typed-complex-ctors": "^0.2.1", - "@stdlib/assert-is-string": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1", - "@stdlib/types": "^0.3.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.1", - "@stdlib/array-complex128": "^0.2.1", - "@stdlib/array-complex64": "^0.2.1", - "@stdlib/array-float64": "^0.2.1", - "@stdlib/assert-instance-of": "^0.2.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.1", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "github:stdlib-js/complex-float64-ctor#main", - "@stdlib/math-base-special-pow": "^0.2.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..717b588 --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 402d138ad87fd2e3e1fd6ffa3f859ac6c7e36d45 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:42:19 +0000 Subject: [PATCH 101/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 65ce334..d67153b 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.1", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.3.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From b1049b6517424609fc1b4d610fb71d4a1a322aef Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:54:36 +0000 Subject: [PATCH 102/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 01a0c07..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.1-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.1-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.2.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 717b588..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a81160e20cd12d3b93575d3d3c7c7804eb9c8d5a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 02:54:57 +0000 Subject: [PATCH 103/176] 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 | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 216 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 44 files changed, 4870 insertions(+), 4982 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0c4866c --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index d67153b..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.1", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.3.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.2.1", - "@stdlib/array-complex64": "^0.2.1", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 3c9746fce469f64a8a42e95860d3a6e387023927 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 03:01:37 +0000 Subject: [PATCH 104/176] Update README.md for ESM bundle v0.2.2 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 76e3278..fa4dda6 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.2-esm/index.mjs'; ``` #### complexarray( \[dtype] ) @@ -174,7 +174,7 @@ import discreteUniform from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-d import gfillBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gfill-by@esm/index.mjs'; import Complex128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@esm/index.mjs'; import reinterpret128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@esm/index.mjs'; -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.2-esm/index.mjs'; function rand() { var re = discreteUniform( -10, 10 ); From 7a60d2c06549632c026b69be5b74f400ead5e801 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Jul 2024 03:01:38 +0000 Subject: [PATCH 105/176] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index fa4dda6..2a8164a 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,11 @@ limitations under the License. ## Usage +```javascript +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-typed-complex/tags). For example, + ```javascript import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.2-esm/index.mjs'; ``` @@ -174,7 +179,7 @@ import discreteUniform from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-d import gfillBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gfill-by@esm/index.mjs'; import Complex128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@esm/index.mjs'; import reinterpret128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@esm/index.mjs'; -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.2-esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; function rand() { var re = discreteUniform( -10, 10 ); From 85a8fb29b2570a42f79047f1833601c6a7035510 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 07:57:32 +0000 Subject: [PATCH 106/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index c12754e..d655024 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.3.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From c524075a5aeafa1c61ef6e2f1a58fd69c9cf95c9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 12:50:10 +0000 Subject: [PATCH 107/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0c4866c..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From ad3b77d40f211f19305a32f78118661ae51cebd5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 12:50:31 +0000 Subject: [PATCH 108/176] 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 | 88 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 45 files changed, 4870 insertions(+), 4855 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 011e2e5..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-01T05:50:34.430Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0c4866c --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index d655024..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.3.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From a8fa59dcc1bdf0723c4400061e91a1a5b1fa658f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 08:20:42 +0000 Subject: [PATCH 109/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 81e605b..5cc65d0 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.1", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From 898b9f1d3782b39415b4136c75d7a00765f5fe9f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 12:48:01 +0000 Subject: [PATCH 110/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0c4866c..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From afac3fc88b69fdcd92258088a0d286b44f3b3fc0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 12:48:23 +0000 Subject: [PATCH 111/176] 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 | 214 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 45 files changed, 4870 insertions(+), 4981 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 82b1f11..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-09-01T06:17:06.326Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 014eab1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers - - complex64: single-precision complex floating-point numbers - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0c4866c --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5cc65d0..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 7537d8c36e065f62e56160d4b951f4d9dc08c515 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 21 Sep 2024 21:25:14 +0000 Subject: [PATCH 112/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 81e605b..5cc65d0 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.1", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From a72eea16375448bf6b824f357a5d258c4d80a5c3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 21 Sep 2024 21:27:35 +0000 Subject: [PATCH 113/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0c4866c..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 6aeae833d9c4159694feffd84f299e29ec5f45ff Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 21 Sep 2024 21:27:53 +0000 Subject: [PATCH 114/176] 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 | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 248 -- CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 44 files changed, 4870 insertions(+), 5014 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0c4866c --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5cc65d0..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 5f9c2021a7abe621e859b3bf43271c8b2805496c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 08:38:16 +0000 Subject: [PATCH 115/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 81e605b..5cc65d0 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.1", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From 2c08a1088d57dc4dec698d32f0749365860b7435 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 13:18:59 +0000 Subject: [PATCH 116/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0c4866c..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From cbb1172c9ff92e9dfd0bcb5e88b225f384b58e2a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 13:19:22 +0000 Subject: [PATCH 117/176] 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 | 248 -- CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 45 files changed, 4870 insertions(+), 5015 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 50009d9..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-10-01T06:29:18.826Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0c4866c --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5cc65d0..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 08063f1596c41e9369266f94396b81d014d5dd55 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 08:25:00 +0000 Subject: [PATCH 118/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 81e605b..5cc65d0 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.1", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From 621d81dd1a9bc9e13808f2a6b8263ab0805dece6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 12:22:45 +0000 Subject: [PATCH 119/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0c4866c..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 7971d3d8df0072ecf0f4c3763ab5f2de6da6769b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 12:23:06 +0000 Subject: [PATCH 120/176] 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 | 248 -- CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 45 files changed, 4870 insertions(+), 5015 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 75d34ab..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-11-01T06:32:31.436Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0c4866c --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5cc65d0..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 0592de1bccf2eaab4d82938cefa4bac8ad754126 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 08:41:47 +0000 Subject: [PATCH 121/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 668eceb..5e04ddd 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From fd7a7006c47e036bc3947dafca53486ff6cb63c7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 12:46:16 +0000 Subject: [PATCH 122/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0c4866c..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 379d9d9b5827a65da0852cb7c854ab5ee6106cdf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 12:46:37 +0000 Subject: [PATCH 123/176] 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 | 248 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5120 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 e0c4e5a..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-01T06:42:14.883Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0c4866c --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5e04ddd..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From ebb6dee0e9ce8b217a5bcc3d1847c2e75254bfba Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 03:51:18 +0000 Subject: [PATCH 124/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 668eceb..5e04ddd 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From 1dde8595877c27b9a1b3ab95fa18e58615d816cd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 05:07:14 +0000 Subject: [PATCH 125/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0c4866c..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From d7e958affded062b1d095ab3d6e815605d884b95 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 30 Dec 2024 05:07:32 +0000 Subject: [PATCH 126/176] 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 | 248 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5120 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 2618d69..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-30T03:17:00.388Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 31f9eb3..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..0c4866c --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5e04ddd..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 00897c8d39fd768646fb46700be5833c7a50c8fd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 24 Feb 2025 00:50:44 +0000 Subject: [PATCH 127/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 668eceb..5e04ddd 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From a716f989a4888f5b807f5ea0099ec84c54862064 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 24 Feb 2025 01:02:08 +0000 Subject: [PATCH 128/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 0c4866c..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2024 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From f21360f4dd7cb348f6fb8aaa742b65bd5fd4bde3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 24 Feb 2025 01:02:25 +0000 Subject: [PATCH 129/176] 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 | 248 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5123 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 a120d62..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-02-24T00:48:43.434Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d34190e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5e04ddd..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 99037d5f974cae90d175e52007bc42001662d811 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 17 Mar 2025 01:02:32 +0000 Subject: [PATCH 130/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 668eceb..5e04ddd 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From a91708d48a4202ffca77fd7a144d8a21e64bf1a1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 17 Mar 2025 01:16:34 +0000 Subject: [PATCH 131/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index d34190e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From fb84637427f8172db25deac6e757d34b09f17a20 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 17 Mar 2025 01:17:01 +0000 Subject: [PATCH 132/176] 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 | 248 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5123 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 e97037c..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-03-17T01:00:40.905Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d34190e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5e04ddd..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 98a19fefd2122a4dc4efe31e102b37f1972ffaba Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 19 May 2025 02:27:30 +0000 Subject: [PATCH 133/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 668eceb..5e04ddd 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From 176063ab984ee3c22315a4073b3ee92bb5595b7e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 19 May 2025 02:48:29 +0000 Subject: [PATCH 134/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index d34190e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 6702c7d2be87d90eb3f8c02e5af3561cfad77986 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 19 May 2025 02:48:46 +0000 Subject: [PATCH 135/176] 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 | 248 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5123 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 815874f..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-05-19T01:55:24.446Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d34190e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5e04ddd..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From fb64691421e26b063f706f1f24a039a2d080426c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 26 May 2025 01:42:20 +0000 Subject: [PATCH 136/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 668eceb..5e04ddd 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From 4dc45415cdc56762e9a0840a845497408855004d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 26 May 2025 02:18:30 +0000 Subject: [PATCH 137/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index d34190e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 5fc100a2bf395a0387a0772383224cee08601b49 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 26 May 2025 02:18:57 +0000 Subject: [PATCH 138/176] 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 | 248 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5123 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 eb95272..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-05-26T01:37:47.550Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d34190e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5e04ddd..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 90deeed64d0e6fc16f21845297c09a9b2dee9fad Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 11 Aug 2025 01:04:23 +0000 Subject: [PATCH 139/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 668eceb..5e04ddd 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From d39c570fed4826fcc011596f8621c3cd2cb986ae Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 11 Aug 2025 01:11:42 +0000 Subject: [PATCH 140/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index d34190e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 70bed3d7fb9e3a836b2743b2db4c4f85017416cd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 11 Aug 2025 01:11:59 +0000 Subject: [PATCH 141/176] 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 | 248 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5123 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 72cc683..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-08-11T00:57:30.500Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d34190e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5e04ddd..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 990fa7dcaa7bb805c4850dccd6da8b53d38871a2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 18 Aug 2025 00:36:39 +0000 Subject: [PATCH 142/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 668eceb..5e04ddd 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From 1f7085595da26267bd01628eca8737d827f9ef26 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 18 Aug 2025 00:36:58 +0000 Subject: [PATCH 143/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index d34190e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 72fffc6445ec7633e278ec58d224ca0a07831753 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 18 Aug 2025 00:37:23 +0000 Subject: [PATCH 144/176] 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 | 248 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5123 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 a5178d2..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-08-18T00:36:12.076Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index a088760..6347daa 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d34190e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5e04ddd..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From fec768315bebb65bd7d28492463548867abc5f51 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Sep 2025 05:33:54 +0000 Subject: [PATCH 145/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 668eceb..5e04ddd 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.3.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From 679a8a930faf4e7e3ca5e00138b416a6dc45e528 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Sep 2025 05:34:13 +0000 Subject: [PATCH 146/176] Remove files --- index.d.ts | 171 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5018 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 6347daa..0000000 --- a/index.d.ts +++ /dev/null @@ -1,171 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index d34190e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 30ec51dd75a7e58e22ee5dd581c04906b3a29b41 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 29 Sep 2025 05:34:42 +0000 Subject: [PATCH 147/176] Auto-generated commit --- .editorconfig | 180 - .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 | 199 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 249 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 45 files changed, 4870 insertions(+), 5128 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 5880b18..41c9dea 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d34190e --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 5e04ddd..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.3.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.2.2", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.0.3", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ed9f3ab --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 202513d8f857dd18e62ac23e4312ff4073e8b643 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 31 Jan 2026 01:15:01 +0000 Subject: [PATCH 148/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index ebcef96..df56eb5 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.4.0", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, From 61b1d96a31f3a30345c5ae7a4f9bcae0fb15b08b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 31 Jan 2026 01:42:20 +0000 Subject: [PATCH 149/176] Remove files --- index.d.ts | 175 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5022 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 41c9dea..0000000 --- a/index.d.ts +++ /dev/null @@ -1,175 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index d34190e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.3.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ed9f3ab..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 79c17ebb02e0cf69e0ff25f021f341db07db90b6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 31 Jan 2026 01:42:40 +0000 Subject: [PATCH 150/176] Auto-generated commit --- .editorconfig | 180 - .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 | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 108 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 199 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 249 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 45 files changed, 4870 insertions(+), 5228 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +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 notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 5880b18..41c9dea 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..83df124 --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index df56eb5..d3d6137 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.4.0", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.2", - "@stdlib/array-complex128": "^0.3.0", - "@stdlib/array-complex64": "^0.3.0", - "@stdlib/array-float64": "^0.2.2", - "@stdlib/assert-instance-of": "^0.3.0", - "@stdlib/assert-is-complex-typed-array": "^0.2.2", - "@stdlib/blas-ext-base-gfill-by": "^0.2.1", - "@stdlib/complex-float64-ctor": "^0.1.0", - "@stdlib/math-base-special-pow": "^0.3.0", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.1", - "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", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..438d1cb --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From dcdd266552b3c533c57481eb14eaa27179db0ee0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 8 Feb 2026 17:42:09 +0000 Subject: [PATCH 151/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index af410c3..d94c4bc 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.4.1", "@stdlib/array-typed-complex-ctors": "^0.2.2", "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/string-format": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.3" }, From c198c29ca3d205ebbf855a95a69c4d134d8901d9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 8 Feb 2026 18:28:53 +0000 Subject: [PATCH 152/176] Remove files --- index.d.ts | 175 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5022 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 41c9dea..0000000 --- a/index.d.ts +++ /dev/null @@ -1,175 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 83df124..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.2-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.0-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 438d1cb..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From d6041490f38c19d753e8f7d5497232ab4d8f48db Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 8 Feb 2026 18:29:12 +0000 Subject: [PATCH 153/176] Auto-generated commit --- .editorconfig | 180 - .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 | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 199 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 249 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 45 files changed, 4870 insertions(+), 5221 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +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 notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 5880b18..41c9dea 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..08f5add --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index d94c4bc..f1b2b07 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.4.1", - "@stdlib/array-typed-complex-ctors": "^0.2.2", - "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.3", - "@stdlib/array-complex128": "^0.3.1", - "@stdlib/array-complex64": "^0.3.1", - "@stdlib/array-float64": "^0.2.3", - "@stdlib/assert-instance-of": "^0.3.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.3", - "@stdlib/blas-ext-base-gfill-by": "^0.2.2", - "@stdlib/complex-float64-ctor": "^0.1.2", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/random-base-discrete-uniform": "^0.2.1", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.3", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.2", - "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.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..76c327a --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 80098e6c0eee9ec8d4761340bc4b3eeef4622285 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 8 Feb 2026 19:00:01 +0000 Subject: [PATCH 154/176] Update README.md for ESM bundle v0.2.3 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 5c3e8ef..6eee673 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.3-esm/index.mjs'; ``` #### complexarray( \[dtype] ) @@ -174,7 +174,7 @@ import discreteUniform from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-d import gfillBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gfill-by@esm/index.mjs'; import Complex128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@esm/index.mjs'; import reinterpret128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@esm/index.mjs'; -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.3-esm/index.mjs'; function rand() { var re = discreteUniform( -10, 10 ); From 6e749d97353d9240482102c2f62f7d9043c7f557 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 8 Feb 2026 19:00:02 +0000 Subject: [PATCH 155/176] Auto-generated commit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6eee673..388295c 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,11 @@ limitations under the License. ## Usage +```javascript +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; +``` +The previous example will load the latest bundled code from the esm branch. Alternatively, you may load a specific version by loading the file from one of the [tagged bundles](https://github.com/stdlib-js/array-typed-complex/tags). For example, + ```javascript import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.3-esm/index.mjs'; ``` @@ -174,7 +179,7 @@ import discreteUniform from 'https://cdn.jsdelivr.net/gh/stdlib-js/random-base-d import gfillBy from 'https://cdn.jsdelivr.net/gh/stdlib-js/blas-ext-base-gfill-by@esm/index.mjs'; import Complex128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/complex-float64-ctor@esm/index.mjs'; import reinterpret128 from 'https://cdn.jsdelivr.net/gh/stdlib-js/strided-base-reinterpret-complex128@esm/index.mjs'; -import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@v0.2.3-esm/index.mjs'; +import complexarray from 'https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex@esm/index.mjs'; function rand() { var re = discreteUniform( -10, 10 ); From 8d2507dbc39af7d1c793e55967614c4b2ef34e2e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 23 Feb 2026 02:26:53 +0000 Subject: [PATCH 156/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 24564e9..946c164 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.4.1", "@stdlib/array-typed-complex-ctors": "^0.2.3", "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/string-format": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.3" }, From a42aed8dad7ce20505716a92de50c6ed269f9f96 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 23 Feb 2026 04:05:59 +0000 Subject: [PATCH 157/176] Remove files --- index.d.ts | 175 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5022 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 41c9dea..0000000 --- a/index.d.ts +++ /dev/null @@ -1,175 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 08f5add..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.2-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 76c327a..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From cd412df35c6de8a800adfccc87ad4c6bab8b7e0d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 23 Feb 2026 04:06:18 +0000 Subject: [PATCH 158/176] 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 | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 199 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 249 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5222 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 55d35da..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2026-02-23T01:50:37.934Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +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 notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 5880b18..41c9dea 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..2364fab --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 946c164..f1b2b07 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.4.1", - "@stdlib/array-typed-complex-ctors": "^0.2.3", - "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.3", - "@stdlib/array-complex128": "^0.3.2", - "@stdlib/array-complex64": "^0.3.2", - "@stdlib/array-float64": "^0.2.3", - "@stdlib/assert-instance-of": "^0.3.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.3", - "@stdlib/blas-ext-base-gfill-by": "^0.2.3", - "@stdlib/complex-float64-ctor": "^0.1.2", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/random-base-discrete-uniform": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.3", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.2", - "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.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..20dd79c --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From e2797a472e0186b67ab2ae2e5f41d11912364cb8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Mar 2026 00:57:29 +0000 Subject: [PATCH 159/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 24564e9..946c164 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.4.1", "@stdlib/array-typed-complex-ctors": "^0.2.3", "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/string-format": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.3" }, From 88f935cee34bdf442834e46768a254efe703113c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Mar 2026 01:03:28 +0000 Subject: [PATCH 160/176] Remove files --- index.d.ts | 175 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5022 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 41c9dea..0000000 --- a/index.d.ts +++ /dev/null @@ -1,175 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 2364fab..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 20dd79c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 4bcc5e332fc6c0e1b48d58b0f16b7f7cfbc119de Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Mar 2026 01:03:46 +0000 Subject: [PATCH 161/176] 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 | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 199 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 249 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5222 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.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 8c23b98..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2026-03-09T00:50:42.882Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +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 notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 5880b18..41c9dea 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..2364fab --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 946c164..f1b2b07 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.4.1", - "@stdlib/array-typed-complex-ctors": "^0.2.3", - "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.3", - "@stdlib/array-complex128": "^0.3.2", - "@stdlib/array-complex64": "^0.3.2", - "@stdlib/array-float64": "^0.2.3", - "@stdlib/assert-instance-of": "^0.3.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.3", - "@stdlib/blas-ext-base-gfill-by": "^0.2.3", - "@stdlib/complex-float64-ctor": "^0.1.2", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/random-base-discrete-uniform": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.3", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.2", - "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.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..20dd79c --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 643b00a8d77ffddc323e1093aaef4d659b693083 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 2 Apr 2026 03:23:35 +0000 Subject: [PATCH 162/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 24564e9..946c164 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.4.1", "@stdlib/array-typed-complex-ctors": "^0.2.3", "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/string-format": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.3" }, From 40b6b4d342c4192e10e0b300ec6af914f9dbcce1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 2 Apr 2026 03:34:14 +0000 Subject: [PATCH 163/176] Remove files --- index.d.ts | 175 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5022 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 41c9dea..0000000 --- a/index.d.ts +++ /dev/null @@ -1,175 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 2364fab..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 20dd79c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 55f61904cabed2e509700852ba5cdacefcd5c786 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 2 Apr 2026 03:34:31 +0000 Subject: [PATCH 164/176] Auto-generated commit --- .editorconfig | 189 - .eslintrc.js | 1 - .gitattributes | 68 - .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 | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 199 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 249 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5233 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 80f3fca..0000000 --- a/.editorconfig +++ /dev/null @@ -1,189 +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 - -# Ignore generated lock files for GitHub Agentic Workflows: -[*.lock.yml] -charset = unset -end_of_line = unset -indent_style = unset -indent_size = unset -trim_trailing_whitespace = unset -insert_final_newline = unset - -# 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 24b327f..0000000 --- a/.gitattributes +++ /dev/null @@ -1,68 +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 - -.github/workflows/*.lock.yml linguist-generated=true merge=ours diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 4a21479..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2026-04-02T03:20:58.986Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +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 notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 5880b18..41c9dea 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..2364fab --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 946c164..f1b2b07 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.4.1", - "@stdlib/array-typed-complex-ctors": "^0.2.3", - "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.3", - "@stdlib/array-complex128": "^0.3.2", - "@stdlib/array-complex64": "^0.3.2", - "@stdlib/array-float64": "^0.2.3", - "@stdlib/assert-instance-of": "^0.3.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.3", - "@stdlib/blas-ext-base-gfill-by": "^0.2.3", - "@stdlib/complex-float64-ctor": "^0.1.2", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/random-base-discrete-uniform": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.3", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.2", - "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.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..20dd79c --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 243bc1f16d56eae36aa306521a7e992ba873d4c7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 9 May 2026 03:39:12 +0000 Subject: [PATCH 165/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 24564e9..946c164 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.4.1", "@stdlib/array-typed-complex-ctors": "^0.2.3", "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/string-format": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.3" }, From f9d71d62d945f324f6833db0520e7eecfc35fd73 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 9 May 2026 03:51:41 +0000 Subject: [PATCH 166/176] Remove files --- index.d.ts | 175 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5022 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 41c9dea..0000000 --- a/index.d.ts +++ /dev/null @@ -1,175 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 2364fab..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 20dd79c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 65e1a972a1a97f5a2c82182934576c749d42b601 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 9 May 2026 03:51:56 +0000 Subject: [PATCH 167/176] Auto-generated commit --- .editorconfig | 189 - .eslintrc.js | 1 - .gitattributes | 68 - .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 | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 204 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 249 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 83 - benchmark/benchmark.length.complex128.js | 93 - benchmark/benchmark.length.complex64.js | 93 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5238 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 80f3fca..0000000 --- a/.editorconfig +++ /dev/null @@ -1,189 +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 - -# Ignore generated lock files for GitHub Agentic Workflows: -[*.lock.yml] -charset = unset -end_of_line = unset -indent_style = unset -indent_size = unset -trim_trailing_whitespace = unset -insert_final_newline = unset - -# 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 24b327f..0000000 --- a/.gitattributes +++ /dev/null @@ -1,68 +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 - -.github/workflows/*.lock.yml linguist-generated=true merge=ours diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 07d540c..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2026-05-09T03:30:56.003Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +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 notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 39c5683..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,83 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex128', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+':dtype=complex64', function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 2b0e13f..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex128,len='+len, f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 44fff31..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( pkg+':dtype=complex64,len='+len, f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 5880b18..41c9dea 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..2364fab --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 946c164..f1b2b07 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.4.1", - "@stdlib/array-typed-complex-ctors": "^0.2.3", - "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.3", - "@stdlib/array-complex128": "^0.3.2", - "@stdlib/array-complex64": "^0.3.2", - "@stdlib/array-float64": "^0.2.3", - "@stdlib/assert-instance-of": "^0.3.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.3", - "@stdlib/blas-ext-base-gfill-by": "^0.2.3", - "@stdlib/complex-float64-ctor": "^0.1.2", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/random-base-discrete-uniform": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.3", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.2", - "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.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..20dd79c --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From 4a78059a96b6dbbed036c85e7370baa0b3f1665e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 18 May 2026 12:04:51 +0000 Subject: [PATCH 168/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index 24564e9..946c164 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.4.1", "@stdlib/array-typed-complex-ctors": "^0.2.3", "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/string-format": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3", "@stdlib/types": "^0.4.3", "@stdlib/error-tools-fmtprodmsg": "^0.2.3" }, From 6c51cd63e5779e76d8dad3390ed8ecc0e96478ac Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 18 May 2026 12:32:16 +0000 Subject: [PATCH 169/176] Remove files --- index.d.ts | 175 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5022 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 41c9dea..0000000 --- a/index.d.ts +++ /dev/null @@ -1,175 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 2364fab..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 20dd79c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From e3264ab4fa9b1d59aed1fe43cdc446004d2b437c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 18 May 2026 12:32:32 +0000 Subject: [PATCH 170/176] Auto-generated commit --- .editorconfig | 189 - .eslintrc.js | 1 - .gitattributes | 68 - .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 | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 204 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 284 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 84 - benchmark/benchmark.length.complex128.js | 94 - benchmark/benchmark.length.complex64.js | 94 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 45 files changed, 4870 insertions(+), 5275 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 80f3fca..0000000 --- a/.editorconfig +++ /dev/null @@ -1,189 +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 - -# Ignore generated lock files for GitHub Agentic Workflows: -[*.lock.yml] -charset = unset -end_of_line = unset -indent_style = unset -indent_size = unset -trim_trailing_whitespace = unset -insert_final_newline = unset - -# 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 24b327f..0000000 --- a/.gitattributes +++ /dev/null @@ -1,68 +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 - -.github/workflows/*.lock.yml linguist-generated=true merge=ours diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +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 notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 05f13e0..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,84 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:dtype=complex128', pkg ), function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:dtype=complex64', pkg ), function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 5791321..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,94 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:dtype=complex128,len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68d1aa0..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,94 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:dtype=complex64,len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 516e356..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){return e||r((e={exports:{}}).exports,e),e.exports}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 16555ca..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 5880b18..41c9dea 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..2364fab --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 946c164..f1b2b07 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.4.1", - "@stdlib/array-typed-complex-ctors": "^0.2.3", - "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3", - "@stdlib/types": "^0.4.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.3", - "@stdlib/array-complex128": "^0.3.2", - "@stdlib/array-complex64": "^0.3.2", - "@stdlib/array-float64": "^0.2.3", - "@stdlib/assert-instance-of": "^0.3.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.3", - "@stdlib/blas-ext-base-gfill-by": "^0.2.3", - "@stdlib/complex-float64-ctor": "^0.1.2", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/random-base-discrete-uniform": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.3", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.2", - "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.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..20dd79c --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From f3aa063504b064aa91dc667adce8fd10450fa812 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 18 Jun 2026 03:25:16 +0000 Subject: [PATCH 171/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index a3c1151..4c56630 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.4.1", "@stdlib/array-typed-complex-ctors": "^0.2.3", "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/string-format": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3", "@stdlib/types": "^0.5.1", "@stdlib/error-tools-fmtprodmsg": "^0.2.3" }, From 08dd7cbe0069f4d36f3705374ed8ae54bc1394f8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 18 Jun 2026 03:40:33 +0000 Subject: [PATCH 172/176] Remove files --- index.d.ts | 175 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5022 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 41c9dea..0000000 --- a/index.d.ts +++ /dev/null @@ -1,175 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 2364fab..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 20dd79c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 96b1049b8e944bd371ca0c2dab46a4228375e6ce Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 18 Jun 2026 03:40:51 +0000 Subject: [PATCH 173/176] Auto-generated commit --- .editorconfig | 189 - .eslintrc.js | 1 - .gitattributes | 68 - .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 | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 204 - .npmignore | 229 - .npmrc | 44 - CHANGELOG.md | 284 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 84 - benchmark/benchmark.length.complex128.js | 94 - benchmark/benchmark.length.complex64.js | 94 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5289 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 80f3fca..0000000 --- a/.editorconfig +++ /dev/null @@ -1,189 +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 - -# Ignore generated lock files for GitHub Agentic Workflows: -[*.lock.yml] -charset = unset -end_of_line = unset -indent_style = unset -indent_size = unset -trim_trailing_whitespace = unset -insert_final_newline = unset - -# 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 24b327f..0000000 --- a/.gitattributes +++ /dev/null @@ -1,68 +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 - -.github/workflows/*.lock.yml linguist-generated=true merge=ours diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 39aadd3..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2026-06-18T03:22:31.113Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +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 notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 05f13e0..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,84 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:dtype=complex128', pkg ), function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:dtype=complex64', pkg ), function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 5791321..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,94 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:dtype=complex128,len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68d1aa0..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,94 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:dtype=complex64,len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 2571b17..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 19799d1..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "iIAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 5880b18..41c9dea 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..2364fab --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 4c56630..f1b2b07 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.4.1", - "@stdlib/array-typed-complex-ctors": "^0.2.3", - "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3", - "@stdlib/types": "^0.5.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.3", - "@stdlib/array-complex128": "^0.3.2", - "@stdlib/array-complex64": "^0.3.2", - "@stdlib/array-float64": "^0.2.3", - "@stdlib/assert-instance-of": "^0.3.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.3", - "@stdlib/blas-ext-base-gfill-by": "^0.2.3", - "@stdlib/complex-float64-ctor": "^0.1.2", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/random-base-discrete-uniform": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.3", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.2", - "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.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..20dd79c --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); From dcbe927c144a5b341377bcc0ecb9462f36cf8352 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 22 Jun 2026 03:34:45 +0000 Subject: [PATCH 174/176] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2b853c6..81a5fac 100644 --- a/lib/main.js +++ b/lib/main.js @@ -23,7 +23,7 @@ var isString = require( '@stdlib/assert-is-string' ).isPrimitive; var ctors = require( '@stdlib/array-typed-complex-ctors' ); var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // VARIABLES // @@ -129,7 +129,7 @@ function complexarray() { } ctor = ctors( dtype ); if ( ctor === null ) { - throw new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) ); + throw new TypeError( format( '01r2Y', dtype ) ); } if ( nargs <= 0 ) { return new ctor( 0 ); diff --git a/package.json b/package.json index a3c1151..4c56630 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "@stdlib/array-defaults": "^0.4.1", "@stdlib/array-typed-complex-ctors": "^0.2.3", "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/string-format": "^0.2.3", + "@stdlib/error-tools-fmtprodmsg": "^0.2.3", "@stdlib/types": "^0.5.1", "@stdlib/error-tools-fmtprodmsg": "^0.2.3" }, From 539795f782857d6792d788d437645a3e6c944342 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 22 Jun 2026 03:52:11 +0000 Subject: [PATCH 175/176] Remove files --- index.d.ts | 175 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 5022 deletions(-) delete mode 100644 index.d.ts delete mode 100644 index.mjs delete mode 100644 index.mjs.map delete mode 100644 stats.html diff --git a/index.d.ts b/index.d.ts deleted file mode 100644 index 41c9dea..0000000 --- a/index.d.ts +++ /dev/null @@ -1,175 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/// - -import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; -import ArrayBuffer = require( '@stdlib/array-buffer' ); - -/** -* Creates a complex number typed array. -* -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 'complex64'); -* // returns -*/ -declare function complexarray( dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param length - typed array length -* @param dtype - data type (default: 'complex128') -* @returns typed array -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -*/ -declare function complexarray( length: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param complexarray - complex number typed array from which to generate another complex number typed array -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ) ); -* // returns -* -* @example -* var Complex128Array = require( '@stdlib/array-complex128' ); -* -* var arr = complexarray( new Complex128Array( 2 ), 'complex64' ); -* // returns -*/ -declare function complexarray( complexarray: ComplexTypedArray, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param obj - array-like object or iterable from which to generate a typed array -* @param dtype - data type (default: 'complex128') -* @throws array length must be a multiple of two -* @returns complex number typed array -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5, -3 ], 'complex64' ); -* // returns -*/ -declare function complexarray( obj: ArrayLike | Iterable, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, dtype?: T ): DataTypeMap[T]; - -/** -* Creates a complex number typed array. -* -* @param buffer - underlying ArrayBuffer -* @param byteOffset - integer byte offset specifying the location of the first array element (default: 0) -* @param length - view length; if not provided, the view spans from the byteOffset to the end of the underlying ArrayBuffer -* @param dtype - data type (default: 'complex128') -* @returns complex number typed array -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -declare function complexarray( buffer: ArrayBuffer, byteOffset?: number, length?: number, dtype?: T ): DataTypeMap[T]; - - -// EXPORTS // - -export = complexarray; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 2364fab..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; -//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map deleted file mode 100644 index 8295718..0000000 --- a/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 20dd79c..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a2216af99b7e35fbbc895666118376fd608c007c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 22 Jun 2026 03:52:42 +0000 Subject: [PATCH 176/176] Auto-generated commit --- .editorconfig | 189 - .eslintrc.js | 1 - .gitattributes | 68 - .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 | 821 --- .github/workflows/publish.yml | 261 - .github/workflows/test.yml | 101 - .github/workflows/test_bundles.yml | 213 - .github/workflows/test_coverage.yml | 142 - .github/workflows/test_install.yml | 94 - .github/workflows/test_published_package.yml | 115 - .gitignore | 204 - .npmignore | 229 - .npmrc | 44 - CHANGELOG.md | 284 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 49 +- SECURITY.md | 5 - benchmark/benchmark.js | 84 - benchmark/benchmark.length.complex128.js | 94 - benchmark/benchmark.length.complex64.js | 94 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 137 - docs/types/test.ts | 45 - examples/index.js | 43 - docs/types/index.d.ts => index.d.ts | 2 +- index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 126 - lib/main.js | 149 - package.json | 68 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 603 --- 46 files changed, 4870 insertions(+), 5289 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.js delete mode 100644 benchmark/benchmark.length.complex128.js delete mode 100644 benchmark/benchmark.length.complex64.js delete mode 100644 branches.md 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/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (98%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 80f3fca..0000000 --- a/.editorconfig +++ /dev/null @@ -1,189 +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 - -# Ignore generated lock files for GitHub Agentic Workflows: -[*.lock.yml] -charset = unset -end_of_line = unset -indent_style = unset -indent_size = unset -trim_trailing_whitespace = unset -insert_final_newline = unset - -# 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 24b327f..0000000 --- a/.gitattributes +++ /dev/null @@ -1,68 +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 - -.github/workflows/*.lock.yml linguist-generated=true merge=ours diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index e2c7fdf..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2026-06-22T03:31:07.944Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 55fa529..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/typed-complex) 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 7fe172c..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/typed-complex) 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 fb06ce0..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: '53 17 * * 4' - - # 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 83d50c4..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,821 +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 notification to Zulip if job fails: - - name: 'Send notification to Zulip in case of failure' - # Pin action to full length commit SHA - uses: zulip/github-actions-zulip/send-message@e4c8f27c732ba9bd98ac6be0583096dea82feea5 # v1.0.2 - if: failure() - with: - api-key: ${{ secrets.ZULIP_API_KEY }} - email: 'github-actions-bot@stdlib.zulipchat.com' - organization-url: 'https://stdlib.zulipchat.com' - to: 'workflows-standalone' - type: 'stream' - topic: ${{ github.event.repository.name }} - content: | - :cross_mark: **${{ github.workflow }}** workflow failed - - **Repository:** [${{ github.repository }}](${{ github.server_url }}/${{ github.repository }}) - **Run:** [View workflow run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}) - - # 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 + + ```
@@ -244,7 +235,7 @@ console.log( view ); ## 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. +This package is part of [stdlib][stdlib], a standard library 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]. @@ -311,9 +302,9 @@ Copyright © 2016-2026. The Stdlib [Authors][stdlib-authors]. -[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed +[@stdlib/array/typed]: https://github.com/stdlib-js/array-typed/tree/esm -[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real +[@stdlib/array/typed-real]: https://github.com/stdlib-js/array-typed-real/tree/esm 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.js b/benchmark/benchmark.js deleted file mode 100644 index 05f13e0..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,84 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var complexarray = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0 ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:dtype=complex128', pkg ), function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex128' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:dtype=complex64', pkg ), function benchmark( b ) { - var arr; - var i; - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - arr = complexarray( 0, 'complex64' ); - if ( arr.length !== 0 ) { - b.fail( 'should have length 0' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/benchmark/benchmark.length.complex128.js b/benchmark/benchmark.length.complex128.js deleted file mode 100644 index 5791321..0000000 --- a/benchmark/benchmark.length.complex128.js +++ /dev/null @@ -1,94 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex128' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:dtype=complex128,len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/benchmark/benchmark.length.complex64.js b/benchmark/benchmark.length.complex64.js deleted file mode 100644 index 68d1aa0..0000000 --- a/benchmark/benchmark.length.complex64.js +++ /dev/null @@ -1,94 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var pow = require( '@stdlib/math-base-special-pow' ); -var isComplexTypedArray = require( '@stdlib/assert-is-complex-typed-array' ); -var format = require( '@stdlib/string-format' ); -var pkg = require( './../package.json' ).name; -var complexarray = 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 = complexarray( len, 'complex64' ); - if ( arr.length !== len ) { - b.fail( 'unexpected length' ); - } - } - b.toc(); - if ( !isComplexTypedArray( arr ) ) { - b.fail( 'should return a complex typed array' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var len; - var min; - var max; - var f; - var i; - - min = 1; // 10^min - max = 6; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - f = createBenchmark( len ); - bench( format( '%s:dtype=complex64,len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/branches.md b/branches.md deleted file mode 100644 index 5a37d04..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/typed-complex" -%% click B href "https://github.com/stdlib-js/array-typed-complex/tree/main" -%% click C href "https://github.com/stdlib-js/array-typed-complex/tree/production" -%% click D href "https://github.com/stdlib-js/array-typed-complex/tree/esm" -%% click E href "https://github.com/stdlib-js/array-typed-complex/tree/deno" -%% click F href "https://github.com/stdlib-js/array-typed-complex/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/array/typed-complex -[production-url]: https://github.com/stdlib-js/array-typed-complex/tree/production -[deno-url]: https://github.com/stdlib-js/array-typed-complex/tree/deno -[deno-readme]: https://github.com/stdlib-js/array-typed-complex/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/array-typed-complex/tree/umd -[umd-readme]: https://github.com/stdlib-js/array-typed-complex/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/array-typed-complex/tree/esm -[esm-readme]: https://github.com/stdlib-js/array-typed-complex/blob/esm/README.md \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 5226db0..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import complexarray from '../docs/types/index'; -export = complexarray; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 2571b17..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var i=function(r,e){return function(){try{return e||r((e={exports:{}}).exports,e),e.exports}catch(t){throw e=0,t}}};var n=i(function(f,a){"use strict";var u=require("@stdlib/assert-is-string").isPrimitive,s=require("@stdlib/array-typed-complex-ctors"),g=require("@stdlib/array-defaults"),m=require("@stdlib/string-format"),o=g.get("dtypes.complex_floating_point");function v(){var r,e,t;if(r=arguments.length,r&&u(arguments[r-1])?(r-=1,e=arguments[r]):e=o,t=s(e),t===null)throw new TypeError(m("invalid argument. Must provide a recognized data type. Value: `%s`.",e));return r<=0?new t(0):r===1?new t(arguments[0]):r===2?new t(arguments[0],arguments[1]):new t(arguments[0],arguments[1],arguments[2])}a.exports=v});var l=n();module.exports=l; -/** -* @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. -*/ -//# sourceMappingURL=index.js.map diff --git a/dist/index.js.map b/dist/index.js.map deleted file mode 100644 index 19799d1..0000000 --- a/dist/index.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../lib/main.js", "../lib/index.js"], - "sourcesContent": ["/**\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 isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar ctors = require( '@stdlib/array-typed-complex-ctors' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nmodule.exports = complexarray;\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* Create a complex number typed array.\n*\n* @module @stdlib/array-typed-complex\n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var complexarray = require( '@stdlib/array-typed-complex' );\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "iIAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAQ,QAAS,mCAAoC,EACrDC,EAAW,QAAS,wBAAyB,EAC7CC,EAAS,QAAS,uBAAwB,EAK1CC,EAAgBF,EAAS,IAAK,+BAAgC,EAuFlE,SAASG,GAAe,CACvB,IAAIC,EACAC,EACAC,EAUJ,GARAF,EAAQ,UAAU,OACbA,GAASN,EAAU,UAAWM,EAAM,CAAE,CAAE,GAC5CA,GAAS,EACTC,EAAQ,UAAWD,CAAM,GAEzBC,EAAQH,EAETI,EAAOP,EAAOM,CAAM,EACfC,IAAS,KACb,MAAM,IAAI,UAAWL,EAAQ,sEAAuEI,CAAM,CAAE,EAE7G,OAAKD,GAAS,EACN,IAAIE,EAAM,CAAE,EAEfF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,CAAE,EAE1BF,IAAU,EACP,IAAIE,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAEtC,IAAIA,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,CAC3D,CAKAT,EAAO,QAAUM,IC5BjB,IAAII,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "ctors", "defaults", "format", "DEFAULT_DTYPE", "complexarray", "nargs", "dtype", "ctor", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 06edbe7..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,137 +0,0 @@ - -{{alias}}( [dtype] ) - Creates a complex typed array. - - The function supports the following data types: - - - complex128: double-precision complex floating-point numbers. - - complex64: single-precision complex floating-point numbers. - - The default typed array data type is `complex128`. - - Parameters - ---------- - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}() - - > arr = {{alias}}( 'complex64' ) - - - -{{alias}}( length[, dtype] ) - Returns a complex number typed array having a specified length. - - Parameters - ---------- - length: integer - Array length. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr = {{alias}}( 5 ) - - > arr = {{alias}}( 5, 'complex64' ) - - - -{{alias}}( complexarray[, dtype] ) - Creates a complex number typed array from another complex number typed - array. - - Parameters - ---------- - complexarray: ComplexArray - Complex number typed array from which to generate another complex number - typed array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = {{alias}}( [ 0.5, 0.5, 0.5, 0.5 ] ); - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( obj[, dtype] ) - Creates a complex number typed array from an array-like object or iterable. - - If an array-like object contains interleaved real and imaginary components, - the array-like object must have a length which is a multiple of two. - - Parameters - ---------- - obj: Object - Array-like object or iterable from which to generate an array. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var arr1 = [ 0.5, 0.5, 0.5, 0.5 ]; - > var arr2 = {{alias}}( arr1, 'complex64' ) - - - -{{alias}}( buffer[, byteOffset[, length]][, dtype] ) - Returns a complex number typed array view of an ArrayBuffer. - - Parameters - ---------- - buffer: ArrayBuffer - Underlying ArrayBuffer. - - byteOffset: integer (optional) - Integer byte offset specifying the location of the first 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. - - dtype: string (optional) - Data type. Default: 'complex128'. - - Returns - ------- - out: ComplexArray - A complex number typed array. - - Examples - -------- - > var buf = new {{alias:@stdlib/array/buffer}}( 64 ); - > var arr = {{alias}}( buf, 0, 8, 'complex64' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 33077f3..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import complexarray = require( './index' ); - - -// TESTS // - -// The function returns a typed array.. -{ - complexarray(); // $ExpectType Complex128Array - complexarray( 'complex64' ); // $ExpectType Complex64Array - complexarray( 10, 'complex64' ); // $ExpectType Complex64Array - complexarray( [ 1, 2, 3 ], 'complex128' ); // $ExpectType Complex128Array -} - -// The compiler throws an error if the function is provided a first argument which is not a data type, number, array-like object, or typed array... -{ - complexarray( true ); // $ExpectError - complexarray( false ); // $ExpectError - complexarray( {} ); // $ExpectError - complexarray( null ); // $ExpectError - complexarray( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - const buf = new ArrayBuffer( 64 ); - complexarray( buf, 16, 2, 'complex128', {} ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index 83940aa..0000000 --- a/examples/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random-base-discrete-uniform' ); -var gfillBy = require( '@stdlib/blas-ext-base-gfill-by' ); -var Complex128 = require( '@stdlib/complex-float64-ctor' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var complexarray = require( './../lib' ); - -function rand() { - var re = discreteUniform( -10, 10 ); - var im = discreteUniform( -10, 10 ); - return new Complex128( re, im ); -} - -// Create a new complex number typed array: -var arr = complexarray( 100, 'complex128' ); - -// Fill the array with random complex numbers: -gfillBy( arr.length, arr, 1, rand ); - -// Reinterpret the complex number array as a `Float64Array`: -var view = reinterpret128( arr, 0 ); - -// View the results: -console.log( view ); diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 98% rename from docs/types/index.d.ts rename to index.d.ts index 5880b18..41c9dea 100644 --- a/docs/types/index.d.ts +++ b/index.d.ts @@ -20,7 +20,7 @@ /* eslint-disable @typescript-eslint/unified-signatures */ -/// +/// import { ArrayLike, ComplexTypedArray, ComplexFloatingPointDataTypeMap as DataTypeMap } from '@stdlib/types/array'; import ArrayBuffer = require( '@stdlib/array-buffer' ); diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..2364fab --- /dev/null +++ b/index.mjs @@ -0,0 +1,4 @@ +// Copyright (c) 2026 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 +/// +import{isPrimitive as t}from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-string@v0.2.3-esm/index.mjs";import e from"https://cdn.jsdelivr.net/gh/stdlib-js/array-typed-complex-ctors@v0.2.3-esm/index.mjs";import s from"https://cdn.jsdelivr.net/gh/stdlib-js/array-defaults@v0.4.1-esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.3-esm/index.mjs";var n=s.get("dtypes.complex_floating_point");function i(){var s,i,d;if(i=(s=arguments.length)&&t(arguments[s-1])?arguments[s-=1]:n,null===(d=e(i)))throw new TypeError(r("01r2Y",i));return s<=0?new d(0):1===s?new d(arguments[0]):2===s?new d(arguments[0],arguments[1]):new d(arguments[0],arguments[1],arguments[2])}export{i as default}; +//# sourceMappingURL=index.mjs.map diff --git a/index.mjs.map b/index.mjs.map new file mode 100644 index 0000000..8295718 --- /dev/null +++ b/index.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"index.mjs","sources":["../lib/main.js"],"sourcesContent":["/**\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\nimport { isPrimitive as isString } from '@stdlib/assert-is-string';\nimport ctors from '@stdlib/array-typed-complex-ctors';\nimport defaults from '@stdlib/array-defaults';\nimport format from '@stdlib/error-tools-fmtprodmsg';\n\n\n// VARIABLES //\n\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' );\n\n\n// MAIN //\n\n/**\n* Creates a complex number typed array.\n*\n* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"complex128\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @returns {ComplexArray} typed array\n*\n* @example\n* var arr = complexarray();\n* // returns \n*\n* @example\n* var arr = complexarray( 2 );\n* // returns \n*\n* @example\n* var arr = complexarray( 2, 'complex64' );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 0.5, 0.5 ] );\n* // returns \n*\n* @example\n* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' );\n* var arr2 = complexarray( arr1 );\n* // returns \n*\n* @example\n* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' );\n* var arr2 = complexarray( arr1, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = complexarray( buf, 16, 'complex64' );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2 );\n* // returns \n*\n* @example\n* import ArrayBuffer from '@stdlib/array-buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = complexarray( buf, 16, 2, 'complex64' );\n* // returns \n*/\nfunction complexarray() {\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\n\tnargs = arguments.length;\n\tif ( nargs && isString( arguments[ nargs-1 ] ) ) {\n\t\tnargs -= 1;\n\t\tdtype = arguments[ nargs ];\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( '01r2Y', dtype ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) {\n\t\treturn new ctor( arguments[0] );\n\t}\n\tif ( nargs === 2 ) {\n\t\treturn new ctor( arguments[0], arguments[1] );\n\t}\n\treturn new ctor( arguments[0], arguments[1], arguments[2] );\n}\n\n\n// EXPORTS //\n\nexport default complexarray;\n"],"names":["DEFAULT_DTYPE","defaults","get","complexarray","nargs","dtype","ctor","arguments","length","isString","ctors","TypeError","format"],"mappings":";;wYA8BA,IAAIA,EAAgBC,EAASC,IAAK,iCAuFlC,SAASC,IACR,IAAIC,EACAC,EACAC,EAUJ,GALCD,GAHDD,EAAQG,UAAUC,SACJC,EAAUF,UAAWH,EAAM,IAEhCG,UADRH,GAAS,GAGDJ,EAGK,QADdM,EAAOI,EAAOL,IAEb,MAAM,IAAIM,UAAWC,EAAQ,QAASP,IAEvC,OAAKD,GAAS,EACN,IAAIE,EAAM,GAEH,IAAVF,EACG,IAAIE,EAAMC,UAAU,IAEb,IAAVH,EACG,IAAIE,EAAMC,UAAU,GAAIA,UAAU,IAEnC,IAAID,EAAMC,UAAU,GAAIA,UAAU,GAAIA,UAAU,GACxD"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index b754058..0000000 --- a/lib/index.js +++ /dev/null @@ -1,126 +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. -*/ - -'use strict'; - -/** -* Create a complex number typed array. -* -* @module @stdlib/array-typed-complex -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray(); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* var complexarray = require( '@stdlib/array-typed-complex' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 81a5fac..0000000 --- a/lib/main.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert-is-string' ).isPrimitive; -var ctors = require( '@stdlib/array-typed-complex-ctors' ); -var defaults = require( '@stdlib/array-defaults' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// VARIABLES // - -var DEFAULT_DTYPE = defaults.get( 'dtypes.complex_floating_point' ); - - -// MAIN // - -/** -* Creates a complex number typed array. -* -* @param {(NonNegativeInteger|ComplexArray|ArrayLikeObject|ArrayBuffer)} [arg] - a length, typed array, array-like object, or buffer -* @param {NonNegativeInteger} [byteOffset=0] - byte offset -* @param {NonNegativeInteger} [length] - view length -* @param {string} [dtype="complex128"] - data type -* @throws {TypeError} must provide a recognized data type -* @returns {ComplexArray} typed array -* -* @example -* var arr = complexarray(); -* // returns -* -* @example -* var arr = complexarray( 2 ); -* // returns -* -* @example -* var arr = complexarray( 2, 'complex64' ); -* // returns -* -* @example -* var arr = complexarray( [ 0.5, 0.5 ] ); -* // returns -* -* @example -* var arr = complexarray( [ 5.0, -3.0 ], 'complex64' ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex64' ); -* var arr2 = complexarray( arr1 ); -* // returns -* -* @example -* var arr1 = complexarray( [ 5.0, 3.0 ], 'complex128' ); -* var arr2 = complexarray( arr1, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 32 ); -* var arr = complexarray( buf, 16, 'complex64' ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2 ); -* // returns -* -* @example -* var ArrayBuffer = require( '@stdlib/array-buffer' ); -* -* var buf = new ArrayBuffer( 64 ); -* var arr = complexarray( buf, 16, 2, 'complex64' ); -* // returns -*/ -function complexarray() { - var nargs; - var dtype; - var ctor; - - nargs = arguments.length; - if ( nargs && isString( arguments[ nargs-1 ] ) ) { - nargs -= 1; - dtype = arguments[ nargs ]; - } else { - dtype = DEFAULT_DTYPE; - } - ctor = ctors( dtype ); - if ( ctor === null ) { - throw new TypeError( format( '01r2Y', dtype ) ); - } - if ( nargs <= 0 ) { - return new ctor( 0 ); - } - if ( nargs === 1 ) { - return new ctor( arguments[0] ); - } - if ( nargs === 2 ) { - return new ctor( arguments[0], arguments[1] ); - } - return new ctor( arguments[0], arguments[1], arguments[2] ); -} - - -// EXPORTS // - -module.exports = complexarray; diff --git a/package.json b/package.json index 4c56630..f1b2b07 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.3", "description": "Create a complex number typed array.", "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" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,47 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array-defaults": "^0.4.1", - "@stdlib/array-typed-complex-ctors": "^0.2.3", - "@stdlib/assert-is-string": "^0.2.3", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3", - "@stdlib/types": "^0.5.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.3" - }, - "devDependencies": { - "@stdlib/array-buffer": "^0.2.3", - "@stdlib/array-complex128": "^0.3.2", - "@stdlib/array-complex64": "^0.3.2", - "@stdlib/array-float64": "^0.2.3", - "@stdlib/assert-instance-of": "^0.3.1", - "@stdlib/assert-is-complex-typed-array": "^0.2.3", - "@stdlib/blas-ext-base-gfill-by": "^0.2.3", - "@stdlib/complex-float64-ctor": "^0.1.2", - "@stdlib/math-base-special-pow": "^0.3.1", - "@stdlib/random-base-discrete-uniform": "^0.2.2", - "@stdlib/strided-base-reinterpret-complex128": "^0.2.3", - "@stdlib/strided-base-reinterpret-complex64": "^0.2.2", - "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.3" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..20dd79c --- /dev/null +++ b/stats.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.js b/test/test.js deleted file mode 100644 index f0f3fad..0000000 --- a/test/test.js +++ /dev/null @@ -1,603 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var Complex128Array = require( '@stdlib/array-complex128' ); -var Complex64Array = require( '@stdlib/array-complex64' ); -var Float64Array = require( '@stdlib/array-float64' ); -var ArrayBuffer = require( '@stdlib/array-buffer' ); -var instanceOf = require( '@stdlib/assert-instance-of' ); -var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' ); -var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' ); -var complexarray = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof complexarray, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided an unrecognized data type (only argument)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( 10, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Float64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (complex typed array)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new Complex64Array( 10 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (array-like object)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( [ 1, 2, 3 ], value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, value ); - }; - } -}); - -tape( 'the function throws an error if provided an unrecognized data type (ArrayBuffer, byteOffset, length)', function test( t ) { - var values; - var i; - - values = [ - '5', - 'beep', - 'complexarray', - 'Int32', - 'Uint32', - 'Int16', - 'Uint16', - 'Int8', - 'Uint8', - 'Uint8c', - 'uint8_clamped', - 'Float64', - 'Float32', - 'FLOAT64', - 'FLOAT32' - ]; - - 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() { - complexarray( new ArrayBuffer( 32 ), 0, 1, value ); - }; - } -}); - -tape( 'the function returns a complex number typed array (default)', function test( t ) { - var arr = complexarray(); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128)', function test( t ) { - var arr = complexarray( 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64)', function test( t ) { - var arr = complexarray( 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, length)', function test( t ) { - var arr = complexarray( 10 ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, length)', function test( t ) { - var arr = complexarray( 10, 'complex128' ); - t.strictEqual( instanceOf( arr, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, length)', function test( t ) { - var arr = complexarray( 10, 'complex64' ); - t.strictEqual( instanceOf( arr, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( arr.length, 10, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, array)', function test( t ) { - var view; - var arr; - var out; - - arr = [ 1.0, 2.0, 3.0, 4.0 ]; - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret128( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, typed array)', function test( t ) { - var view; - var arr; - var out; - - arr = new Float64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - view = reinterpret64( out, 0 ); - t.strictEqual( view[ 0 ], arr[ 0 ], 'returns expected value' ); - t.strictEqual( view[ 1 ], arr[ 1 ], 'returns expected value' ); - t.strictEqual( view[ 2 ], arr[ 2 ], 'returns expected value' ); - t.strictEqual( view[ 3 ], arr[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret128( arr, 0 ); - viewY = reinterpret128( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, complex typed array)', function test( t ) { - var viewX; - var viewY; - var arr; - var out; - - arr = new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ); - out = complexarray( arr, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - - viewX = reinterpret64( arr, 0 ); - viewY = reinterpret64( out, 0 ); - t.strictEqual( viewY[ 0 ], viewX[ 0 ], 'returns expected value' ); - t.strictEqual( viewY[ 1 ], viewX[ 1 ], 'returns expected value' ); - t.strictEqual( viewY[ 2 ], viewX[ 2 ], 'returns expected value' ); - t.strictEqual( viewY[ 3 ], viewX[ 3 ], 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer)', function test( t ) { - var buf = new ArrayBuffer( 16 ); - var out = complexarray( buf, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (default, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2 ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 64 ); - var out = complexarray( buf, 16, 2, 'complex128' ); - t.strictEqual( instanceOf( out, Complex128Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a complex number typed array (dtype=complex64, arraybuffer, byteoffset, length)', function test( t ) { - var buf = new ArrayBuffer( 32 ); - var out = complexarray( buf, 8, 2, 'complex64' ); - t.strictEqual( instanceOf( out, Complex64Array ), true, 'returns expected value' ); - t.strictEqual( out.length, 2, 'returns expected value' ); - t.end(); -});