From da1ad18a8ed0b308b55f5ebb0c53e2e152f4ddc5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Apr 2022 03:19:33 +0000 Subject: [PATCH 001/123] Auto-generated commit c25eda4163e07c34b499cf640643666a624bd80f --- CONTRIBUTORS | 28 + LICENSE | 481 +++++++++ NOTICE | 1 + README.md | 231 +++++ index.d.ts | 41 + index.mjs | 4 + index.mjs.map | 1 + package.json | 34 + stats.html | 2689 +++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 3510 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..f1deee5 --- /dev/null +++ b/README.md @@ -0,0 +1,231 @@ + + +# Same Kind Casts + +[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] + +> Return a list of ndarray [data types][@stdlib/ndarray/dtypes] to which a provided ndarray [data type][@stdlib/ndarray/dtypes] can be safely cast or cast within the same "kind". + + + +
+ +
+ + + + + + + +
+ +## Usage + +```javascript +import sameKindCasts from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-same-kind-casts@esm/index.mjs'; +``` + +#### sameKindCasts( \[dtype] ) + +If provided a `dtype` argument, returns a list of ndarray [data types][@stdlib/ndarray/dtypes] to which a provided ndarray [data type][@stdlib/ndarray/dtypes] can be safely cast or cast within the same "kind" (e.g., between signed integers or between floating-point numbers). + +```javascript +var out = sameKindCasts( 'float64' ); +// e.g., returns [ 'float64', 'float32', ... ] +``` + +If not provided a `dtype` argument, the function returns a casting table. + +```javascript +var out = sameKindCasts(); +// returns {...} + +var f64 = out[ 'float64' ]; +// returns {...} + +var v = f64[ 'float32' ]; +// returns 1 +``` + +If provided an unrecognized or unsupported `dtype`, the function returns `null`. + +```javascript +var out = sameKindCasts( 'foo' ); +// returns null +``` + +
+ + + + + +
+ +
+ + + + + +
+ +## 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..1cb4677 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,41 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2021 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT 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 + +/** +* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". +* +* ## Notes +* +* - If not provided an ndarray data type, the function returns a casting table. +* - If provided an unrecognized ndarray data type, the function returns `null`. +* +* @param dtype - ndarray data type value +* @returns list of ndarray data types or null +* +* @example +* var list = sameKindCasts( 'float32' ); +* // returns [...] +*/ +declare function sameKindCasts( dtype?: any ): any; + + +// EXPORTS // + +export = sameKindCasts; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..824d698 --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o=t,l=n,u=i,c={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function r(){var t,n,i,e,l,u,r,a,m;for(i={},n=(t=o(c)).length,m=0;m + + + + + + RollUp Visualizer + + + +
+ + + + + From 0a2e6caccc676131e7abf779167887bde7d01f70 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 00:38:33 +0000 Subject: [PATCH 002/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b1d1558..f672df6 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.x", "@stdlib/ndarray-dtypes": "^0.0.x", "@stdlib/utils-keys": "^0.0.x", - "@stdlib/utils-library-manifest": "^0.0.x" + "@stdlib/utils-library-manifest": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.x", @@ -85,4 +86,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 838addd29ad9a68795ed04e7d81993c9bc39ca94 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 15:38:32 +0000 Subject: [PATCH 003/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2735 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 824d698..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o=t,l=n,u=i,c={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function r(){var t,n,i,e,l,u,r,a,m;for(i={},n=(t=o(c)).length,m=0;m - - - - - - RollUp Visualizer - - - -
- - - - - From 1789b6b662599c472ced430eeb089b5f693c561d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 15:39:17 +0000 Subject: [PATCH 004/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 ---- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 -- lib/same_kind_casts.json | 197 -- manifest.json | 38 - package.json | 61 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 2714 insertions(+), 4083 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 d8110fc..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-06-30T22:10:16.209Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 14e56f2..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/ndarray/same-kind-casts" -click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3975e81..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The function does not compile if provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..10a538b --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ec627c3 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From ddbd031d9d4e98b1d729b0977ea822f659f0caf4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 17:57:30 +0000 Subject: [PATCH 005/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b1d1558..f672df6 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.x", "@stdlib/ndarray-dtypes": "^0.0.x", "@stdlib/utils-keys": "^0.0.x", - "@stdlib/utils-library-manifest": "^0.0.x" + "@stdlib/utils-library-manifest": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.x", @@ -85,4 +86,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From b48b148e02bd73d9307cb946cd42d0c95f29f766 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Jul 2022 08:16:03 +0000 Subject: [PATCH 006/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2735 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 10a538b..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - RollUp Visualizer - - - -
- - - - - From 4a34e1e1a6bd6f784ffc8e36a26b747557e60971 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Jul 2022 08:16:40 +0000 Subject: [PATCH 007/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 ---- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 -- lib/same_kind_casts.json | 197 -- manifest.json | 38 - package.json | 61 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 2714 insertions(+), 4083 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 665ac9d..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-07-01T01:13:28.877Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 14e56f2..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/ndarray/same-kind-casts" -click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3975e81..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The function does not compile if provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..10a538b --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..dd1f358 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 1c0b16c578a47a1fce0afd4571269bb918020835 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 Jul 2022 18:38:44 +0000 Subject: [PATCH 008/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b1d1558..f672df6 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.x", "@stdlib/ndarray-dtypes": "^0.0.x", "@stdlib/utils-keys": "^0.0.x", - "@stdlib/utils-library-manifest": "^0.0.x" + "@stdlib/utils-library-manifest": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.x", @@ -85,4 +86,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 2de263341e2ef054c3456dc1a9ac916873099afd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 Jul 2022 19:09:09 +0000 Subject: [PATCH 009/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2735 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 10a538b..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - RollUp Visualizer - - - -
- - - - - From f039325577040cb2994c59846058380b8d99a77b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 6 Jul 2022 19:09:54 +0000 Subject: [PATCH 010/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 ---- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 -- lib/same_kind_casts.json | 197 -- manifest.json | 38 - package.json | 61 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 76 - 39 files changed, 2714 insertions(+), 4048 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 14e56f2..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/ndarray/same-kind-casts" -click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3975e81..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The function does not compile if provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..10a538b --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..b745c27 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 4326fee47e87756531b0a4ec51cb3f7dd6aeab56 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 03:53:48 +0000 Subject: [PATCH 011/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b1d1558..f672df6 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.x", "@stdlib/ndarray-dtypes": "^0.0.x", "@stdlib/utils-keys": "^0.0.x", - "@stdlib/utils-library-manifest": "^0.0.x" + "@stdlib/utils-library-manifest": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.x", @@ -85,4 +86,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From d37a9dd0c06c546817d47cd680e6feb8341a9782 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 17:57:03 +0000 Subject: [PATCH 012/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2735 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 10a538b..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - RollUp Visualizer - - - -
- - - - - From d904240c6ae65d0d8521d07a9aced502c0d41be1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 17:57:42 +0000 Subject: [PATCH 013/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 ---- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 -- lib/same_kind_casts.json | 197 -- manifest.json | 38 - package.json | 61 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 2714 insertions(+), 4122 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 8df8bce..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-08-01T01:16:37.392Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 14e56f2..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/ndarray/same-kind-casts" -click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3975e81..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The function does not compile if provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..10a538b --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..0c383c1 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From ca0a92fc910d098cef105ccc55bef7b76ac32674 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 03:41:29 +0000 Subject: [PATCH 014/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b1d1558..f672df6 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.x", "@stdlib/ndarray-dtypes": "^0.0.x", "@stdlib/utils-keys": "^0.0.x", - "@stdlib/utils-library-manifest": "^0.0.x" + "@stdlib/utils-library-manifest": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.x", @@ -85,4 +86,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 8e9586c3172623627357900bb691bc0f15026227 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 13:55:36 +0000 Subject: [PATCH 015/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2735 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 10a538b..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - RollUp Visualizer - - - -
- - - - - From a5738fde7d036b47cc134fd3a009c367e72b4807 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 13:56:22 +0000 Subject: [PATCH 016/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 ---- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 -- lib/same_kind_casts.json | 197 -- manifest.json | 38 - package.json | 61 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 2714 insertions(+), 4138 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 727b765..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-09-01T01:14:36.583Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 14e56f2..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/ndarray/same-kind-casts" -click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 3975e81..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The function does not compile if provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..10a538b --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..5018dc0 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From e29dc6c0d8fb04751063e438cf542401d22d8d9b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 03:59:38 +0000 Subject: [PATCH 017/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b1d1558..f672df6 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.x", "@stdlib/ndarray-dtypes": "^0.0.x", "@stdlib/utils-keys": "^0.0.x", - "@stdlib/utils-library-manifest": "^0.0.x" + "@stdlib/utils-library-manifest": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.x", @@ -85,4 +86,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 2978d35238eb985b1fa631d6eeb35878a84b1c7c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 20:44:11 +0000 Subject: [PATCH 018/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2735 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 10a538b..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - RollUp Visualizer - - - -
- - - - - From 04d422003582aa6bac5c942a908da41b10787c2e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 20:44:55 +0000 Subject: [PATCH 019/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 ---- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 -- lib/same_kind_casts.json | 197 -- manifest.json | 38 - package.json | 61 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 2714 insertions(+), 4138 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 e8e257e..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-10-01T01:40:43.935Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 14e56f2..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/ndarray/same-kind-casts" -click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..10a538b --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..d262040 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 45cc14e78dbc77ed841400b8223611e46425400d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 03:47:28 +0000 Subject: [PATCH 020/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b1d1558..f672df6 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.x", "@stdlib/ndarray-dtypes": "^0.0.x", "@stdlib/utils-keys": "^0.0.x", - "@stdlib/utils-library-manifest": "^0.0.x" + "@stdlib/utils-library-manifest": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.x", @@ -85,4 +86,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 81471e5ef133d4cba1f80cbafe53dbb563c78a67 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 17:43:37 +0000 Subject: [PATCH 021/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2735 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 10a538b..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - RollUp Visualizer - - - -
- - - - - From ce98be72081edd132826611cc58edc79923890c1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 17:44:30 +0000 Subject: [PATCH 022/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 --- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 4069 insertions(+), 4138 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 f1b895c..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-11-01T01:27:46.839Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 6f78464..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: '8 8 * * 1' - - # 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 + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 14e56f2..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/ndarray/same-kind-casts" -click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..10a538b --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..a5f4b2f --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 9fee773dcb548ddde47cd87d8c16bc098eb73d2a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 4 Nov 2022 00:14:10 +0000 Subject: [PATCH 023/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index b1d1558..f672df6 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.x", "@stdlib/ndarray-dtypes": "^0.0.x", "@stdlib/utils-keys": "^0.0.x", - "@stdlib/utils-library-manifest": "^0.0.x" + "@stdlib/utils-library-manifest": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.x", @@ -85,4 +86,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From d45cf41f0f5847ec12b6ecc35aaf57b17176f474 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 4 Nov 2022 13:36:34 +0000 Subject: [PATCH 024/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4044 ------------------------------------------------- 4 files changed, 4090 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 10a538b..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - RollUp Visualizer - - - -
- - - - - From 3fe659c17921575651b2c2fb16b4c39a6b0f3da2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 4 Nov 2022 13:37:24 +0000 Subject: [PATCH 025/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 --- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 4069 insertions(+), 4159 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 0308724..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-11-03T22:06:46.504Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 6f78464..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: '8 8 * * 1' - - # 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 + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 14e56f2..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/ndarray/same-kind-casts" -click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..10a538b --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..15213c6 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From f4a2dda5f2ccae0250b8033d7cb172dc85c4b9b1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 04:05:28 +0000 Subject: [PATCH 026/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ad7e011..f5c5ecc 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.x", "@stdlib/ndarray-dtypes": "^0.0.x", "@stdlib/utils-keys": "^0.0.x", - "@stdlib/utils-library-manifest": "^0.0.x" + "@stdlib/utils-library-manifest": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.x", @@ -85,4 +86,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 0bbbb6812a683841fd8e4758de913caca0387482 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 17:42:10 +0000 Subject: [PATCH 027/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4044 ------------------------------------------------- 4 files changed, 4090 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 10a538b..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - RollUp Visualizer - - - -
- - - - - From 5d9def164cec0b6d62dd0bd52673b7b87b521c1d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 17:42:52 +0000 Subject: [PATCH 028/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 --- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 4069 insertions(+), 4164 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 0e7ff49..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-12-01T01:56:19.530Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 6f78464..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: '8 8 * * 1' - - # 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 + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 14e56f2..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/ndarray/same-kind-casts" -click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..10a538b --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4ac86c5 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 0b2ed437e1b2f567b932fdfb097c467c169bd984 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Jan 2023 02:58:45 +0000 Subject: [PATCH 029/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 63a2d4c..57ed2a8 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.x", "@stdlib/ndarray-dtypes": "^0.0.x", "@stdlib/utils-keys": "^0.0.x", - "@stdlib/utils-library-manifest": "^0.0.x" + "@stdlib/utils-library-manifest": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.x", @@ -85,4 +86,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 424811ea6c8bfdb16b8902f2812655985fde1d26 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Jan 2023 07:32:07 +0000 Subject: [PATCH 030/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4044 ------------------------------------------------- 4 files changed, 4090 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 10a538b..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - RollUp Visualizer - - - -
- - - - - From ffe85ec79c1cef459d78d7a9af1b6cc946ab1b44 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Jan 2023 07:32:47 +0000 Subject: [PATCH 031/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 --- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 4069 insertions(+), 4175 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 882bc28..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-01-01T01:18:20.734Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 6f78464..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: '8 8 * * 1' - - # 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 + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 14e56f2..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/ndarray/same-kind-casts" -click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..67bfd3c --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ec1e002 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 18cc0a900426f07af0f6523f6371c5935b0d16d4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 04:15:58 +0000 Subject: [PATCH 032/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 63a2d4c..57ed2a8 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.x", "@stdlib/ndarray-dtypes": "^0.0.x", "@stdlib/utils-keys": "^0.0.x", - "@stdlib/utils-library-manifest": "^0.0.x" + "@stdlib/utils-library-manifest": "^0.0.x", + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.x", @@ -85,4 +86,4 @@ "type": "patreon", "url": "https://www.patreon.com/athan" } -} +} \ No newline at end of file From 54310f8c40ce6fba65f9b0c77409e7544ecd6d7d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 13:07:12 +0000 Subject: [PATCH 033/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4044 ------------------------------------------------- 4 files changed, 4090 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 67bfd3c..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - RollUp Visualizer - - - -
- - - - - From 8775c44751a8e084a0ffe7aa9d7242636c27fc14 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 13:07:50 +0000 Subject: [PATCH 034/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 6202 insertions(+), 4175 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 5a89d83..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-02-01T01:43:50.334Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 6f78464..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: '8 8 * * 1' - - # 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 + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 14e56f2..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/ndarray/same-kind-casts" -click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..67bfd3c --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "patreon", "url": "https://www.patreon.com/athan" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..81b6f04 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 2353a81166434087b2b19f0ce25f6c24650216ca Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Mar 2023 06:48:37 +0000 Subject: [PATCH 035/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d28f61b..341cba7 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.1", "@stdlib/ndarray-dtypes": "^0.0.9", "@stdlib/utils-keys": "^0.0.7", - "@stdlib/utils-library-manifest": "^0.0.8" + "@stdlib/utils-library-manifest": "^0.0.8", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.9", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f61e68256b1fec4a26e2e8e7d37a1d71d9078756 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Mar 2023 15:59:33 +0000 Subject: [PATCH 036/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6223 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 67bfd3c..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From b0645fdd64fed3bc751abdc2c18a7cbef0beb14c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Mar 2023 16:00:12 +0000 Subject: [PATCH 037/123] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 236 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 6202 insertions(+), 4310 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 ffd460b..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-03-01T04:23:30.664Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 6f78464..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: '8 8 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index cbe448b..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..67bfd3c --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..432890b --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 1afd41bb76a779664a8c94403e08ef3f441bfee2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Apr 2023 07:22:50 +0000 Subject: [PATCH 038/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d28f61b..341cba7 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.1", "@stdlib/ndarray-dtypes": "^0.0.9", "@stdlib/utils-keys": "^0.0.7", - "@stdlib/utils-library-manifest": "^0.0.8" + "@stdlib/utils-library-manifest": "^0.0.8", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.9", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 274acc0b653a30219fba5a75092533d6d94bf0a4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Apr 2023 15:02:40 +0000 Subject: [PATCH 039/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6223 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 67bfd3c..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From d8573708c88fe8346e9374a78c6cf173de418948 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Apr 2023 15:03:21 +0000 Subject: [PATCH 040/123] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 6202 insertions(+), 4316 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 539aa47..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-04-01T05:03:04.735Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 6f78464..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: '8 8 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index cbe448b..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..67bfd3c --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..bca1f29 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From df03b630881f5a1fe95e64ffa02d210d1c98d8ba Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 May 2023 07:06:10 +0000 Subject: [PATCH 041/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d28f61b..341cba7 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.1", "@stdlib/ndarray-dtypes": "^0.0.9", "@stdlib/utils-keys": "^0.0.7", - "@stdlib/utils-library-manifest": "^0.0.8" + "@stdlib/utils-library-manifest": "^0.0.8", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.9", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 7848ea11c03c80bae038a78a7c232b798b5ebd75 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 May 2023 14:42:10 +0000 Subject: [PATCH 042/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6223 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 67bfd3c..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 2d85eb8f19bb753106e315b372658857c6b9a0a4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 May 2023 14:42:47 +0000 Subject: [PATCH 043/123] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 6202 insertions(+), 4316 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 d1a2de5..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-05-01T04:45:57.595Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 6f78464..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: '8 8 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index cbe448b..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..67bfd3c --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..a7d6ef2 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From fbe1ece559bc684becafaceb546c80957340c094 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Jun 2023 06:51:15 +0000 Subject: [PATCH 044/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d28f61b..341cba7 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.1", "@stdlib/ndarray-dtypes": "^0.0.9", "@stdlib/utils-keys": "^0.0.7", - "@stdlib/utils-library-manifest": "^0.0.8" + "@stdlib/utils-library-manifest": "^0.0.8", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.9", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f3d780162aebcefe28f00acef8791a49ed3a3911 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Jun 2023 15:01:03 +0000 Subject: [PATCH 045/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6223 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 67bfd3c..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 2f18747a23bfa0445ef1d18ac2a3d16d25661a70 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Jun 2023 15:01:52 +0000 Subject: [PATCH 046/123] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 6202 insertions(+), 4316 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 77ae2f1..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-06-01T04:23:10.369Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 6f78464..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: '8 8 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index cbe448b..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..67bfd3c --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..c3f9049 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 7bfde90b8a4f43c561ecd4aeaaba35187c221411 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jul 2023 06:46:28 +0000 Subject: [PATCH 047/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d28f61b..341cba7 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.1", "@stdlib/ndarray-dtypes": "^0.0.9", "@stdlib/utils-keys": "^0.0.7", - "@stdlib/utils-library-manifest": "^0.0.8" + "@stdlib/utils-library-manifest": "^0.0.8", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.9", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From a877e9297793dc89b079bbde9cd48a49b5091d86 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jul 2023 15:21:13 +0000 Subject: [PATCH 048/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6223 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 67bfd3c..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From e531330662e183bd9f5679709f22e709831dc52d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jul 2023 15:22:12 +0000 Subject: [PATCH 049/123] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 6202 insertions(+), 4316 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 2cc2c1e..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-07-01T04:21:49.917Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 6f78464..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: '8 8 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 3e8e2db..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v1 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index cbe448b..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..67bfd3c --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..a3a7021 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 07ac64cb08ca6c2b74903689e44a26cfa5de7df3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Aug 2023 07:25:51 +0000 Subject: [PATCH 050/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index d28f61b..341cba7 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.0.1", "@stdlib/ndarray-dtypes": "^0.0.9", "@stdlib/utils-keys": "^0.0.7", - "@stdlib/utils-library-manifest": "^0.0.8" + "@stdlib/utils-library-manifest": "^0.0.8", + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.0.9", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From d8e5c958f0bbb101f50cdb0e337e4f3d83913028 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Aug 2023 15:56:14 +0000 Subject: [PATCH 051/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6223 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 67bfd3c..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 7df3dbecadfc7c77dc3a5540a48604f5b0f6f8de Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Aug 2023 15:56:51 +0000 Subject: [PATCH 052/123] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 49 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 798 --- .github/workflows/publish.yml | 242 - .github/workflows/test.yml | 97 - .github/workflows/test_bundles.yml | 180 - .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 188 - .npmignore | 227 - .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 76 - 40 files changed, 6202 insertions(+), 4316 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 branches.md delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 9db0473..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-08-01T04:50:55.856Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 6f78464..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: '8 8 * * 1' - - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job for retrieving npm download counts... - npm_downloads: - - # Define display name: - name: 'Retrieve npm download counts' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - timeout-minutes: 10 - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Resolve package name: - - name: 'Resolve package name' - id: package_name - run: | - name=`node -e 'console.log(require("./package.json").name)' | tr -d '\n'` - echo "package_name=$name" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Fetch download data: - - name: 'Fetch data' - id: download_data - run: | - url="https://api.npmjs.org/downloads/range/$(date --date='1 year ago' '+%Y-%m-%d'):$(date '+%Y-%m-%d')/${{ steps.package_name.outputs.package_name }}" - echo "$url" - data=$(curl "$url") - mkdir ./tmp - echo "$data" > ./tmp/npm_downloads.json - echo "data=$data" >> $GITHUB_OUTPUT - timeout-minutes: 5 - - # Print summary of download data: - - name: 'Print summary' - run: | - echo "| Date | Downloads |" >> $GITHUB_STEP_SUMMARY - echo "|------|------------|" >> $GITHUB_STEP_SUMMARY - cat ./tmp/npm_downloads.json | jq -r ".downloads | .[-14:] | to_entries | map(\"| \(.value.day) | \(.value.downloads) |\") |.[]" >> $GITHUB_STEP_SUMMARY - - # Upload the download data: - - name: 'Upload data' - uses: actions/upload-artifact@v3 - with: - # Define a name for the uploaded artifact (ensuring a unique name for each job): - name: npm_downloads - - # Specify the path to the file to upload: - path: ./tmp/npm_downloads.json - - # Specify the number of days to retain the artifact (default is 90 days): - retention-days: 90 - timeout-minutes: 10 - if: success() - - # Send data to events server: - - name: 'Post data' - uses: distributhor/workflow-webhook@v3 - env: - webhook_url: ${{ secrets.STDLIB_NPM_DOWNLOADS_URL }} - webhook_secret: ${{ secrets.STDLIB_WEBHOOK_SECRET }} - data: '{ "downloads": ${{ steps.download_data.outputs.data }} }' - timeout-minutes: 5 - if: success() diff --git a/.github/workflows/productionize.yml b/.github/workflows/productionize.yml deleted file mode 100644 index 334eb59..0000000 --- a/.github/workflows/productionize.yml +++ /dev/null @@ -1,798 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2022 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: productionize - -# Workflow triggers: -on: - # Run workflow when a new commit is pushed to the main branch: - push: - branches: - - main - - # Allow the workflow to be manually run: - workflow_dispatch: - inputs: - require-passing-tests: - description: 'Require passing tests for creating bundles' - type: boolean - default: true - - # Run workflow upon completion of `publish` workflow run: - workflow_run: - workflows: ["publish"] - types: [completed] - - -# Concurrency group to prevent multiple concurrent executions: -concurrency: - group: productionize - cancel-in-progress: true - -# Workflow jobs: -jobs: - - # Define a job to create a production build... - productionize: - - # Define display name: - name: 'Productionize' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - # Checkout main branch of repository: - - name: 'Checkout main branch' - uses: actions/checkout@v3 - with: - ref: main - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Create production branch: - - name: 'Create production branch' - run: | - git checkout -b production - - # Transform error messages: - - name: 'Transform error messages' - id: transform-error-messages - uses: stdlib-js/transform-errors-action@main - - # Format error messages: - - name: 'Replace double quotes with single quotes in rewritten format string error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\( \"([a-zA-Z0-9]+)\"/Error\( format\( '\1'/g" {} \; - - # Format string literal error messages: - - name: 'Replace double quotes with single quotes in rewritten string literal error messages' - run: | - find . -name "*.js" -exec sed -E -i "s/Error\( format\(\"([a-zA-Z0-9]+)\"\)/Error\( format\( '\1' \)/g" {} \; - - # Format code: - - name: 'Replace double quotes with single quotes in inserted `require` calls' - run: | - find . -name "*.js" -exec sed -E -i "s/require\( ?\"@stdlib\/error-tools-fmtprodmsg\" ?\);/require\( '@stdlib\/error-tools-fmtprodmsg' \);/g" {} \; - - # Change `@stdlib/string-format` to `@stdlib/error-tools-fmtprodmsg` in package.json if the former is a dependency, otherwise insert it as a dependency: - - name: 'Update dependencies in package.json' - run: | - PKG_VERSION=$(npm view @stdlib/error-tools-fmtprodmsg version) - if grep -q '"@stdlib/string-format"' package.json; then - sed -i "s/\"@stdlib\/string-format\": \"^.*\"/\"@stdlib\/error-tools-fmtprodmsg\": \"^$PKG_VERSION\"/g" package.json - else - node -e "var pkg = require( './package.json' ); pkg.dependencies[ '@stdlib/error-tools-fmtprodmsg' ] = '^$PKG_VERSION'; require( 'fs' ).writeFileSync( 'package.json', JSON.stringify( pkg, null, 2 ) );" - fi - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Transform error messages" - - # Push changes: - - name: 'Push changes' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" production --force - - # Define a job for running tests of the productionized code... - test: - - # Define a display name: - name: 'Run Tests' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Indicate that this job depends on the prior job finishing: - needs: productionize - - # Run this job regardless of the outcome of the prior job: - if: always() - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/checkout@v3 - with: - # Use the `production` branch: - ref: production - - # Install Node.js: - - name: 'Install Node.js' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Build native add-on if present: - - name: 'Build native add-on (if present)' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - run: | - if [ -f "binding.gyp" ]; then - npm install node-gyp --no-save && ./node_modules/.bin/node-gyp rebuild - fi - - # Run tests: - - name: 'Run tests' - if: ${{ github.event.inputs.require-passing-tests == 'true' }} - id: tests - run: | - npm test || npm test || npm test - - # Define job to create a bundle for use in Deno... - deno: - - # Define display name: - name: 'Create Deno bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `deno` branch exists: - - name: 'Check if remote `deno` branch exists' - id: deno-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin deno - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `deno` exists, delete everything in branch and merge `production` into it - - name: 'If `deno` exists, delete everything in branch and merge `production` into it' - if: steps.deno-branch-exists.outputs.remote-exists - run: | - git checkout -b deno origin/deno - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `deno` does not exist, create `deno` branch: - - name: 'If `deno` does not exist, create `deno` branch' - if: ${{ steps.deno-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b deno - - # Copy files to deno directory: - - name: 'Copy files to deno directory' - run: | - mkdir -p deno - cp README.md LICENSE CONTRIBUTORS NOTICE ./deno - - # Copy TypeScript definitions to deno directory: - if [ -d index.d.ts ]; then - cp index.d.ts ./deno/index.d.ts - fi - if [ -e ./docs/types/index.d.ts ]; then - cp ./docs/types/index.d.ts ./deno/mod.d.ts - fi - - # Install Node.js: - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: Install production and development dependencies - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Bundle package for use in Deno: - - name: 'Bundle package for Deno' - id: deno-bundle - uses: stdlib-js/bundle-action@main - with: - target: 'deno' - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - # Replace links to other packages with links to the deno branch: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/deno/"; - - # Replace reference to `@stdlib/types` with CDN link: - find ./deno -type f -name '*.ts' -print0 | xargs -0 sed -Ei "s/\/\/\/ /\/\/\/ /g" - - # Change wording of project description to avoid reference to JavaScript and Node.js: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "s/a standard library for JavaScript and Node.js, /a standard library /g" - - # Rewrite all `require()`s to use jsDelivr links: - find ./deno -type f -name '*.md' -print0 | xargs -0 sed -Ei "/require\( '@stdlib\// { - s/(var|let|const)\s+([a-z0-9_]+)\s+=\s*require\( '([^']+)' \);/import \2 from \'\3\';/i - s/@stdlib/https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js/ - s/';/@deno\/mod.js';/ - }" - - # Rewrite first `import` to show importing of named exports if available: - exports=$(cat lib/index.js | \ - grep -E 'setReadOnly\(.*,.*,.*\)' | \ - sed -E 's/setReadOnly\((.*),(.*),(.*)\);/\2/' | \ - sed -E "s/'//g" | \ - sort) - if [ -n "$exports" ]; then - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\nimport\s+([a-zA-Z0-9_]+)\s+from\s*'([^']+)';\n\`\`\`/\`\`\`javascript\nimport \1 from '\2';\n\`\`\`\n\nYou can also import the following named exports from the package:\n\n\`\`\`javascript\nimport { $(echo $exports | sed -E 's/ /, /g') } from '\2';\n\`\`\`/" - fi - - # Remove `installation`, `cli`, and `c` sections: - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./deno -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Create package.json file for deno branch: - jq --indent 2 '{"name": .name, "version": .version, "description": .description, "license": .license, "type": "module", "main": "./mod.js", "homepage": .homepage, "repository": .repository, "bugs": .bugs, "keywords": .keywords, "funding": .funding}' package.json > ./deno/package.json - - # Delete everything in current directory aside from deno folder: - - name: 'Delete everything in current directory aside from deno folder' - run: | - find . -type 'f' | grep -v -e "deno" -e ".git/" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e "deno" -e ".git" | xargs -r rm -rf - - # Move deno directory to root: - - name: 'Move deno directory to root' - run: | - mv ./deno/* . - rmdir ./deno - - # Commit changes: - - name: 'Commit changes' - run: | - git add -A - git commit -m "Auto-generated commit" - - # Push changes to `deno` branch: - - name: 'Push changes to `deno` branch' - run: | - SLUG=${{ github.repository }} - echo "Pushing changes to $SLUG..." - git push "https://$GITHUB_ACTOR:$GITHUB_TOKEN@github.com/$SLUG.git" deno - - # Send status to Slack channel if job fails: - - name: 'Send status to Slack channel in case of failure' - uses: act10ns/slack@v2 - with: - status: ${{ job.status }} - steps: ${{ toJson(steps) }} - channel: '#npm-ci' - if: failure() - - # Define job to create a UMD bundle... - umd: - - # Define display name: - name: 'Create UMD bundle' - - # Define the type of virtual host machine on which to run the job: - runs-on: ubuntu-latest - - # Indicate that this job depends on the test job finishing: - needs: test - - # Define the sequence of job steps... - steps: - # Checkout the repository: - - name: 'Checkout repository' - uses: actions/checkout@v3 - - # Configure git: - - name: 'Configure git' - run: | - git config --local user.email "noreply@stdlib.io" - git config --local user.name "stdlib-bot" - - # Check if remote `umd` branch exists: - - name: 'Check if remote `umd` branch exists' - id: umd-branch-exists - continue-on-error: true - run: | - git fetch --all - git ls-remote --exit-code --heads origin umd - if [ $? -eq 0 ]; then - echo "remote-exists=true" >> $GITHUB_OUTPUT - else - echo "remote-exists=false" >> $GITHUB_OUTPUT - fi - - # If `umd` exists, delete everything in branch and merge `production` into it - - name: 'If `umd` exists, delete everything in branch and merge `production` into it' - if: steps.umd-branch-exists.outputs.remote-exists - run: | - git checkout -b umd origin/umd - - find . -type 'f' | grep -v -e ".git/" -e "package.json" -e "README.md" -e "LICENSE" -e "CONTRIBUTORS" -e "NOTICE" | xargs -r rm - find . -mindepth 1 -type 'd' | grep -v -e ".git" | xargs -r rm -rf - - git add -A - git commit -m "Remove files" --allow-empty - - git config merge.theirs.name 'simulate `-s theirs`' - git config merge.theirs.driver 'cat %B > %A' - GIT_CONFIG_PARAMETERS="'merge.default=theirs'" git merge origin/production --allow-unrelated-histories - - # Copy files from `production` branch if necessary: - git checkout origin/production -- . - if [ -n "$(git status --porcelain)" ]; then - git add -A - git commit -m "Auto-generated commit" - fi - - # If `umd` does not exist, create `umd` branch: - - name: 'If `umd` does not exist, create `umd` branch' - if: ${{ steps.umd-branch-exists.outputs.remote-exists == false }} - run: | - git checkout production - git checkout -b umd - - # Copy files to umd directory: - - name: 'Copy files to umd directory' - run: | - mkdir -p umd - cp README.md LICENSE CONTRIBUTORS NOTICE ./umd - - # Install Node.js - - name: 'Install Node.js' - uses: actions/setup-node@v3 - with: - node-version: 16 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - id: install - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Extract alias: - - name: 'Extract alias' - id: extract-alias - run: | - alias=$(grep -E 'require\(' README.md | head -n 1 | sed -E 's/^var ([a-zA-Z0-9_]+) = .+/\1/') - echo "alias=${alias}" >> $GITHUB_OUTPUT - - # Create Universal Module Definition (UMD) Node.js bundle: - - name: 'Create Universal Module Definition (UMD) Node.js bundle' - id: umd-bundle-node - uses: stdlib-js/bundle-action@main - with: - target: 'umd-node' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Create Universal Module Definition (UMD) browser bundle: - - name: 'Create Universal Module Definition (UMD) browser bundle' - id: umd-bundle-browser - uses: stdlib-js/bundle-action@main - with: - target: 'umd-browser' - alias: ${{ steps.extract-alias.outputs.alias }} - - # Rewrite file contents: - - name: 'Rewrite file contents' - run: | - - # Replace links to other packages with links to the umd branch: - find ./umd -type f -name '*.md' -print0 | xargs -0 sed -Ei "/\/tree\/main/b; /^\[@stdlib[^:]+: https:\/\/github.com\/stdlib-js\// s/(.*)/\\1\/tree\/umd/"; - - # Remove `installation`, `cli`, and `c` sections: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/
[^<]+<\/section>//g;" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.cli \-\->//g" - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/(\* \* \*\n+)?
[\s\S]+<\!\-\- \/.c \-\->//g" - - # Rewrite first `require()` to show consumption of the UMD bundle in Observable and via a `script` tag: - find ./umd -type f -name '*.md' -print0 | xargs -0 perl -0777 -i -pe "s/\`\`\`javascript\n(var|let|const)\s+([a-zA-Z0-9_]+)\s+=\s*require\( '\@stdlib\/([^']+)' \);\n\`\`\`/To use in Observable,\n\n\`\`\`javascript\n\2 = require\( 'https:\/\/cdn.jsdelivr.net\/gh\/stdlib-js\/\3\@umd\/browser.js' \)\n\`\`\`\n\nTo vendor stdlib functionality and avoid installing dependency trees for Node.js, you can use the UMD server build:\n\n\`\`\`javascript\nvar \2 = require\( 'path\/to\/vendor\/umd\/\3\/index.js' \)\n\`\`\`\n\nTo include the bundle in a webpage,\n\n\`\`\`html\n + + ```
@@ -164,7 +157,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -226,11 +219,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index cbe448b..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index d1bd689..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( [dtype] ) - Returns a list of ndarray data types to which a provided ndarray data type - can be safely cast or cast within the same "kind". - - If not provided an ndarray data type, the function returns a casting table. - - If provided an unrecognized ndarray data type, the function returns `null`. - - Parameters - ---------- - dtype: any (optional) - ndarray data type value. - - Returns - ------- - out: Object|Array|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..67bfd3c --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..dd3c768 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From f8304295a1b2662bc097e89eeb0c85decc7cfab5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 23 Sep 2023 21:38:10 +0000 Subject: [PATCH 053/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 0033aa8..a15b7b7 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.1.0", "@stdlib/ndarray-dtypes": "^0.1.0", "@stdlib/utils-keys": "^0.1.0", - "@stdlib/utils-library-manifest": "^0.1.0" + "@stdlib/utils-library-manifest": "^0.1.0", + "@stdlib/error-tools-fmtprodmsg": "^0.1.0" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.1.0", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 97be470b51730381e0f780b612e508bcff476d34 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 23 Sep 2023 21:50:47 +0000 Subject: [PATCH 054/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6223 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 1cb4677..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 67bfd3c..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 5eb99717f3b8195219add4b18402fca0f71dcc99 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 23 Sep 2023 21:51:37 +0000 Subject: [PATCH 055/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 76 - 43 files changed, 6202 insertions(+), 4350 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 b1688c3..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/ndarray/same-kind-casts) 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 00faa6f..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/ndarray/same-kind-casts) 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 6f78464..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: '8 8 * * 1' - - # 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 + + ```
@@ -175,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -237,11 +230,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index cbe448b..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index de199da..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,s){s.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var g=p(function(K,v){ -var x=require('@stdlib/utils-keys/dist'),b=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,r,u,a,o,l,i,e;for(r={},t=x(f),n=t.length,e=0;e|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..85beb22 --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.1.0-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..3004484 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 2c6c2b0071876b48fd9ba29215d28d358bb968fd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 23 Sep 2023 22:01:46 +0000 Subject: [PATCH 056/123] 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 e7ea7ff..9d62182 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import sameKindCasts from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-same-kind-casts@esm/index.mjs'; +import sameKindCasts from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-same-kind-casts@v0.1.0-esm/index.mjs'; ``` #### sameKindCasts( \[dtype] ) @@ -111,7 +111,7 @@ var out = sameKindCasts( 'foo' ); - - - - From e9f2fe15dcf0c8bbdc848046f2c5bdb24470bea0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 2 Oct 2023 14:40:52 +0000 Subject: [PATCH 060/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 76 - test/test.js | 76 - 45 files changed, 6202 insertions(+), 4485 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 de68b10..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-10-01T03:09:22.994Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 5aa65b4..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: '8 8 * * 1' - - # 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 + + ```
@@ -175,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -237,11 +230,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index cbe448b..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index de199da..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,s){s.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var g=p(function(K,v){ -var x=require('@stdlib/utils-keys/dist'),b=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,r,u,a,o,l,i,e;for(r={},t=x(f),n=t.length,e=0;e|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..f210156 --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.1.0-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.1.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..56b7cdf --- /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 5f3044f..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../../dist' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From ea0b5e6ad0f63d457ddd7f25598f5a8f49902517 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 5 Oct 2023 12:31:57 +0000 Subject: [PATCH 061/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 967828a..03000ac 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.1.0", "@stdlib/ndarray-dtypes": "^0.1.0", "@stdlib/utils-keys": "^0.1.0", - "@stdlib/utils-library-manifest": "^0.1.1" + "@stdlib/utils-library-manifest": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.1.1", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 8bdbf7580151d618c048dc24387d6b357b1da0eb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 6 Oct 2023 16:05:24 +0000 Subject: [PATCH 062/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6223 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index f210156..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.1.0-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.1.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 2172e8b8245a4328f7ac765bacd39a468fe77bcf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 6 Oct 2023 16:06:10 +0000 Subject: [PATCH 063/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 76 - test/test.js | 76 - 44 files changed, 6202 insertions(+), 4484 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 5aa65b4..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: '8 8 * * 1' - - # 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 + + ```
@@ -175,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -237,11 +230,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index cbe448b..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index de199da..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,s){s.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var g=p(function(K,v){ -var x=require('@stdlib/utils-keys/dist'),b=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,r,u,a,o,l,i,e;for(r={},t=x(f),n=t.length,e=0;e|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..5fbf030 --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.1.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.1.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..2195227 --- /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 5f3044f..0000000 --- a/test/dist/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../../dist' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 72e6ec854c59fa2ee9cb5651ecd155466bb6c489 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Nov 2023 08:53:13 +0000 Subject: [PATCH 064/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 967828a..03000ac 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.1.0", "@stdlib/ndarray-dtypes": "^0.1.0", "@stdlib/utils-keys": "^0.1.0", - "@stdlib/utils-library-manifest": "^0.1.1" + "@stdlib/utils-library-manifest": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.1.1", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 0fde398895fe89d8e230b4fe7cc9c8532fded6f0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 2 Nov 2023 15:26:48 +0000 Subject: [PATCH 065/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6223 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5fbf030..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.1.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.1.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 2dcb3250c923135f7f7684a3c1849e0234e358f0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 2 Nov 2023 15:27:21 +0000 Subject: [PATCH 066/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 45 files changed, 6202 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 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 196a9dc..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-11-01T03:17:09.321Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 5aa65b4..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: '8 8 * * 1' - - # 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 + + ```
@@ -175,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -237,11 +230,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index cbe448b..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index de199da..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,s){s.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var g=p(function(K,v){ -var x=require('@stdlib/utils-keys/dist'),b=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,r,u,a,o,l,i,e;for(r={},t=x(f),n=t.length,e=0;e|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..5fbf030 --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.1.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.1.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..bdf4e34 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From a4e4e317fa99919767f490708c4554655759af89 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Dec 2023 07:37:20 +0000 Subject: [PATCH 067/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 3d69765..6005fe3 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.1.0", "@stdlib/ndarray-dtypes": "^0.1.0", "@stdlib/utils-keys": "^0.1.0", - "@stdlib/utils-library-manifest": "^0.1.1" + "@stdlib/utils-library-manifest": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.1.1", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 73bebfb61844be6fb5669ea959f6a0bacfb619f5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 03:02:13 +0000 Subject: [PATCH 068/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6223 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5fbf030..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.1.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.1.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From aedbc5578be20a43d7806773c85bd5bdd5226b14 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Dec 2023 03:02:56 +0000 Subject: [PATCH 069/123] 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 | 41 +- benchmark/benchmark.js | 71 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 45 files changed, 6202 insertions(+), 4445 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 661d7de..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-12-01T03:27:31.737Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 5aa65b4..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: '8 8 * * 1' - - # 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 + + ```
@@ -175,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -237,11 +230,11 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 5dc1ea4..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index cbe448b..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index de199da..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,s){s.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var g=p(function(K,v){ -var x=require('@stdlib/utils-keys/dist'),b=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,r,u,a,o,l,i,e;for(r={},t=x(f),n=t.length,e=0;e|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..5fbf030 --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.1.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.1.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..a7353f1 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 63889095e89fbce0af9ef251f16bdc5f29e9a24e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 04:51:19 +0000 Subject: [PATCH 070/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 48fd7f2..eb6b6fd 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.1.0", "@stdlib/ndarray-dtypes": "^0.1.0", "@stdlib/utils-keys": "^0.1.0", - "@stdlib/utils-library-manifest": "^0.1.1" + "@stdlib/utils-library-manifest": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.1.1", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From ec84268a9c4d9bc1ea2115d6008f8ae457ff1bad Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 11:15:24 +0000 Subject: [PATCH 071/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6223 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5fbf030..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.1.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.1.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 94607e68d45db41e36ce4b689d5c45509f81fdb5 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 11:15:38 +0000 Subject: [PATCH 072/123] 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 | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 46 files changed, 6202 insertions(+), 4451 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 ae3a708..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-01-01T02:59:35.524Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 2b58206..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: '8 8 * * 1' - - # 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 + + ```
@@ -175,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -237,11 +230,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index cbe448b..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index de199da..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,s){s.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var g=p(function(K,v){ -var x=require('@stdlib/utils-keys/dist'),b=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,r,u,a,o,l,i,e;for(r={},t=x(f),n=t.length,e=0;e|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..36e671f --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.1.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.1.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..dbef912 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 267c636fcca19d04112bc9b104e241d2237fec6d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 05:21:47 +0000 Subject: [PATCH 073/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 48fd7f2..eb6b6fd 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.1.0", "@stdlib/ndarray-dtypes": "^0.1.0", "@stdlib/utils-keys": "^0.1.0", - "@stdlib/utils-library-manifest": "^0.1.1" + "@stdlib/utils-library-manifest": "^0.1.1", + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.1.1", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From b0b15b7d5e273af221d5183016385b7ffd1b9e36 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 10:45:53 +0000 Subject: [PATCH 074/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6223 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 36e671f..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.1.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.1.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From bd48677b1d6145f53f8f7be68059718f43014f27 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 10:46:10 +0000 Subject: [PATCH 075/123] 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 | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 46 files changed, 6202 insertions(+), 4456 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 dc46da7..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-02-01T03:36:11.987Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 2b58206..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index de199da..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,s){s.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var g=p(function(K,v){ -var x=require('@stdlib/utils-keys/dist'),b=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,r,u,a,o,l,i,e;for(r={},t=x(f),n=t.length,e=0;e|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..36e671f --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.1.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.1.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..0ec2dc9 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From b82d6e4311fd4b47dd4ab1c855a3e5a74d3b449d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 09:41:48 +0000 Subject: [PATCH 076/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 9bb11c5..7ac90f7 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.2.0", "@stdlib/ndarray-dtypes": "^0.2.0", "@stdlib/utils-keys": "^0.2.0", - "@stdlib/utils-library-manifest": "^0.2.0" + "@stdlib/utils-library-manifest": "^0.2.0", + "@stdlib/error-tools-fmtprodmsg": "^0.2.0" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.1.1", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 8121ed339e64ca6a7ccb3342d2a8f574e6cd74e1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 18:21:01 +0000 Subject: [PATCH 077/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6223 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 36e671f..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.1.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.1.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From e4c2a74388c7c1b5abaa65199646d911481a293b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 18:21:18 +0000 Subject: [PATCH 078/123] 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 | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 45 files changed, 6202 insertions(+), 4459 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 dbc3a88..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index de199da..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,s){s.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var g=p(function(K,v){ -var x=require('@stdlib/utils-keys/dist'),b=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,r,u,a,o,l,i,e;for(r={},t=x(f),n=t.length,e=0;e|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..a9e886f --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.1.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.0-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.1.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..e46b023 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 1e94631e6bf0df7362df26c26eaf052c7d2148dd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 21:28:39 +0000 Subject: [PATCH 079/123] 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 2b067b2..d761c95 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import sameKindCasts from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-same-kind-casts@esm/index.mjs'; +import sameKindCasts from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-same-kind-casts@v0.2.0-esm/index.mjs'; ``` #### sameKindCasts( \[dtype] ) @@ -111,7 +111,7 @@ var out = sameKindCasts( 'foo' ); - - - - From 180023eff213f032941a089fa65c726086d2b103 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 24 Feb 2024 18:45:42 +0000 Subject: [PATCH 083/123] 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 | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 45 files changed, 4867 insertions(+), 4453 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 0901726..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index de199da..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,s){s.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var g=p(function(K,v){ -var x=require('@stdlib/utils-keys/dist'),b=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,r,u,a,o,l,i,e;for(r={},t=x(f),n=t.length,e=0;e|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..6dff6c5 --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.0-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.0-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(l){return 0===arguments.length?function(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4169eab --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From dc8633ce8dd31dbd19891dd33813645a75f4725c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 24 Feb 2024 19:15:45 +0000 Subject: [PATCH 084/123] 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 1e12aa8..bc283f1 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import sameKindCasts from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-same-kind-casts@esm/index.mjs'; +import sameKindCasts from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-same-kind-casts@v0.2.1-esm/index.mjs'; ``` #### sameKindCasts( \[dtype] ) @@ -111,7 +111,7 @@ var out = sameKindCasts( 'foo' ); - - - - From ba04713f7c96a181c3cb34b3c18a5795f288d962 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 09:30:34 +0000 Subject: [PATCH 088/123] 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 | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 46 files changed, 4867 insertions(+), 4455 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 7aa5e76..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-03-01T03:30:41.343Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 0901726..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index de199da..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,s){s.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var g=p(function(K,v){ -var x=require('@stdlib/utils-keys/dist'),b=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,r,u,a,o,l,i,e;for(r={},t=x(f),n=t.length,e=0;e|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d322422 --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.1-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(l){return 0===arguments.length?function(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..8902853 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 315ec8ab991b7f8534a36e5439e099d247a80679 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 04:19:55 +0000 Subject: [PATCH 089/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index bc6fb79..e001010 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.2.1", "@stdlib/ndarray-dtypes": "^0.2.1", "@stdlib/utils-keys": "^0.2.1", - "@stdlib/utils-library-manifest": "^0.2.1" + "@stdlib/utils-library-manifest": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.2.1", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1088bc429af947d994bab5556c8bf8873c63a4a2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 09:01:11 +0000 Subject: [PATCH 090/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4888 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index d322422..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.1-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(l){return 0===arguments.length?function(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 3af7186f4766ddcc4aca18feb04f88f051030080 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 09:01:21 +0000 Subject: [PATCH 091/123] 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 | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 46 files changed, 4867 insertions(+), 4458 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 517bf94..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-04-01T02:53:16.067Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 0901726..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index de199da..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,s){s.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var g=p(function(K,v){ -var x=require('@stdlib/utils-keys/dist'),b=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,r,u,a,o,l,i,e;for(r={},t=x(f),n=t.length,e=0;e|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d322422 --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.1-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(l){return 0===arguments.length?function(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..8902853 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 0c284f6203e110164f7d3f6a40b102315832a01b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 00:31:33 +0000 Subject: [PATCH 092/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index bc6fb79..e001010 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.2.1", "@stdlib/ndarray-dtypes": "^0.2.1", "@stdlib/utils-keys": "^0.2.1", - "@stdlib/utils-library-manifest": "^0.2.1" + "@stdlib/utils-library-manifest": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.2.1", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 1dd6681c1f58e913b1d652bf79d11f47aa2a5e2f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 05:44:02 +0000 Subject: [PATCH 093/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4888 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index d322422..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.1-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(l){return 0===arguments.length?function(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 867afdc77d9a6bfb4eacae624ca9476f2f507760 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 12 Apr 2024 05:44:16 +0000 Subject: [PATCH 094/123] 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 | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 197 - manifest.json | 38 - package.json | 61 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 45 files changed, 4867 insertions(+), 4459 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 0901726..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index de199da..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,s){s.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}}});var g=p(function(K,v){ -var x=require('@stdlib/utils-keys/dist'),b=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,r,u,a,o,l,i,e;for(r={},t=x(f),n=t.length,e=0;e|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..d322422 --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.1-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(l){return 0===arguments.length?function(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..8902853 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From f247e6a1b4f530490801b925759d3b6e142b613a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 10 Jul 2024 18:34:31 +0000 Subject: [PATCH 095/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index bc6fb79..e001010 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.2.1", "@stdlib/ndarray-dtypes": "^0.2.1", "@stdlib/utils-keys": "^0.2.1", - "@stdlib/utils-library-manifest": "^0.2.1" + "@stdlib/utils-library-manifest": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.2.1", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From dbeff8b708ef8fc14baadb8593e21debbc6b8886 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 10 Jul 2024 18:34:57 +0000 Subject: [PATCH 096/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4888 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index d322422..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.1-esm/index.mjs";var e,o={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0}};function l(l){return 0===arguments.length?function(){var n,i,e,l,u,c,r,a,m;for(e={},i=(n=t(o)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 65e56179c4c6b974771ebfe92093a2f93ff5a366 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 10 Jul 2024 18:35:30 +0000 Subject: [PATCH 097/123] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 105 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 226 - manifest.json | 38 - package.json | 61 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 45 files changed, 4867 insertions(+), 4599 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 0901726..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 6b4b399..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,g){g.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}}});var v=p(function(K,x){ -var b=require('@stdlib/utils-keys/dist'),s=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,e,r,l,u,a,i,o;for(e={},t=b(f),n=t.length,o=0;o|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..4761d55 --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.1-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..864c7cf --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 270277e9647ee6166581d9eaa29ff7d54b26c2eb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 01:56:48 +0000 Subject: [PATCH 098/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 1fa2ad4..6ebcb53 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.2.1", "@stdlib/ndarray-dtypes": "^0.2.1", "@stdlib/utils-keys": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.2.2", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From f6f466c0dc6abf32fb7b376d215c951799200277 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 02:07:27 +0000 Subject: [PATCH 099/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4888 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 4761d55..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.1-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.1-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From cd6b910556b2ff3746e61a407a7e2c3f0eb91ecb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 02:07:38 +0000 Subject: [PATCH 100/123] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 205 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 226 - manifest.json | 38 - package.json | 61 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 45 files changed, 4867 insertions(+), 4699 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 0901726..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 6b4b399..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,g){g.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}}});var v=p(function(K,x){ -var b=require('@stdlib/utils-keys/dist'),s=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,e,r,l,u,a,i,o;for(e={},t=b(f),n=t.length,o=0;o|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..ee6b45e --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.1-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9101ba3 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From aa897f193a63461df86508809f830ee1bb73d5cd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 28 Jul 2024 02:16:46 +0000 Subject: [PATCH 101/123] Update README.md for ESM bundle v0.3.0 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bab601a..013d20e 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import sameKindCasts from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-same-kind-casts@esm/index.mjs'; +import sameKindCasts from 'https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-same-kind-casts@v0.3.0-esm/index.mjs'; ``` #### sameKindCasts( \[dtype] ) @@ -111,7 +111,7 @@ var out = sameKindCasts( 'foo' ); - - - - From 289ab16f68c26cab77bc11ec34397b648d9561f6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 09:10:09 +0000 Subject: [PATCH 105/123] 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 | 158 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 226 - manifest.json | 38 - package.json | 61 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 46 files changed, 4867 insertions(+), 4655 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 a5a61b9..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-01T03:30:57.934Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 0901726..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 6b4b399..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,g){g.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}}});var v=p(function(K,x){ -var b=require('@stdlib/utils-keys/dist'),s=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,e,r,l,u,a,i,o;for(e={},t=b(f),n=t.length,o=0;o|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..eb7e21f --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.2-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..2757563 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 7a94140e855a1c2b178a8a40464f900b26729d05 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 3 Aug 2024 19:49:37 +0000 Subject: [PATCH 106/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e8b217a..040f3fa 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.2.2", "@stdlib/ndarray-dtypes": "^0.3.0", "@stdlib/utils-keys": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.2.2", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 668cf5d1060c0a913a90c4291d651bbd0455bb4d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 3 Aug 2024 23:05:32 +0000 Subject: [PATCH 107/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4888 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index eb7e21f..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.2-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 16cf3f3f0e7b230339c48a502ba042225a6d36ed Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 3 Aug 2024 23:05:46 +0000 Subject: [PATCH 108/123] 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 | 205 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 226 - manifest.json | 38 - package.json | 61 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 46 files changed, 4867 insertions(+), 4702 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 5248fb9..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-03T18:42:56.461Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 0901726..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 6b4b399..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,g){g.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}}});var v=p(function(K,x){ -var b=require('@stdlib/utils-keys/dist'),s=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,e,r,l,u,a,i,o;for(e={},t=b(f),n=t.length,o=0;o|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..eb7e21f --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.2-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..2757563 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 46df6fdbf4fae91188975ded217f973cdb1e3b04 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 05:01:45 +0000 Subject: [PATCH 109/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e8b217a..040f3fa 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.2.2", "@stdlib/ndarray-dtypes": "^0.3.0", "@stdlib/utils-keys": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.2.2", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From a068e66a359fc0f87d42a468aef8b8d50bd25617 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 09:02:11 +0000 Subject: [PATCH 110/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4888 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index eb7e21f..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.2-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 9bb6dfc81bc5777c344873d395e9a3ab91ddcd04 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 09:02:26 +0000 Subject: [PATCH 111/123] 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 | 204 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 226 - manifest.json | 38 - package.json | 61 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 46 files changed, 4867 insertions(+), 4701 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 4094b4c..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-09-01T03:44:00.026Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 0901726..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 6b4b399..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,g){g.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}}});var v=p(function(K,x){ -var b=require('@stdlib/utils-keys/dist'),s=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,e,r,l,u,a,i,o;for(e={},t=b(f),n=t.length,o=0;o|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..eb7e21f --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.2-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..2757563 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From d0a782c731e8df0eade9e5450aa70333a5564504 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 05:10:25 +0000 Subject: [PATCH 112/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e8b217a..040f3fa 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.2.2", "@stdlib/ndarray-dtypes": "^0.3.0", "@stdlib/utils-keys": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.2.2", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From ee48d1226fb3d90e785dc6dfc878ff06ec881b08 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 09:14:14 +0000 Subject: [PATCH 113/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4888 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index eb7e21f..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.2-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 94ecb5ae17aaf3327dda04abeaf53fcf92115356 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 09:14:29 +0000 Subject: [PATCH 114/123] 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 | 204 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 226 - manifest.json | 38 - package.json | 61 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 46 files changed, 4867 insertions(+), 4701 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 1c47731..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-10-01T03:53:59.417Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 0901726..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 6b4b399..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,g){g.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}}});var v=p(function(K,x){ -var b=require('@stdlib/utils-keys/dist'),s=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,e,r,l,u,a,i,o;for(e={},t=b(f),n=t.length,o=0;o|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..eb7e21f --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.2-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..2757563 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 0ad1dd54a615181c0b88dfb60a0c4ba6688ad1f3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 05:06:49 +0000 Subject: [PATCH 115/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e8b217a..040f3fa 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.2.2", "@stdlib/ndarray-dtypes": "^0.3.0", "@stdlib/utils-keys": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.2.2", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From d1f1451f25ab268889937299a980ea27ad5fb5f1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 08:41:08 +0000 Subject: [PATCH 116/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4888 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index eb7e21f..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.2-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From a299b0c3ea0be74a0b45acb4d519d84aa94903c3 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 08:41:21 +0000 Subject: [PATCH 117/123] 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 | 204 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 226 - manifest.json | 38 - package.json | 61 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 46 files changed, 4867 insertions(+), 4701 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 2f9eadf..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-11-01T03:57:31.115Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 0901726..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 6b4b399..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,g){g.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}}});var v=p(function(K,x){ -var b=require('@stdlib/utils-keys/dist'),s=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,e,r,l,u,a,i,o;for(e={},t=b(f),n=t.length,o=0;o|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..eb7e21f --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.2-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..2757563 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 2d3ac645132ef54539290ac47213b21804c597b2 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 05:22:17 +0000 Subject: [PATCH 118/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e8b217a..040f3fa 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.2.2", "@stdlib/ndarray-dtypes": "^0.3.0", "@stdlib/utils-keys": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.2.2", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 18fabb46ac9d3a3cbc6447caa25286f41deb3a70 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 09:11:53 +0000 Subject: [PATCH 119/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4888 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index eb7e21f..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.2-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From 26334a3b798febfe778d689b9b833a50a4d24038 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 09:12:05 +0000 Subject: [PATCH 120/123] 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 | 204 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 226 - manifest.json | 38 - package.json | 61 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 47 files changed, 4867 insertions(+), 4806 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 609e174..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-01T04:02:27.164Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 0901726..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 6b4b399..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,g){g.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}}});var v=p(function(K,x){ -var b=require('@stdlib/utils-keys/dist'),s=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,e,r,l,u,a,i,o;for(e={},t=b(f),n=t.length,o=0;o|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..eb7e21f --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.2-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..2757563 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -}); From 91cb8f501c94d6de6e19e6a4f25be65187380c0c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 13 Jan 2025 02:42:57 +0000 Subject: [PATCH 121/123] Transform error messages --- package.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index e8b217a..040f3fa 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "@stdlib/ndarray-base-dtype-resolve-str": "^0.2.2", "@stdlib/ndarray-dtypes": "^0.3.0", "@stdlib/utils-keys": "^0.2.2", - "@stdlib/utils-library-manifest": "^0.2.2" + "@stdlib/utils-library-manifest": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { "@stdlib/assert-is-string-array": "^0.2.2", @@ -85,4 +86,4 @@ "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} +} \ No newline at end of file From 878867cf71c14d1f4470c531b41d0dc4fe354cd8 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 13 Jan 2025 03:17:21 +0000 Subject: [PATCH 122/123] Remove files --- index.d.ts | 41 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4888 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 475d076..0000000 --- a/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind". -* -* ## Notes -* -* - If not provided an ndarray data type, the function returns a casting table. -* - If provided an unrecognized ndarray data type, the function returns `null`. -* -* @param dtype - ndarray data type value -* @returns list of ndarray data types or null -* -* @example -* var list = sameKindCasts( 'float32' ); -* // returns [...] -*/ -declare function sameKindCasts( dtype?: any ): any; - - -// EXPORTS // - -export = sameKindCasts; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index eb7e21f..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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.2-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m - - - - - - Rollup Visualizer - - - -
- - - - - From d5784674c55ff3907c7c06ed742a6e8eed4cbd78 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 13 Jan 2025 03:17:31 +0000 Subject: [PATCH 123/123] 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 | 204 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 43 +- SECURITY.md | 5 - benchmark/benchmark.js | 71 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 28 - docs/types/test.ts | 34 - examples/index.js | 35 - include/stdlib/ndarray/same_kind_casts.h | 445 -- docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 40 - lib/main.js | 135 - lib/same_kind_casts.json | 226 - manifest.json | 38 - package.json | 61 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 76 - 47 files changed, 4867 insertions(+), 4806 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 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 delete mode 100644 include/stdlib/ndarray/same_kind_casts.h rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js delete mode 100644 lib/same_kind_casts.json delete mode 100644 manifest.json 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 e180a1b..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-01-13T02:26:01.386Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index b1688c3..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/ndarray/same-kind-casts) 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 7058bf5..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/ndarray/same-kind-casts) 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 0901726..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: '8 8 * * 1' - - # 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 + + ```
@@ -177,7 +168,7 @@ for ( i = 0; i < DTYPES.length; i++ ) { ## 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]. @@ -242,11 +233,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. -[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes +[@stdlib/ndarray/casting-modes]: https://github.com/stdlib-js/ndarray-casting-modes/tree/esm -[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes +[@stdlib/ndarray/dtypes]: https://github.com/stdlib-js/ndarray-dtypes/tree/esm -[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts +[@stdlib/ndarray/safe-casts]: https://github.com/stdlib-js/ndarray-safe-casts/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 ce48537..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var dtypes = require( '@stdlib/ndarray-dtypes' ); -var pkg = require( './../package.json' ).name; -var sameKindCasts = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( pkg+'::dtype', function benchmark( b ) { - var out; - var dt; - var i; - - dt = dtypes(); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sameKindCasts( dt[ i%dt.length ] ); - if ( out.length === 0 ) { - b.fail( 'should not be empty' ); - } - } - b.toc(); - if ( !isStringArray( out ) ) { - b.fail( 'should return an array of strings' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 6849804..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/ndarray/same-kind-casts" -%% click B href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/main" -%% click C href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production" -%% click D href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm" -%% click E href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno" -%% click F href "https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/same-kind-casts -[production-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/production -[deno-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/deno -[deno-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/umd -[umd-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/ndarray-same-kind-casts/tree/esm -[esm-readme]: https://github.com/stdlib-js/ndarray-same-kind-casts/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 fdad4c6..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import sameKindCasts from '../docs/types/index'; -export = sameKindCasts; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 6b4b399..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var p=function(t,n){return function(){return n||t((n={exports:{}}).exports,n),n.exports}};var m=p(function(A,g){g.exports={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}}});var v=p(function(K,x){ -var b=require('@stdlib/utils-keys/dist'),s=require('@stdlib/assert-has-own-property/dist'),y=require('@stdlib/ndarray-base-dtype-resolve-str/dist'),f=m(),c;function d(){var t,n,e,r,l,u,a,i,o;for(e={},t=b(f),n=t.length,o=0;o|null - ndarray data types to which a data type can be safely cast or cast - within the same "kind". - - Examples - -------- - > var out = {{alias}}( 'float32' ) - - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index b236d3a..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,34 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 sameKindCasts = require( './index' ); - - -// TESTS // - -// The function returns an object, array of strings, or null... -{ - sameKindCasts(); // $ExpectType any - sameKindCasts( 'float32' ); // $ExpectType any - sameKindCasts( 'float' ); // $ExpectType any -} - -// The compiler throws an error if the function is provided more than one argument... -{ - sameKindCasts( 'float32', 123 ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index ea56ca2..0000000 --- a/examples/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var sameKindCasts = require( './../lib' ); - -var DTYPES; -var list; -var i; - -// Get the list of supported ndarray data types: -DTYPES = dtypes(); - -// Print the list of ndarray data types to which a data type can be cast... -for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - console.log( '%s: %s', DTYPES[ i ], list.join( ', ' ) ); -} diff --git a/include/stdlib/ndarray/same_kind_casts.h b/include/stdlib/ndarray/same_kind_casts.h deleted file mode 100644 index 59f3a6b..0000000 --- a/include/stdlib/ndarray/same_kind_casts.h +++ /dev/null @@ -1,445 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -#ifndef STDLIB_NDARRAY_SAME_KIND_CASTS_H -#define STDLIB_NDARRAY_SAME_KIND_CASTS_H - -#include -#include "stdlib/ndarray/dtypes.h" - -/* -* If C++, prevent name mangling so that the compiler emits a binary file having undecorated names, thus mirroring the behavior of a C compiler. -*/ -#ifdef __cplusplus -extern "C" { -#endif - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT32[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT16[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 1, - [ STDLIB_NDARRAY_UINT8C ] = 1, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 1, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 1, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 1, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_INT8[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 1, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 1, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 1, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 1, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 1, - [ STDLIB_NDARRAY_FLOAT64 ] = 1, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 1, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 1, - [ STDLIB_NDARRAY_COMPLEX128 ] = 1, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 1, - [ STDLIB_NDARRAY_GENERIC ] = 0 -}; - -const int8_t STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = 0, - [ STDLIB_NDARRAY_UINT8 ] = 0, - [ STDLIB_NDARRAY_UINT8C ] = 0, - [ STDLIB_NDARRAY_INT16 ] = 0, - [ STDLIB_NDARRAY_UINT16 ] = 0, - [ STDLIB_NDARRAY_INT32 ] = 0, - [ STDLIB_NDARRAY_UINT32 ] = 0, - [ STDLIB_NDARRAY_INT64 ] = 0, - [ STDLIB_NDARRAY_UINT64 ] = 0, - - [ STDLIB_NDARRAY_FLOAT32 ] = 0, - [ STDLIB_NDARRAY_FLOAT64 ] = 0, - - [ STDLIB_NDARRAY_COMPLEX64 ] = 0, - [ STDLIB_NDARRAY_COMPLEX128 ] = 0, - - [ STDLIB_NDARRAY_BOOL ] = 0, - - [ STDLIB_NDARRAY_BINARY ] = 0, - [ STDLIB_NDARRAY_GENERIC ] = 1 -}; - -// Define a table of pointers containing the above casting tables: -const int8_t *STDLIB_NDARRAY_SAME_KIND_CASTS[ STDLIB_NDARRAY_NDTYPES ] = { - - [ STDLIB_NDARRAY_INT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT8, - [ STDLIB_NDARRAY_UINT8 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8, - [ STDLIB_NDARRAY_UINT8C ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT8C, - [ STDLIB_NDARRAY_INT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT16, - [ STDLIB_NDARRAY_UINT16 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT16, - [ STDLIB_NDARRAY_INT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT32, - [ STDLIB_NDARRAY_UINT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT32, - [ STDLIB_NDARRAY_INT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_INT64, - [ STDLIB_NDARRAY_UINT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_UINT64, - - [ STDLIB_NDARRAY_FLOAT32 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT32, - [ STDLIB_NDARRAY_FLOAT64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_FLOAT64, - - [ STDLIB_NDARRAY_COMPLEX64 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX64, - [ STDLIB_NDARRAY_COMPLEX128 ] = STDLIB_NDARRAY_SAME_KIND_CASTS_COMPLEX128, - - [ STDLIB_NDARRAY_BOOL ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BOOL, - - [ STDLIB_NDARRAY_BINARY ] = STDLIB_NDARRAY_SAME_KIND_CASTS_BINARY, - [ STDLIB_NDARRAY_GENERIC ] = STDLIB_NDARRAY_SAME_KIND_CASTS_GENERIC -}; - -#ifdef __cplusplus -} -#endif - -#endif // !STDLIB_NDARRAY_SAME_KIND_CASTS_H diff --git a/docs/types/index.d.ts b/index.d.ts similarity index 100% rename from docs/types/index.d.ts rename to index.d.ts diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..3992675 --- /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 t from"https://cdn.jsdelivr.net/gh/stdlib-js/utils-keys@v0.2.2-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-has-own-property@v0.2.2-esm/index.mjs";import i from"https://cdn.jsdelivr.net/gh/stdlib-js/ndarray-base-dtype-resolve-str@v0.2.2-esm/index.mjs";var o,l={float64:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},float32:{float64:1,float32:1,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int32:{float64:1,float32:0,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:0,binary:0,generic:1,bool:0},int16:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},int8:{float64:1,float32:1,int32:1,int16:1,int8:1,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint32:{float64:1,float32:0,int32:0,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:0,binary:0,generic:1,bool:0},uint16:{float64:1,float32:1,int32:1,int16:0,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},uint8c:{float64:1,float32:1,int32:1,int16:1,int8:0,uint32:1,uint16:1,uint8:1,uint8c:1,complex128:1,complex64:1,binary:0,generic:1,bool:0},complex128:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},complex64:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:1,complex64:1,binary:0,generic:0,bool:0},generic:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:0},binary:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:1,generic:0,bool:0},bool:{float64:0,float32:0,int32:0,int16:0,int8:0,uint32:0,uint16:0,uint8:0,uint8c:0,complex128:0,complex64:0,binary:0,generic:1,bool:1}};function e(e){return 0===arguments.length?function(){var n,i,o,e,u,c,r,a,m;for(o={},i=(n=t(l)).length,m=0;m=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdtypes", @@ -81,9 +27,8 @@ "utils", "util" ], - "__stdlib__": {}, "funding": { "type": "opencollective", "url": "https://opencollective.com/stdlib" } -} \ No newline at end of file +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..2757563 --- /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 424b58c..0000000 --- a/test/test.js +++ /dev/null @@ -1,76 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dtypes = require( '@stdlib/ndarray-dtypes' ); -var isStringArray = require( '@stdlib/assert-is-string-array' ).primitives; -var sameKindCasts = require( './../lib' ); - - -// VARIABLES // - -var DTYPES = dtypes(); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sameKindCasts, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if not provided a data type, the function returns a table', function test( t ) { - var out = sameKindCasts(); - t.strictEqual( typeof out, 'object', 'returns an object' ); - t.strictEqual( out[ 'float32' ][ 'float64' ], 1, 'returns expected value' ); - t.strictEqual( out[ 'float32' ][ 'int8' ], 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns a list of ndarray data types to which a provided ndarray data type can be safely cast or cast within the same "kind"', function test( t ) { - var list; - var i; - for ( i = 0; i < DTYPES.length; i++ ) { - list = sameKindCasts( DTYPES[ i ] ); - t.strictEqual( isStringArray( list ), true, 'returns an array of strings when provided '+DTYPES[ i ] ); - } - t.end(); -}); - -tape( 'if provided an unrecognized or unsupported data type, the function returns `null`', function test( t ) { - var values; - var i; - - values = [ - 'beep', - 'boop', - 'foo', - 'bar', - true, - false - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( sameKindCasts( values[ i ] ), null, 'returns expected value when provided '+values[ i ] ); - } - t.end(); -});