From b66bcf2b57c78246433441c2385d04a7be02002e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Apr 2022 07:02:39 +0000 Subject: [PATCH 001/127] Auto-generated commit a2951364b6bea4e9d85d26142a39ffad1c9361c9 --- CONTRIBUTORS | 28 + LICENSE | 481 +++++++++ NOTICE | 1 + README.md | 301 ++++++ index.d.ts | 124 +++ index.mjs | 4 + index.mjs.map | 1 + package.json | 42 + stats.html | 2689 +++++++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 3671 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..cbae764 --- /dev/null +++ b/README.md @@ -0,0 +1,301 @@ + + +# funseqAsync + +[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url] + +> Function sequence. + + + +
+ +
+ + + + + + + +
+ +## Usage + +```javascript +import funseqAsync from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-async-function-sequence@esm/index.mjs'; +``` + +#### funseqAsync( ...fcn ) + +Returns a pipeline function. Starting from the left, the pipeline function evaluates each function and passes the result as the first argument to the next function. The result of the rightmost function is the result of the whole. + +```javascript +function a( x, next ) { + setTimeout( onTimeout, 0 ); + function onTimeout() { + next( null, 2*x ); + } +} + +function b( x, next ) { + setTimeout( onTimeout, 0 ); + function onTimeout() { + next( null, x+3 ); + } +} + +function c( x, next ) { + setTimeout( onTimeout, 0 ); + function onTimeout() { + next( null, x/5 ); + } +} + +var f = funseqAsync( a, b, c ); + +function done( error, result ) { + if ( error ) { + throw error; + } + console.log( result ); + // => 3 +} + +f( 6, done ); // ((2*x)+3)/5 +``` + +The last argument provided to each function is a `next` callback which accepts two arguments: + +- `error`: error argument +- `result`: function result + +**Only** the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as **binary** functions. + +```javascript +function a( x, y, next ) { + setTimeout( onTimeout, 0 ); + function onTimeout() { + next( null, (x*5) + (y*3) ); + } +} + +function b( r, next ) { + setTimeout( onTimeout, 0 ); + function onTimeout() { + next( null, r+12 ); + } +} + +var f = funseqAsync( a, b ); + +function done( error, result ) { + if ( error ) { + throw error; + } + console.log( result ); + // => 50 +} + +f( 4, 6, done ); +``` + +
+ + + + + +
+ +## Notes + +- The function will throw if provided fewer than `2` input arguments. +- If a provided function calls the `next` callback with a truthy `error` argument, the pipeline function suspends execution and immediately calls the `done` callback for subsequent `error` handling. +- Execution is **not** guaranteed to be asynchronous. To guarantee asynchrony, wrap the `done` callback in a function which either executes at the end of the current stack (e.g., `nextTick`) or during a subsequent turn of the event loop (e.g., `setImmediate`, `setTimeout`). +- The difference between this function and [`composeAsync`][@stdlib/utils/async/compose] is that this function evaluates input arguments from left-to-right, rather than right-to-left. + +
+ + + + + +
+ +## 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..ae5d6a1 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,124 @@ +/* +* @license Apache-2.0 +* +* Copyright (c) 2021 The Stdlib Authors. +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT 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 + +/** +* Callback invoked upon function completion. +*/ +type DoneNullary = () => void; + +/** +* Callback invoked upon function completion. +* +* @param error - error argument +*/ +type DoneUnary = ( error: Error | null ) => void; + +/** +* Callback invoked upon function completion. +* +* @param error - error argument +* @param result - function result +*/ +type DoneBinary = ( error: Error | null, result: any ) => void; + +/** +* Callback invoked upon function completion. +* +* @param error - error argument +* @param result - function result +*/ +type DoneCallback = DoneNullary | DoneUnary | DoneBinary; + +/** +* Binary function to compose. +* +* @param result - result +* @param next - invoked upon function completion +*/ +type BinaryFunction = ( result: any, next: DoneCallback ) => void; + +/** +* Function to compose. +* +* ## Notes +* +* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. +* +* @param args - arguments +* @param next - invoked upon function completion +*/ +type VariadicFunction = ( ...args: Array ) => void; + +/** +* Pipeline function. +* +* @param args - arguments +* @param done - callback to invoke after invoking all functions +*/ +type PipelineFunction = ( ...args: Array ) => void; + +/** +* Function sequence. +* +* @param f0 - first function to evaluate +* @param f1 - second function to evaluate +* @param f - remaining functions to evaluate in sequential order +* @returns pipeline function +* +* @example +* function a( x, next ) { +* setTimeout( onTimeout, 0 ); +* function onTimeout() { +* next( null, 2*x ); +* } +* } +* +* function b( x, next ) { +* setTimeout( onTimeout, 0 ); +* function onTimeout() { +* next( null, x+3 ); +* } +* } +* +* function c( x, next ) { +* setTimeout( onTimeout, 0 ); +* function onTimeout() { +* next( null, x/5 ); +* } +* } +* +* var f = funseqAsync( a, b, c ); +* +* function done( error, result ) { +* if ( error ) { +* throw error; +* } +* console.log( result ); +* // => 3 +* } +* +* f( 6, done ); +*/ +declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length + + +// EXPORTS // + +export = funseqAsync; diff --git a/index.mjs b/index.mjs new file mode 100644 index 0000000..625fa08 --- /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/assert-is-function@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@esm/index.mjs";var r=t,e=n;var i=function(){var t,n,i;if((t=arguments.length)<2)throw new Error("insufficient input arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(t),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient input arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar funseqAsync = require( './funseq_async.js' );\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n"],"names":["isFunction","require$$0","format","require$$1","lib","nFuncs","f","i","arguments","length","Error","Array","TypeError","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uKAsBA,IAAIA,EAAaC,EACbC,EAASC,EAmHb,ICrEAC,EDCA,WACC,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,0FAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdP,EAAYM,EAAGC,IACpB,MAAM,IAAIK,UAAWV,EAAQ,kEAAmEI,EAAGC,KAGrG,OAAOM,EASP,SAASA,IACR,IAAIC,EACAC,EACAR,EAOJ,IAJAO,EAAON,UAAWA,UAAUC,OAAO,GAGnCM,EAAO,IAAIJ,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIQ,EAAKN,OAAQF,IAC7BQ,EAAMR,GAAMC,UAAWD,GAiBxB,SAASS,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdV,GAAK,KACMF,EACHS,EAAM,KAAMI,QAEpBZ,EAAGC,GAAKW,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXV,EADAC,EAAI,GACGa,MAAO,KAAML"} \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..d55d015 --- /dev/null +++ b/package.json @@ -0,0 +1,42 @@ +{ + "name": "@stdlib/utils-async-function-sequence", + "version": "0.0.0", + "description": "Function sequence.", + "license": "Apache-2.0", + "type": "module", + "main": "./index.mjs", + "homepage": "https://stdlib.io", + "repository": { + "type": "git", + "url": "git://github.com/stdlib-js/utils-async-function-sequence.git" + }, + "bugs": { + "url": "https://github.com/stdlib-js/stdlib/issues" + }, + "keywords": [ + "stdlib", + "stdutils", + "stdutil", + "utilities", + "utils", + "util", + "asynchronous", + "async", + "sequence", + "seq", + "pipe", + "pipeline", + "pipelining", + "function", + "fun", + "funseq", + "func", + "fcn", + "functional", + "transform" + ], + "funding": { + "type": "patreon", + "url": "https://www.patreon.com/athan" + } +} diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..f160458 --- /dev/null +++ b/stats.html @@ -0,0 +1,2689 @@ + + + + + + + + RollUp Visualizer + + + +
+ + + + + From 1ddd9cb6b8843ed10b5e09a170e54b98dbf6ffac Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 30 Jun 2022 23:11:39 +0000 Subject: [PATCH 002/127] Transform error messages --- lib/funseq_async.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/funseq_async.js b/lib/funseq_async.js index 980e17c..e2d90ce 100644 --- a/lib/funseq_async.js +++ b/lib/funseq_async.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ffb9ce9..8836d91 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/string-format": "^0.0.x" + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/bench": "^0.0.x", From 6dd0f58c318a764a31f39ed5d43609b2ae597450 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 13:27:27 +0000 Subject: [PATCH 003/127] Remove files --- index.d.ts | 124 --- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2818 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 625fa08..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/assert-is-function@esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@esm/index.mjs";var r=t,e=n;var i=function(){var t,n,i;if((t=arguments.length)<2)throw new Error("insufficient input arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(t),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient input arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar funseqAsync = require( './funseq_async.js' );\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n"],"names":["isFunction","require$$0","format","require$$1","lib","nFuncs","f","i","arguments","length","Error","Array","TypeError","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uKAsBA,IAAIA,EAAaC,EACbC,EAASC,EAmHb,ICrEAC,EDCA,WACC,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,0FAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdP,EAAYM,EAAGC,IACpB,MAAM,IAAIK,UAAWV,EAAQ,kEAAmEI,EAAGC,KAGrG,OAAOM,EASP,SAASA,IACR,IAAIC,EACAC,EACAR,EAOJ,IAJAO,EAAON,UAAWA,UAAUC,OAAO,GAGnCM,EAAO,IAAIJ,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIQ,EAAKN,OAAQF,IAC7BQ,EAAMR,GAAMC,UAAWD,GAiBxB,SAASS,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdV,GAAK,KACMF,EACHS,EAAM,KAAMI,QAEpBZ,EAAGC,GAAKW,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXV,EADAC,EAAI,GACGa,MAAO,KAAML"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index f160458..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 21cb3948d99af91d1eac53fd33ff68678dfbbfb9 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 13:28:11 +0000 Subject: [PATCH 004/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/funseq_async.js | 139 -- lib/index.js | 70 - package.json | 55 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 298 --- 37 files changed, 2712 insertions(+), 3782 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 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/funseq_async.js delete mode 100644 lib/index.js create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7212d81..0000000 --- a/.gitattributes +++ /dev/null @@ -1,33 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 927728e..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-06-30T21:20:14.500Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4c7ce6e..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/utils/async/function-sequence" -click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..dfffa29 --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;gLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/lib/funseq_async.js b/lib/funseq_async.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/funseq_async.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b646bb..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var funseqAsync = require( './funseq_async.js' ); - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 8836d91..1531bbb 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-assert-is-nan": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/utils-noop": "^0.0.x", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..e84b86b --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From ea8b045d52e876bc1870aad7659b09e36da45368 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Jul 2022 16:45:40 +0000 Subject: [PATCH 005/127] Transform error messages --- lib/funseq_async.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/funseq_async.js b/lib/funseq_async.js index 980e17c..e2d90ce 100644 --- a/lib/funseq_async.js +++ b/lib/funseq_async.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ffb9ce9..8836d91 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/string-format": "^0.0.x" + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/bench": "^0.0.x", From bd432af33882f9bbb18e64d6f3b6e1e47383b53a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Jul 2022 04:00:49 +0000 Subject: [PATCH 006/127] Remove files --- index.d.ts | 124 --- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2818 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index dfffa29..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;gLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index e84b86b..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From f1bf5a81f32bf4c7af753129f1c275d8b0ef6669 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 2 Jul 2022 04:01:32 +0000 Subject: [PATCH 007/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/funseq_async.js | 139 -- lib/index.js | 70 - package.json | 55 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 298 --- 37 files changed, 2712 insertions(+), 3782 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 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/funseq_async.js delete mode 100644 lib/index.js create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7212d81..0000000 --- a/.gitattributes +++ /dev/null @@ -1,33 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 5595f12..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-07-01T00:42:47.090Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4c7ce6e..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/utils/async/function-sequence" -click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..dfffa29 --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;gLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/lib/funseq_async.js b/lib/funseq_async.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/funseq_async.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b646bb..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var funseqAsync = require( './funseq_async.js' ); - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 8836d91..1531bbb 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-assert-is-nan": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/utils-noop": "^0.0.x", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..3dc503b --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From cd0017a1d3ddb0f4944ab75683e53eebfd6a8fea Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 5 Jul 2022 12:57:50 +0000 Subject: [PATCH 008/127] Transform error messages --- lib/funseq_async.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/funseq_async.js b/lib/funseq_async.js index 980e17c..e2d90ce 100644 --- a/lib/funseq_async.js +++ b/lib/funseq_async.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ffb9ce9..8836d91 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/string-format": "^0.0.x" + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/bench": "^0.0.x", From 39cbe46197c0541c8420bb447e3191d5209136ce Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 5 Jul 2022 13:25:23 +0000 Subject: [PATCH 009/127] Remove files --- index.d.ts | 124 --- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2818 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index dfffa29..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;gLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 3dc503b..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From c24388045bb0cc33f4037f10891e16c23a3cc5a4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 5 Jul 2022 13:26:17 +0000 Subject: [PATCH 010/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/funseq_async.js | 139 -- lib/index.js | 70 - package.json | 55 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 298 --- 36 files changed, 2712 insertions(+), 3747 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 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/funseq_async.js delete mode 100644 lib/index.js create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7212d81..0000000 --- a/.gitattributes +++ /dev/null @@ -1,33 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4c7ce6e..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/utils/async/function-sequence" -click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..dfffa29 --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;gLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/lib/funseq_async.js b/lib/funseq_async.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/funseq_async.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b646bb..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var funseqAsync = require( './funseq_async.js' ); - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 8836d91..1531bbb 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-assert-is-nan": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/utils-noop": "^0.0.x", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4fc4f9e --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 9cb22a97fe608556c4222e81288e467f0c50899d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 03:24:31 +0000 Subject: [PATCH 011/127] Transform error messages --- lib/funseq_async.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/funseq_async.js b/lib/funseq_async.js index 980e17c..e2d90ce 100644 --- a/lib/funseq_async.js +++ b/lib/funseq_async.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ffb9ce9..8836d91 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/string-format": "^0.0.x" + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/bench": "^0.0.x", From 3813809e6e6770820e467b924824e416e26f4622 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 10:21:31 +0000 Subject: [PATCH 012/127] Remove files --- index.d.ts | 124 --- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2818 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index dfffa29..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;gLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4fc4f9e..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 6c8c5f37d4864f1f2c0dc80802cff3ce086c072f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Aug 2022 10:22:24 +0000 Subject: [PATCH 013/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/funseq_async.js | 139 -- lib/index.js | 70 - package.json | 55 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 298 --- 37 files changed, 2712 insertions(+), 3821 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 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/funseq_async.js delete mode 100644 lib/index.js create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 7212d81..0000000 --- a/.gitattributes +++ /dev/null @@ -1,33 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index e305821..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-08-01T00:46:05.895Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4c7ce6e..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/utils/async/function-sequence" -click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7abe06c --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/lib/funseq_async.js b/lib/funseq_async.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/funseq_async.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b646bb..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var funseqAsync = require( './funseq_async.js' ); - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 8836d91..1531bbb 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-assert-is-nan": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/utils-noop": "^0.0.x", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..8b5e1df --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From b751ff0828c5545767c96b74027fe9ef2009be92 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 03:15:09 +0000 Subject: [PATCH 014/127] Transform error messages --- lib/funseq_async.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/funseq_async.js b/lib/funseq_async.js index 980e17c..e2d90ce 100644 --- a/lib/funseq_async.js +++ b/lib/funseq_async.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ffb9ce9..8836d91 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/string-format": "^0.0.x" + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/bench": "^0.0.x", From 0182c78ba49ac632cddc4e22f0e4686f56863cba Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 10:06:57 +0000 Subject: [PATCH 015/127] Remove files --- index.d.ts | 124 --- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2818 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7abe06c..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 8b5e1df..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 3aa1049e94bf92e67d5a592ffc872b67e8917840 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Sep 2022 10:07:45 +0000 Subject: [PATCH 016/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/funseq_async.js | 139 -- lib/index.js | 70 - package.json | 55 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 298 --- 37 files changed, 2712 insertions(+), 3837 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 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/funseq_async.js delete mode 100644 lib/index.js create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 00811ab..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-09-01T00:41:33.578Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4c7ce6e..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/utils/async/function-sequence" -click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7abe06c --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/lib/funseq_async.js b/lib/funseq_async.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/funseq_async.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 1b646bb..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var funseqAsync = require( './funseq_async.js' ); - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 8836d91..1531bbb 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-assert-is-nan": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/utils-noop": "^0.0.x", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4308b1f --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 5166a4aac7b2dc3f9cf0d213efdcf020cddb7411 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 17 Sep 2022 19:28:38 +0000 Subject: [PATCH 017/127] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..e2d90ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ffb9ce9..8836d91 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/string-format": "^0.0.x" + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/bench": "^0.0.x", From d47527d50232c70c2824675f0bdbdde04c3aa929 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 17 Sep 2022 19:40:46 +0000 Subject: [PATCH 018/127] Remove files --- index.d.ts | 124 --- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2818 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7abe06c..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4308b1f..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From d8902bab7ae0be2e0787e2c800856d2b0559fd06 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 17 Sep 2022 19:41:36 +0000 Subject: [PATCH 019/127] Auto-generated commit --- .editorconfig | 181 -- .eslintrc.js | 1 - .gitattributes | 49 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 62 - .github/workflows/cancel.yml | 56 - .github/workflows/close_pull_requests.yml | 44 - .github/workflows/examples.yml | 62 - .github/workflows/npm_downloads.yml | 108 - .github/workflows/productionize.yml | 760 ------ .github/workflows/publish.yml | 117 - .github/workflows/test.yml | 92 - .github/workflows/test_bundles.yml | 180 -- .github/workflows/test_coverage.yml | 123 - .github/workflows/test_install.yml | 83 - .gitignore | 178 -- .npmignore | 227 -- .npmrc | 28 - CHANGELOG.md | 5 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 ---- README.md | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 -- package.json | 55 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 298 --- 36 files changed, 2712 insertions(+), 3836 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 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 create mode 100644 stats.html delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 0fd4d6c..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tslint.json` files: -[tslint.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 10a16e6..0000000 --- a/.gitattributes +++ /dev/null @@ -1,49 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/deps/** linguist-vendored=false -/lib/node_modules/** linguist-vendored=false linguist-generated=false -test/fixtures/** linguist-vendored=false -tools/** linguist-vendored=false - -# Override what is considered "documentation" by GitHub's linguist: -examples/** linguist-documentation=false diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4c7ce6e..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/utils/async/function-sequence" -click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7abe06c --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 8836d91..1531bbb 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-assert-is-nan": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/utils-noop": "^0.0.x", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..5148b0d --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 5605546c3205b102ef47b607abbed3a02eacc754 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 04:43:46 +0000 Subject: [PATCH 020/127] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..e2d90ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ffb9ce9..8836d91 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/string-format": "^0.0.x" + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/bench": "^0.0.x", From e6511f88b77f95f0f98c1c8013291b3e791c46ae Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 21:56:02 +0000 Subject: [PATCH 021/127] Remove files --- index.d.ts | 124 --- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2818 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7abe06c..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 5148b0d..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From bfb2035ef420534bd1ad68efb5a1c41908f06344 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Oct 2022 21:57:03 +0000 Subject: [PATCH 022/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 -- package.json | 55 +- stats.html | 2689 +++++++++++++++++++++ test/test.js | 298 --- 37 files changed, 2712 insertions(+), 3837 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 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 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 b8f7fc8..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-10-01T01:05:50.469Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4c7ce6e..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/utils/async/function-sequence" -click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7abe06c --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 8836d91..1531bbb 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-assert-is-nan": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/utils-noop": "^0.0.x", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..11bf039 --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 7c0395af094532c188b8d73e48ae2302e06590ed Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 03:21:03 +0000 Subject: [PATCH 023/127] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..e2d90ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ffb9ce9..8836d91 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/string-format": "^0.0.x" + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/bench": "^0.0.x", From dadee6c0a379374458ed12e367c6c4be27752136 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 16:54:54 +0000 Subject: [PATCH 024/127] Remove files --- index.d.ts | 124 --- index.mjs | 4 - index.mjs.map | 1 - stats.html | 2689 ------------------------------------------------- 4 files changed, 2818 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7abe06c..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,GAtBjBD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 11bf039..0000000 --- a/stats.html +++ /dev/null @@ -1,2689 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From b16146a93177362e58d77b0bee819593e3bebc35 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Nov 2022 16:55:48 +0000 Subject: [PATCH 025/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 298 -- 37 files changed, 4067 insertions(+), 3837 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 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 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 490ce88..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-11-01T00:52:34.650Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 f89b1b9..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: '45 9 * * 5' - - # 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4c7ce6e..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/utils/async/function-sequence" -click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7abe06c --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 8836d91..1531bbb 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-assert-is-nan": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/utils-noop": "^0.0.x", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..234494b --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From a21ebde8ed57de1ab248f68bed89695e95164b12 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 3 Nov 2022 21:00:44 +0000 Subject: [PATCH 026/127] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..e2d90ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ffb9ce9..8836d91 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/string-format": "^0.0.x" + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/bench": "^0.0.x", From 7183a78ed65bd8f52d8db2656e772a0bd0d05bb4 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 4 Nov 2022 09:31:25 +0000 Subject: [PATCH 027/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4044 ------------------------------------------------- 4 files changed, 4173 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7abe06c..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 234494b..0000000 --- a/stats.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From e336c6477b249680d4553baa56e2e7f5bbe55c25 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 4 Nov 2022 09:32:19 +0000 Subject: [PATCH 028/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 298 -- 37 files changed, 4067 insertions(+), 3858 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 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 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 cd086df..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-11-03T21:00:06.801Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 f89b1b9..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: '45 9 * * 5' - - # 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4c7ce6e..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/utils/async/function-sequence" -click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7abe06c --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 8836d91..1531bbb 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-assert-is-nan": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/utils-noop": "^0.0.x", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-spec": "5.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9b0c0d9 --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 6d69dd67fb53164d5c859288e979d8bc4da50cde Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 03:15:51 +0000 Subject: [PATCH 029/127] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..e2d90ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index a576c79..a42e095 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/string-format": "^0.0.x" + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/bench": "^0.0.x", From 441a0a777198b77eac0d9ef6d3ec76991d98bf7b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 13:19:56 +0000 Subject: [PATCH 030/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4044 ------------------------------------------------- 4 files changed, 4173 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7abe06c..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 9b0c0d9..0000000 --- a/stats.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From e7f954bd5e758a19c90ddbae0cd4ee625a915ade Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Dec 2022 13:20:44 +0000 Subject: [PATCH 031/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 298 -- 37 files changed, 4067 insertions(+), 3863 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 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 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 a6d08e7..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2022-12-01T00:51:04.983Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 f89b1b9..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: '45 9 * * 5' - - # 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2022. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4c7ce6e..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/utils/async/function-sequence" -click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7abe06c --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index a42e095..1531bbb 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-assert-is-nan": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/utils-noop": "^0.0.x", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "2.x.x" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..0b9100d --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 713b654ee771493fef960f6c3446d8ba1af903eb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Jan 2023 03:24:46 +0000 Subject: [PATCH 032/127] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..e2d90ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 7528141..f8d9587 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/string-format": "^0.0.x" + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/bench": "^0.0.x", From e957fdd0b8e741baba57a06fac94409eeb5b2407 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Jan 2023 11:06:54 +0000 Subject: [PATCH 033/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4044 ------------------------------------------------- 4 files changed, 4173 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7abe06c..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 0b9100d..0000000 --- a/stats.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From cc0d0e44483a5966cb5f9b1899d82b35830ac3eb Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Jan 2023 11:07:43 +0000 Subject: [PATCH 034/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 4044 +++++++++++++++++++++ test/test.js | 298 -- 37 files changed, 4067 insertions(+), 3874 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 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 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 17c7418..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-01-01T00:41:35.675Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 f89b1b9..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: '45 9 * * 5' - - # 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4c7ce6e..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/utils/async/function-sequence" -click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7c450cd --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index f8d9587..1531bbb 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-assert-is-nan": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/utils-noop": "^0.0.x", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..16104e3 --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 93fa7533f90f58fac9b223be6e54b52b17a33964 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 03:25:01 +0000 Subject: [PATCH 035/127] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..e2d90ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 7528141..f8d9587 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/string-format": "^0.0.x" + "@stdlib/error-tools-fmtprodmsg": "^0.0.x" }, "devDependencies": { "@stdlib/bench": "^0.0.x", From 0de1f538ef6be0a6ee737c70f03399fdfc849685 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 11:16:22 +0000 Subject: [PATCH 036/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4044 ------------------------------------------------- 4 files changed, 4173 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7c450cd..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 16104e3..0000000 --- a/stats.html +++ /dev/null @@ -1,4044 +0,0 @@ - - - - - - - - RollUp Visualizer - - - -
- - - - - From 6ee041a8d7828702304d41ecea516451e63c3c19 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Feb 2023 11:17:18 +0000 Subject: [PATCH 037/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 298 - 37 files changed, 6200 insertions(+), 3874 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 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 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 e454791..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-02-01T00:48:46.235Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 f89b1b9..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: '45 9 * * 5' - - # 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 4c7ce6e..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/utils/async/function-sequence" -click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7c450cd --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index f8d9587..1531bbb 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.x", - "@stdlib/error-tools-fmtprodmsg": "^0.0.x" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.x", - "@stdlib/math-base-assert-is-nan": "^0.0.x", - "@stdlib/random-base-randu": "^0.0.x", - "@stdlib/utils-noop": "^0.0.x", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..d7328a9 --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 4afcc91793951f109319dfbb62a77a6d85d5be8e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Mar 2023 01:42:15 +0000 Subject: [PATCH 038/127] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..e2d90ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 263d013..058f1bd 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/string-format": "^0.0.3" + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/bench": "^0.0.12", From 3f2e04acc96153e55ae97c3da96b7fcfdbbd11ed Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Mar 2023 04:08:48 +0000 Subject: [PATCH 039/127] Remove files --- index.d.ts | 124 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6306 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7c450cd..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index d7328a9..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 5ad00dbb9136a11e0d094aa30e251ec3ab15d06d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 Mar 2023 04:09:41 +0000 Subject: [PATCH 040/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 298 - 37 files changed, 6200 insertions(+), 4009 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 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 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 add19b8..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-03-01T01:10:55.809Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 f89b1b9..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: '45 9 * * 5' - - # 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 455162b..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7c450cd --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 058f1bd..13e79d1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-assert-is-nan": "^0.0.8", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/utils-noop": "^0.0.14", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..e1727b9 --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 326eb6125dfb6e22b9ef5aefe9e7dcb948b227f7 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Apr 2023 01:43:06 +0000 Subject: [PATCH 041/127] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..e2d90ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 263d013..058f1bd 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/string-format": "^0.0.3" + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/bench": "^0.0.12", From f8fed2315177072e188556f7f10dbf64df782937 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Apr 2023 03:44:07 +0000 Subject: [PATCH 042/127] Remove files --- index.d.ts | 124 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6306 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7c450cd..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index e1727b9..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 5e97ee10f74cbdb4beec69881c5f772e5115a371 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Apr 2023 03:45:05 +0000 Subject: [PATCH 043/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 298 - 37 files changed, 6200 insertions(+), 4015 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 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 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 4ab9b0b..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-04-01T01:12:15.269Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 f89b1b9..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: '45 9 * * 5' - - # 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 455162b..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7c450cd --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 058f1bd..13e79d1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-assert-is-nan": "^0.0.8", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/utils-noop": "^0.0.14", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..d640964 --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 823a41386f638bd43f9784c6dc940906e01deba1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 May 2023 01:41:46 +0000 Subject: [PATCH 044/127] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..e2d90ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 263d013..058f1bd 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/string-format": "^0.0.3" + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/bench": "^0.0.12", From 96a23e472ec768181fc1f0a4c9ef63f548f82f39 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 May 2023 03:45:10 +0000 Subject: [PATCH 045/127] Remove files --- index.d.ts | 124 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6306 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7c450cd..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index d640964..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From f11817fe7fc5687ca6484a9da7f145a2c55fc98c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 May 2023 03:46:07 +0000 Subject: [PATCH 046/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 298 - 37 files changed, 6200 insertions(+), 4015 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 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 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 d9d5a16..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-05-01T01:10:55.278Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 f89b1b9..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: '45 9 * * 5' - - # 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 455162b..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7c450cd --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 058f1bd..13e79d1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-assert-is-nan": "^0.0.8", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/utils-noop": "^0.0.14", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..98dac9e --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 85cfb207785ce40b8741e0d69fa0412fa8b21852 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Jun 2023 01:44:51 +0000 Subject: [PATCH 047/127] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..e2d90ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 263d013..058f1bd 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/string-format": "^0.0.3" + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/bench": "^0.0.12", From 621bab94adfcb10d9122515646a18043c56526fd Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Jun 2023 03:54:09 +0000 Subject: [PATCH 048/127] Remove files --- index.d.ts | 124 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6306 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7c450cd..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 98dac9e..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 17a126bac0051f9976b3bc3d5370bb626422bcfc Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Jun 2023 03:54:58 +0000 Subject: [PATCH 049/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 298 - 37 files changed, 6200 insertions(+), 4015 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 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 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 4e96ed0..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-06-01T01:14:10.441Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 f89b1b9..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: '45 9 * * 5' - - # 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 455162b..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7c450cd --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 058f1bd..13e79d1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-assert-is-nan": "^0.0.8", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/utils-noop": "^0.0.14", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..e095bf0 --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 66bf7fa941d63786e1ffb74dc22dcf6e7e7bd9b0 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jul 2023 01:45:15 +0000 Subject: [PATCH 050/127] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..e2d90ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 263d013..058f1bd 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/string-format": "^0.0.3" + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/bench": "^0.0.12", From 9e7a6921471a3e63ed20b33df2fcfa2a52b60c24 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jul 2023 04:01:08 +0000 Subject: [PATCH 051/127] Remove files --- index.d.ts | 124 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6306 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7c450cd..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index e095bf0..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 534a42a17f74435c2dc84005bbc66430e95f294d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jul 2023 04:02:01 +0000 Subject: [PATCH 052/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 298 - 37 files changed, 6200 insertions(+), 4015 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 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 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 9d75544..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-07-01T01:14:30.342Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 f89b1b9..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: '45 9 * * 5' - - # 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 455162b..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7c450cd --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 058f1bd..13e79d1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-assert-is-nan": "^0.0.8", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/utils-noop": "^0.0.14", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4a31139 --- /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 2d99ce0..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.equal( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 9735d753a6ca55c7cca4fb1c810ef09a7e0ead9d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Aug 2023 01:47:37 +0000 Subject: [PATCH 053/127] Transform error messages --- lib/main.js | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..e2d90ce 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -80,7 +80,7 @@ function funseqAsync() { for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '0iRBQ', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 263d013..058f1bd 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/string-format": "^0.0.3" + "@stdlib/error-tools-fmtprodmsg": "^0.0.2" }, "devDependencies": { "@stdlib/bench": "^0.0.12", From b67d170c4c715913f54481c6ffd2a43e2e626986 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Aug 2023 04:15:33 +0000 Subject: [PATCH 054/127] Remove files --- index.d.ts | 124 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6306 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7c450cd..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4a31139..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From c916ef08223a7d2c499749cb00cbdb8f7412d05c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Aug 2023 04:16:25 +0000 Subject: [PATCH 055/127] 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 | 39 +- benchmark/benchmark.js | 79 - branches.md | 53 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 6177 +++++++++++++++++++++ test/test.js | 298 - 37 files changed, 6200 insertions(+), 4015 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 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 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 7fec60b..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2023-08-01T01:14:02.074Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 74d8790..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 f89b1b9..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: '45 9 * * 5' - - # 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 + + ```
@@ -234,7 +227,7 @@ f( 5, 3, done ); ## 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]. @@ -294,13 +287,13 @@ Copyright © 2016-2023. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/tree/esm diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js deleted file mode 100644 index 2020775..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 455162b..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm \ No newline at end of file diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..7c450cd --- /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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index e2d90ce..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '0iRBQ', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 058f1bd..13e79d1 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.0.8", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.0.8", - "@stdlib/error-tools-fmtprodmsg": "^0.0.2" - }, - "devDependencies": { - "@stdlib/bench": "^0.0.12", - "@stdlib/math-base-assert-is-nan": "^0.0.8", - "@stdlib/random-base-randu": "^0.0.8", - "@stdlib/utils-noop": "^0.0.14", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..ba16b64 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 840e4ff82e3ebebca27283d0b99e329cbf1f6d2d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 01:42:35 +0000 Subject: [PATCH 056/127] Transform error messages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b4827cd..65ad1b4 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.1.1", - "@stdlib/string-format": "^0.1.1" + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.1.1", From 24ef6b10f7043d1c6d1bb2943860b824af14ec68 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 04:36:37 +0000 Subject: [PATCH 057/127] Remove files --- index.d.ts | 124 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6306 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 ae5d6a1..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; // tslint-disable-line max-line-length - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 7c450cd..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/assert-is-function@esm/index.mjs";import r from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.0.2-esm/index.mjs";function e(){var e,n,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(n=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '0iRBQ', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;uLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,QAASR,EAAGC,KAG3C,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index ba16b64..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From daf36a61cab5a63a1b89d14ecea80f30b2d2ee4c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jan 2024 04:36:57 +0000 Subject: [PATCH 058/127] 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 | 39 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 53 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 - 43 files changed, 6200 insertions(+), 4150 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 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 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 47feb53..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-01-01T01:03:48.288Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 e33a55c..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: '45 9 * * 5' - - # 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 + + ```
@@ -245,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -305,13 +298,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 455162b..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 90d1c93..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){ -var c=require('@stdlib/assert-is-function/dist'),v=require('@stdlib/error-tools-fmtprodmsg/dist');function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error(v('1RB1Z'));for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..886af99 --- /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/assert-is-function@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";function e(){var e,r,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;qLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,kEAAmER,EAAGC,KAGrG,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 980e17c..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 65ad1b4..c776ee2 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.1", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/random-base-randu": "^0.1.0", - "@stdlib/utils-noop": "^0.1.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..eea2f83 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 0b2fdf9dbde15da6d69b9376b07e82bc42cec7ad Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 01:43:23 +0000 Subject: [PATCH 059/127] Transform error messages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b4827cd..65ad1b4 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.1.1", - "@stdlib/string-format": "^0.1.1" + "@stdlib/error-tools-fmtprodmsg": "^0.1.1" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.1.1", From 46cd9dd44ae7ce0a2cb848f491a0cf5ad18179e6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 03:39:17 +0000 Subject: [PATCH 060/127] Remove files --- index.d.ts | 124 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6306 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 886af99..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/assert-is-function@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";function e(){var e,r,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;qLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,kEAAmER,EAAGC,KAGrG,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index eea2f83..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 0c5154dcf65290324c0fb70dc98e1d0db4e12843 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Feb 2024 03:39:39 +0000 Subject: [PATCH 061/127] 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 | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 - 43 files changed, 6200 insertions(+), 4155 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 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 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 5d5eec3..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-02-01T01:09:15.897Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 e33a55c..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 90d1c93..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){ -var c=require('@stdlib/assert-is-function/dist'),v=require('@stdlib/error-tools-fmtprodmsg/dist');function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error(v('1RB1Z'));for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..886af99 --- /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/assert-is-function@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";function e(){var e,r,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;qLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,kEAAmER,EAAGC,KAGrG,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 980e17c..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 65ad1b4..c776ee2 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.1.1", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.1.1", - "@stdlib/error-tools-fmtprodmsg": "^0.1.1" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/random-base-randu": "^0.1.0", - "@stdlib/utils-noop": "^0.1.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..a5ea38c --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 33500b07ff433d27015732c1b578623dad31a40b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 04:31:28 +0000 Subject: [PATCH 062/127] Transform error messages --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index accb11e..003ff08 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.0", - "@stdlib/string-format": "^0.2.0" + "@stdlib/error-tools-fmtprodmsg": "^0.2.0" }, "devDependencies": { "@stdlib/math-base-assert-is-nan": "^0.1.1", From 9f9cdeb2b478160a0914c287751f69756460d73a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 06:03:23 +0000 Subject: [PATCH 063/127] Remove files --- index.d.ts | 124 - index.mjs | 4 - index.mjs.map | 1 - stats.html | 6177 ------------------------------------------------- 4 files changed, 6306 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 886af99..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/assert-is-function@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";function e(){var e,r,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;qLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,kEAAmER,EAAGC,KAGrG,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index a5ea38c..0000000 --- a/stats.html +++ /dev/null @@ -1,6177 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 0aff2db2445ecb5f384a1b82731530a2a61ce418 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 06:03:45 +0000 Subject: [PATCH 064/127] 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 | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 6177 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 - 42 files changed, 6200 insertions(+), 4158 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 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 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 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 8869da9..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 90d1c93..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){ -var c=require('@stdlib/assert-is-function/dist'),v=require('@stdlib/error-tools-fmtprodmsg/dist');function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error(v('1RB1Z'));for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..886af99 --- /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/assert-is-function@v0.1.1-esm/index.mjs";import n from"https://cdn.jsdelivr.net/gh/stdlib-js/string-format@v0.1.1-esm/index.mjs";function e(){var e,r,i;if((e=arguments.length)<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),i=0;i 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","Array","isFunction","TypeError","format","pipeline","done","args","next","error","result","push","apply"],"mappings":";;qLAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAO,oFAGlB,IADAJ,EAAI,IAAIK,MAAON,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdK,EAAYN,EAAGC,IACpB,MAAM,IAAIM,UAAWC,EAAQ,kEAAmER,EAAGC,KAGrG,OAAOQ,EASP,SAASA,IACR,IAAIC,EACAC,EACAV,EAOJ,IAJAS,EAAOR,UAAWA,UAAUC,OAAO,GAGnCQ,EAAO,IAAIN,MAAOH,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIU,EAAKR,OAAQF,IAC7BU,EAAMV,GAAMC,UAAWD,GAiBxB,SAASW,EAAMC,EAAOC,GACrB,OAAKD,EACGH,EAAMG,IAEdZ,GAAK,KACMF,EACHW,EAAM,KAAMI,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,CAvBDD,EAAKI,KAAMH,GAIXZ,EADAC,EAAI,GACGe,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 980e17c..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 003ff08..40f7323 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.0", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.0", - "@stdlib/error-tools-fmtprodmsg": "^0.2.0" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.1.1", - "@stdlib/random-base-randu": "^0.1.0", - "@stdlib/utils-noop": "^0.2.0", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.1.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..c8426a4 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 43be42c7c7ff6f35d0428e2a4c0963afe3d7cb58 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 14 Feb 2024 07:34:26 +0000 Subject: [PATCH 065/127] 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 29dee95..68f646f 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import funseqAsync from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-async-function-sequence@esm/index.mjs'; +import funseqAsync from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-async-function-sequence@v0.2.0-esm/index.mjs'; ``` #### funseqAsync( ...fcn ) @@ -162,7 +162,7 @@ f( 4, 6, done ); - - - - From 9239dcb7b6efaf33e05d74daece4968e5af76b61 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 22 Feb 2024 02:10:23 +0000 Subject: [PATCH 069/127] 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 | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 55 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 42 files changed, 4865 insertions(+), 4152 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 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 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 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 90d1c93..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){ -var c=require('@stdlib/assert-is-function/dist'),v=require('@stdlib/error-tools-fmtprodmsg/dist');function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error(v('1RB1Z'));for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..5c23cd7 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index cb62bef..d1a322c 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,34 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.0", - "@stdlib/random-base-randu": "^0.2.0", - "@stdlib/utils-noop": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.0" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4812ebc --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 552bf9fa7021ca93c18644790fabcd3eb920f04b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 22 Feb 2024 02:48:11 +0000 Subject: [PATCH 070/127] 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 2b6cba7..7f9aab1 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import funseqAsync from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-async-function-sequence@esm/index.mjs'; +import funseqAsync from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-async-function-sequence@v0.2.1-esm/index.mjs'; ``` #### funseqAsync( ...fcn ) @@ -162,7 +162,7 @@ f( 4, 6, done ); - - - - From 4bacd18e5413d5a18aa4ed8381a27d80bb16361d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Mar 2024 02:39:21 +0000 Subject: [PATCH 074/127] 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 | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 43 files changed, 4865 insertions(+), 4155 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 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 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 143b66d..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-03-01T01:09:22.871Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 90d1c93..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){ -var c=require('@stdlib/assert-is-function/dist'),v=require('@stdlib/error-tools-fmtprodmsg/dist');function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error(v('1RB1Z'));for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..5c23cd7 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 7650ab2..d1a322c 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4812ebc --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 2ec8a34839f0755b95cb37d9d1f0e8ab9e61e15c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 01:20:54 +0000 Subject: [PATCH 075/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ced8750..7650ab2 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/string-format": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1", "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { From ac9e56d2843f20c73030b40e72ef8a961b981f95 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 02:46:37 +0000 Subject: [PATCH 076/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5c23cd7..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4812ebc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 115e34ae6fcc9f39a6fd4b000462c39462d5139c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Apr 2024 02:46:48 +0000 Subject: [PATCH 077/127] 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 | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 43 files changed, 4865 insertions(+), 4158 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 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 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 e5b930b..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-04-01T01:01:12.991Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 90d1c93..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){ -var c=require('@stdlib/assert-is-function/dist'),v=require('@stdlib/error-tools-fmtprodmsg/dist');function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error(v('1RB1Z'));for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..5c23cd7 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 7650ab2..d1a322c 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4812ebc --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 6cedf2374a33c677738632a535e0f3e38f664c28 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 11 Apr 2024 21:27:39 +0000 Subject: [PATCH 078/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ced8750..7650ab2 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/string-format": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1", "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { From 168cb5c8df5ce1053d03b8f2fbc1766c06321500 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 11 Apr 2024 22:42:56 +0000 Subject: [PATCH 079/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5c23cd7..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4812ebc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 062891d8017351b8147e36d1a5a552ed49a9261f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 11 Apr 2024 22:43:14 +0000 Subject: [PATCH 080/127] 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 | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 42 files changed, 4865 insertions(+), 4159 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 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 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 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 90d1c93..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){ -var c=require('@stdlib/assert-is-function/dist'),v=require('@stdlib/error-tools-fmtprodmsg/dist');function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error(v('1RB1Z'));for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..5c23cd7 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 7650ab2..d1a322c 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4812ebc --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From dbeca455ee1bcbe42f519e422ff4aa21eddba447 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 May 2024 01:22:47 +0000 Subject: [PATCH 081/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ced8750..7650ab2 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/string-format": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1", "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { From 89659b41d4b6363d82a6f50de514a090357fd380 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 May 2024 02:42:26 +0000 Subject: [PATCH 082/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5c23cd7..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4812ebc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From f02ac147db1842ea63d3cf60e36aa1d90a104555 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Wed, 1 May 2024 02:42:41 +0000 Subject: [PATCH 083/127] 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 | 248 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 43 files changed, 4865 insertions(+), 4167 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 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 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 d873100..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-05-01T01:01:48.544Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 90d1c93..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){ -var c=require('@stdlib/assert-is-function/dist'),v=require('@stdlib/error-tools-fmtprodmsg/dist');function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error(v('1RB1Z'));for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..5c23cd7 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 7650ab2..d1a322c 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4812ebc --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 3046940e84fd7d5bc1ef5f1f0d37d49848ffd26c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jun 2024 01:28:03 +0000 Subject: [PATCH 084/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ced8750..7650ab2 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/string-format": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1", "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { From a025bd124571d31fb842883c22254af5b37ef88a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jun 2024 02:37:29 +0000 Subject: [PATCH 085/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5c23cd7..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4812ebc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From da24e1c689743ab3fb73cab6e53aa22cebe23103 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 1 Jun 2024 02:37:45 +0000 Subject: [PATCH 086/127] 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 | 248 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 5 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 5 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 43 files changed, 4865 insertions(+), 4167 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 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 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 1530bfd..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-06-01T01:09:59.207Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index 90d1c93..0000000 --- a/dist/index.js +++ /dev/null @@ -1,5 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){ -var c=require('@stdlib/assert-is-function/dist'),v=require('@stdlib/error-tools-fmtprodmsg/dist');function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error(v('1RB1Z'));for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..5c23cd7 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 7650ab2..d1a322c 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4812ebc --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From aaf62259bbd3367e41a3d2dbfd3a50abf75109c6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jul 2024 01:26:42 +0000 Subject: [PATCH 087/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index ced8750..7650ab2 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/string-format": "^0.2.1", + "@stdlib/error-tools-fmtprodmsg": "^0.2.1", "@stdlib/error-tools-fmtprodmsg": "^0.2.1" }, "devDependencies": { From 9eea5a4258796152c1a0619d0aee5cdf87b9de1d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jul 2024 02:41:09 +0000 Subject: [PATCH 088/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5c23cd7..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4812ebc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 07ee8b89eae2607a357d4b924c95fc010495e145 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 1 Jul 2024 02:41:22 +0000 Subject: [PATCH 089/127] 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 | 188 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 38 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 43 files changed, 4865 insertions(+), 4218 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 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 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 99416b1..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-07-01T01:09:03.148Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a8a5815..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){"use strict";var c=require("@stdlib/assert-is-function"),v=require("@stdlib/string-format");function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..5c23cd7 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 7650ab2..d1a322c 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.1", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.1" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.1", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..4812ebc --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 1b9d9d86908cee08362e0378cfa4fad34a9ea9f6 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 27 Jul 2024 00:48:50 +0000 Subject: [PATCH 090/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index b924e85..ad4ace6 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { From 9beb204fffe5c309aca952df96dcbb5bc7d0b2e1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 27 Jul 2024 01:14:48 +0000 Subject: [PATCH 091/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 5c23cd7..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.1-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 4812ebc..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 893ec86d20cd09db3e2f6cb18fdbbeda28fa0eff Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 27 Jul 2024 01:15:02 +0000 Subject: [PATCH 092/127] 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 | 206 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 42 files changed, 4865 insertions(+), 4385 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 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 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 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a8a5815..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){"use strict";var c=require("@stdlib/assert-is-function"),v=require("@stdlib/string-format");function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..472a266 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.1-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index ad4ace6..55b4d81 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.1", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.1", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.1" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..2cc0530 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 37c9fcbbc3ce4d95d9e3124c1eb4d2f1b844891c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 27 Jul 2024 01:25:52 +0000 Subject: [PATCH 093/127] Update README.md for ESM bundle v0.2.2 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 076eec5..508fe8f 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,7 @@ limitations under the License. ## Usage ```javascript -import funseqAsync from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-async-function-sequence@esm/index.mjs'; +import funseqAsync from 'https://cdn.jsdelivr.net/gh/stdlib-js/utils-async-function-sequence@v0.2.2-esm/index.mjs'; ``` #### funseqAsync( ...fcn ) @@ -162,7 +162,7 @@ f( 4, 6, done ); - - - - From ad56780a758f257672dc1df81be4c436a940e927 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Thu, 1 Aug 2024 02:48:53 +0000 Subject: [PATCH 097/127] 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 | 168 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 43 files changed, 4865 insertions(+), 4350 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 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 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 416a273..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-01T01:11:28.725Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a8a5815..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){"use strict";var c=require("@stdlib/assert-is-function"),v=require("@stdlib/string-format");function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..6cb1915 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 5547183..55b4d81 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9b0bda5 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 4f27ada240b15e023e10280c70a43e6bc5cab21f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 3 Aug 2024 16:08:53 +0000 Subject: [PATCH 098/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 85a80de..5547183 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { From 3fdbc441b208ec97f51661a5f393d62eb1b65289 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 3 Aug 2024 16:58:03 +0000 Subject: [PATCH 099/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 6cb1915..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 9b0bda5..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From e93fab0e70210ffc68f68e0a22f5242c80d4c49d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 3 Aug 2024 16:58:18 +0000 Subject: [PATCH 100/127] 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 | 206 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 43 files changed, 4865 insertions(+), 4388 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 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 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 373a348..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-08-03T15:54:49.371Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a8a5815..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){"use strict";var c=require("@stdlib/assert-is-function"),v=require("@stdlib/string-format");function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..6cb1915 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 5547183..55b4d81 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9b0bda5 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 9b5cb7e04ac9ca52b3c837fe134c3d45b9e5fa9f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 01:37:29 +0000 Subject: [PATCH 101/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 85a80de..5547183 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { From 290fbda5f8dee90eac0949690f3f1e30e914af8d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 02:46:22 +0000 Subject: [PATCH 102/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 6cb1915..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 9b0bda5..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From bbf676d30d2c7f7da768284b4467ec64efa11f1f Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Sep 2024 02:46:38 +0000 Subject: [PATCH 103/127] 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 | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 43 files changed, 4865 insertions(+), 4387 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 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 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 840725b..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-09-01T01:18:11.844Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a8a5815..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){"use strict";var c=require("@stdlib/assert-is-function"),v=require("@stdlib/string-format");function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..6cb1915 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 5547183..55b4d81 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9b0bda5 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 2584cdb7ac9e7d0ffe59a908bdd2224e0e127e9c Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 17 Sep 2024 02:17:15 +0000 Subject: [PATCH 104/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 85a80de..5547183 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { From a86a3f87f90e6d20527696244c0fd971415961a1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 17 Sep 2024 02:27:29 +0000 Subject: [PATCH 105/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 6cb1915..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 9b0bda5..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 4e154229d4d4fdbc7df8764453dddd984dde9082 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 17 Sep 2024 02:27:43 +0000 Subject: [PATCH 106/127] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 239 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 42 files changed, 4865 insertions(+), 4420 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 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 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 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a8a5815..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){"use strict";var c=require("@stdlib/assert-is-function"),v=require("@stdlib/string-format");function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index 68e5be1..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - `error`: error argument - - `result`: function result - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..6cb1915 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 5547183..55b4d81 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9b0bda5 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 255b99cc0e9ee1300714eba18155e5456f14dcdf Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 21 Sep 2024 21:50:58 +0000 Subject: [PATCH 107/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 85a80de..5547183 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { From 371c6b91cdddd5149e5fe4207fde77957fd40c4a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 21 Sep 2024 22:20:25 +0000 Subject: [PATCH 108/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 6cb1915..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 9b0bda5..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 0f294aed9ea5ebb1c06228656229eb02b1f50e1a Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sat, 21 Sep 2024 22:20:46 +0000 Subject: [PATCH 109/127] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 ---- .github/workflows/publish.yml | 252 -- .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 240 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 42 files changed, 4865 insertions(+), 4421 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 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 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 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a8a5815..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){"use strict";var c=require("@stdlib/assert-is-function"),v=require("@stdlib/string-format");function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index aed7854..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - error: error argument. - - result: function result. - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..6cb1915 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 5547183..55b4d81 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9b0bda5 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From ec9dd529a0e0081553813f70b567b1764b28ae08 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 01:41:39 +0000 Subject: [PATCH 110/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 85a80de..5547183 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { From adb9dfe33caa90454ce04db2f101731e51f85a07 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 02:43:07 +0000 Subject: [PATCH 111/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 6cb1915..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 9b0bda5..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 3dd4e22cde139044713fd1fa4502b0e552504e9d Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Tue, 1 Oct 2024 02:43:20 +0000 Subject: [PATCH 112/127] 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 | 240 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 43 files changed, 4865 insertions(+), 4422 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 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 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 92be9a6..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-10-01T01:24:12.272Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a8a5815..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){"use strict";var c=require("@stdlib/assert-is-function"),v=require("@stdlib/string-format");function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index aed7854..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - error: error argument. - - result: function result. - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..6cb1915 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 5547183..55b4d81 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9b0bda5 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 1816791dcad32219b2243e6cec569bd283a849ab Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 01:37:33 +0000 Subject: [PATCH 113/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 85a80de..5547183 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { From c6f4d6aa112f06f84c73342c4feb8c7650812a27 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 02:33:50 +0000 Subject: [PATCH 114/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 6cb1915..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 9b0bda5..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 21bd988b60775400ec0b4cc6046941161da8b6aa Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Fri, 1 Nov 2024 02:34:06 +0000 Subject: [PATCH 115/127] 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 | 240 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 --- README.md | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 +++++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 43 files changed, 4865 insertions(+), 4422 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 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 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 f775dd5..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-11-01T01:20:44.549Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a8a5815..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){"use strict";var c=require("@stdlib/assert-is-function"),v=require("@stdlib/string-format");function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index aed7854..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - error: error argument. - - result: function result. - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..6cb1915 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 5547183..55b4d81 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9b0bda5 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From c4d70634ed7b95d06935c89497f767ad8a9aaa31 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 01:44:42 +0000 Subject: [PATCH 116/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 85a80de..5547183 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { From c64325bb6b8a79ade0e9952731ecc9a3e8006a5b Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 02:48:16 +0000 Subject: [PATCH 117/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 6cb1915..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 9b0bda5..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From a0aaf0378ec1e45cb2856abdd0a8d984fc41ecb1 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 1 Dec 2024 02:48:30 +0000 Subject: [PATCH 118/127] 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 | 240 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 41 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 44 files changed, 4865 insertions(+), 4527 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 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 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 e8f3a9f..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2024-12-01T01:26:54.735Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,13 +301,13 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a8a5815..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){"use strict";var c=require("@stdlib/assert-is-function"),v=require("@stdlib/string-format");function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index aed7854..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - error: error argument. - - result: function result. - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..6cb1915 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 5547183..55b4d81 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9b0bda5 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From 2b98ee00b399cdc9da1f682462ddb621360d90ef Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Dec 2024 22:36:30 +0000 Subject: [PATCH 119/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 85a80de..5547183 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { From 6d26f4a6cccfde6f85ed261089bd0352225fa249 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Dec 2024 22:43:21 +0000 Subject: [PATCH 120/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 6cb1915..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 9b0bda5..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From e19b974e1b0c22d11380678d7d8bcc86d53b3307 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 9 Dec 2024 22:43:35 +0000 Subject: [PATCH 121/127] Auto-generated commit --- .editorconfig | 181 - .eslintrc.js | 1 - .gitattributes | 66 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 241 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 39 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 43 files changed, 4864 insertions(+), 4526 deletions(-) delete mode 100644 .editorconfig delete mode 100644 .eslintrc.js delete mode 100644 .gitattributes delete mode 100644 .github/PULL_REQUEST_TEMPLATE.md delete mode 100644 .github/workflows/benchmark.yml delete mode 100644 .github/workflows/cancel.yml delete mode 100644 .github/workflows/close_pull_requests.yml delete mode 100644 .github/workflows/examples.yml delete mode 100644 .github/workflows/npm_downloads.yml delete mode 100644 .github/workflows/productionize.yml delete mode 100644 .github/workflows/publish.yml delete mode 100644 .github/workflows/test.yml delete mode 100644 .github/workflows/test_bundles.yml delete mode 100644 .github/workflows/test_coverage.yml delete mode 100644 .github/workflows/test_install.yml delete mode 100644 .github/workflows/test_published_package.yml delete mode 100644 .gitignore delete mode 100644 .npmignore delete mode 100644 .npmrc delete mode 100644 CHANGELOG.md delete mode 100644 CITATION.cff delete mode 100644 CODE_OF_CONDUCT.md delete mode 100644 CONTRIBUTING.md delete mode 100644 Makefile delete mode 100644 SECURITY.md delete mode 100644 benchmark/benchmark.js delete mode 100644 branches.md delete mode 100644 dist/index.d.ts delete mode 100644 dist/index.js delete mode 100644 dist/index.js.map delete mode 100644 docs/repl.txt delete mode 100644 docs/types/test.ts delete mode 100644 examples/index.js rename docs/types/index.d.ts => index.d.ts (100%) create mode 100644 index.mjs create mode 100644 index.mjs.map delete mode 100644 lib/index.js delete mode 100644 lib/main.js create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 60d743f..0000000 --- a/.editorconfig +++ /dev/null @@ -1,181 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 -insert_final_newline = false - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = false - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,11 +301,11 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a8a5815..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){"use strict";var c=require("@stdlib/assert-is-function"),v=require("@stdlib/string-format");function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index aed7854..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - error: error argument. - - result: function result. - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..6cb1915 --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 5547183..55b4d81 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9b0bda5 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From bb6037516edd11043d47f2a5d31ccd7495fbc463 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 2 Feb 2025 14:58:11 +0000 Subject: [PATCH 122/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 85a80de..5547183 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { From b34a6845338dcff7fda7619a4cda9d262ed1802e Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 2 Feb 2025 15:08:11 +0000 Subject: [PATCH 123/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 6cb1915..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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 9b0bda5..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From f2071cea0b2ed858d0e3cab313b136e35ce86333 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Sun, 2 Feb 2025 15:08:24 +0000 Subject: [PATCH 124/127] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 190 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 241 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 39 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 44 files changed, 4864 insertions(+), 4526 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 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 create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index 7ba69b8..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-02-02T14:55:26.670Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 3bf0c4a..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be 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 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,11 +301,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a8a5815..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){"use strict";var c=require("@stdlib/assert-is-function"),v=require("@stdlib/string-format");function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index aed7854..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - error: error argument. - - result: function result. - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..266289e --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 5547183..55b4d81 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9b0bda5 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -}); From b45b443509f349929053f2ed6906e8427943c252 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 23 Jun 2025 01:11:55 +0000 Subject: [PATCH 125/127] Transform error messages --- lib/main.js | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 980e17c..4f12390 100644 --- a/lib/main.js +++ b/lib/main.js @@ -21,7 +21,7 @@ // MODULES // var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/string-format' ); +var format = require( '@stdlib/error-tools-fmtprodmsg' ); // MAIN // @@ -74,13 +74,13 @@ function funseqAsync() { var i; nFuncs = arguments.length; if ( nFuncs < 2 ) { - throw new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' ); + throw new Error( format('1RB1Z') ); } f = new Array( nFuncs ); for ( i = 0; i < nFuncs; i++ ) { f[ i ] = arguments[ i ]; if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) ); + throw new TypeError( format( '1RBAj', f[ i ] ) ); } } return pipeline; diff --git a/package.json b/package.json index 85a80de..5547183 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ }, "dependencies": { "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/string-format": "^0.2.2", + "@stdlib/error-tools-fmtprodmsg": "^0.2.2", "@stdlib/error-tools-fmtprodmsg": "^0.2.2" }, "devDependencies": { From c5bdd666e309eceaa75bbc53048386fcd1a32248 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 23 Jun 2025 01:24:48 +0000 Subject: [PATCH 126/127] Remove files --- index.d.ts | 124 -- index.mjs | 4 - index.mjs.map | 1 - stats.html | 4842 ------------------------------------------------- 4 files changed, 4971 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 7b25c6e..0000000 --- a/index.d.ts +++ /dev/null @@ -1,124 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Callback invoked upon function completion. -*/ -type DoneNullary = () => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -*/ -type DoneUnary = ( error: Error | null ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneBinary = ( error: Error | null, result: any ) => void; - -/** -* Callback invoked upon function completion. -* -* @param error - error argument -* @param result - function result -*/ -type DoneCallback = DoneNullary | DoneUnary | DoneBinary; - -/** -* Binary function to compose. -* -* @param result - result -* @param next - invoked upon function completion -*/ -type BinaryFunction = ( result: any, next: DoneCallback ) => void; - -/** -* Function to compose. -* -* ## Notes -* -* - Only the leftmost function is explicitly permitted to accept multiple arguments. All other functions are evaluated as binary functions. -* -* @param args - arguments -* @param next - invoked upon function completion -*/ -type VariadicFunction = ( ...args: Array ) => void; - -/** -* Pipeline function. -* -* @param args - arguments -* @param done - callback to invoke after invoking all functions -*/ -type PipelineFunction = ( ...args: Array ) => void; - -/** -* Function sequence. -* -* @param f0 - first function to evaluate -* @param f1 - second function to evaluate -* @param f - remaining functions to evaluate in sequential order -* @returns pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -declare function funseqAsync( f0: VariadicFunction, f1: BinaryFunction, ...f: Array ): PipelineFunction; - - -// EXPORTS // - -export = funseqAsync; diff --git a/index.mjs b/index.mjs deleted file mode 100644 index 266289e..0000000 --- a/index.mjs +++ /dev/null @@ -1,4 +0,0 @@ -// Copyright (c) 2025 The Stdlib Authors. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0 -/// -import r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/stats.html b/stats.html deleted file mode 100644 index 9b0bda5..0000000 --- a/stats.html +++ /dev/null @@ -1,4842 +0,0 @@ - - - - - - - - Rollup Visualizer - - - -
- - - - - From 3b45c0557c4399fc3feadb12b71c36f1ca31c278 Mon Sep 17 00:00:00 2001 From: stdlib-bot Date: Mon, 23 Jun 2025 01:25:12 +0000 Subject: [PATCH 127/127] Auto-generated commit --- .editorconfig | 180 - .eslintrc.js | 1 - .gitattributes | 66 - .github/.keepalive | 1 - .github/PULL_REQUEST_TEMPLATE.md | 7 - .github/workflows/benchmark.yml | 64 - .github/workflows/cancel.yml | 57 - .github/workflows/close_pull_requests.yml | 54 - .github/workflows/examples.yml | 64 - .github/workflows/npm_downloads.yml | 112 - .github/workflows/productionize.yml | 794 --- .github/workflows/publish.yml | 252 - .github/workflows/test.yml | 99 - .github/workflows/test_bundles.yml | 186 - .github/workflows/test_coverage.yml | 133 - .github/workflows/test_install.yml | 85 - .github/workflows/test_published_package.yml | 105 - .gitignore | 194 - .npmignore | 229 - .npmrc | 31 - CHANGELOG.md | 241 - CITATION.cff | 30 - CODE_OF_CONDUCT.md | 3 - CONTRIBUTING.md | 3 - Makefile | 534 -- README.md | 39 +- SECURITY.md | 5 - benchmark/benchmark.js | 79 - branches.md | 56 - dist/index.d.ts | 3 - dist/index.js | 19 - dist/index.js.map | 7 - docs/repl.txt | 72 - docs/types/test.ts | 92 - examples/index.js | 54 - docs/types/index.d.ts => index.d.ts | 0 index.mjs | 4 + index.mjs.map | 1 + lib/index.js | 70 - lib/main.js | 139 - package.json | 56 +- stats.html | 4842 ++++++++++++++++++ test/dist/test.js | 33 - test/test.js | 298 -- 44 files changed, 4864 insertions(+), 4530 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 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 create mode 100644 stats.html delete mode 100644 test/dist/test.js delete mode 100644 test/test.js diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index dab5d2a..0000000 --- a/.editorconfig +++ /dev/null @@ -1,180 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# EditorConfig configuration file (see ). - -# Indicate that this file is a root-level configuration file: -root = true - -# Set properties for all files: -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true - -# Set properties for JavaScript files: -[*.{js,js.txt}] -indent_style = tab - -# Set properties for JavaScript ES module files: -[*.{mjs,mjs.txt}] -indent_style = tab - -# Set properties for JavaScript CommonJS files: -[*.{cjs,cjs.txt}] -indent_style = tab - -# Set properties for JSON files: -[*.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `cli_opts.json` files: -[cli_opts.json] -indent_style = tab - -# Set properties for TypeScript files: -[*.ts] -indent_style = tab - -# Set properties for Python files: -[*.{py,py.txt}] -indent_style = space -indent_size = 4 - -# Set properties for Julia files: -[*.{jl,jl.txt}] -indent_style = tab - -# Set properties for R files: -[*.{R,R.txt}] -indent_style = tab - -# Set properties for C files: -[*.{c,c.txt}] -indent_style = tab - -# Set properties for C header files: -[*.{h,h.txt}] -indent_style = tab - -# Set properties for C++ files: -[*.{cpp,cpp.txt}] -indent_style = tab - -# Set properties for C++ header files: -[*.{hpp,hpp.txt}] -indent_style = tab - -# Set properties for Fortran files: -[*.{f,f.txt}] -indent_style = space -indent_size = 2 - -# Set properties for shell files: -[*.{sh,sh.txt}] -indent_style = tab - -# Set properties for AWK files: -[*.{awk,awk.txt}] -indent_style = tab - -# Set properties for HTML files: -[*.{html,html.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for XML files: -[*.{xml,xml.txt}] -indent_style = tab -tab_width = 2 - -# Set properties for CSS files: -[*.{css,css.txt}] -indent_style = tab - -# Set properties for Makefiles: -[Makefile] -indent_style = tab - -[*.{mk,mk.txt}] -indent_style = tab - -# Set properties for Markdown files: -[*.{md,md.txt}] -indent_style = space -indent_size = 4 -trim_trailing_whitespace = true # Note: this disables using two spaces to force a hard line break, which is permitted in Markdown. As we don't typically follow that practice (TMK), we should be safe to automatically trim. - -# Set properties for `usage.txt` files: -[usage.txt] -indent_style = space -indent_size = 2 - -# Set properties for `repl.txt` files: -[repl.txt] -indent_style = space -indent_size = 4 - -# Set properties for `package.json` files: -[package.{json,json.txt}] -indent_style = space -indent_size = 2 - -# Set properties for `datapackage.json` files: -[datapackage.json] -indent_style = space -indent_size = 2 - -# Set properties for `manifest.json` files: -[manifest.json] -indent_style = space -indent_size = 2 - -# Set properties for `tsconfig.json` files: -[tsconfig.json] -indent_style = space -indent_size = 2 - -# Set properties for LaTeX files: -[*.{tex,tex.txt}] -indent_style = tab - -# Set properties for LaTeX Bibliography files: -[*.{bib,bib.txt}] -indent_style = tab - -# Set properties for YAML files: -[*.{yml,yml.txt}] -indent_style = space -indent_size = 2 - -# Set properties for GYP files: -[binding.gyp] -indent_style = space -indent_size = 2 - -[*.gypi] -indent_style = space -indent_size = 2 - -# Set properties for citation files: -[*.{cff,cff.txt}] -indent_style = space -indent_size = 2 diff --git a/.eslintrc.js b/.eslintrc.js deleted file mode 100644 index 5f30286..0000000 --- a/.eslintrc.js +++ /dev/null @@ -1 +0,0 @@ -/* For the `eslint` rules of this project, consult the main repository at https://github.com/stdlib-js/stdlib */ diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 1c88e69..0000000 --- a/.gitattributes +++ /dev/null @@ -1,66 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2017 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Configuration file which assigns attributes to pathnames. -# -# [1]: https://git-scm.com/docs/gitattributes - -# Automatically normalize the line endings of any committed text files: -* text=auto - -# Override line endings for certain files on checkout: -*.crlf.csv text eol=crlf - -# Denote that certain files are binary and should not be modified: -*.png binary -*.jpg binary -*.jpeg binary -*.gif binary -*.ico binary -*.gz binary -*.zip binary -*.7z binary -*.mp3 binary -*.mp4 binary -*.mov binary - -# Override what is considered "vendored" by GitHub's linguist: -/lib/node_modules/** -linguist-vendored -linguist-generated - -# Configure directories which should *not* be included in GitHub language statistics: -/deps/** linguist-vendored -/dist/** linguist-generated -/workshops/** linguist-vendored - -benchmark/** linguist-vendored -docs/* linguist-documentation -etc/** linguist-vendored -examples/** linguist-documentation -scripts/** linguist-vendored -test/** linguist-vendored -tools/** linguist-vendored - -# Configure files which should *not* be included in GitHub language statistics: -Makefile linguist-vendored -*.mk linguist-vendored -*.jl linguist-vendored -*.py linguist-vendored -*.R linguist-vendored - -# Configure files which should be included in GitHub language statistics: -docs/types/*.d.ts -linguist-documentation diff --git a/.github/.keepalive b/.github/.keepalive deleted file mode 100644 index d62dbfc..0000000 --- a/.github/.keepalive +++ /dev/null @@ -1 +0,0 @@ -2025-06-23T01:07:45.746Z diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index d4f1f95..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. - -If this is your first stdlib contribution, be sure to read the [contributing guide](https://github.com/stdlib-js/stdlib/blob/develop/CONTRIBUTING.md) which provides guidelines and instructions for submitting contributions. You may also consult the [development guide](https://github.com/stdlib-js/stdlib/blob/develop/docs/contributing/development.md) for help on developing stdlib. - -We look forward to receiving your contribution! :smiley: \ No newline at end of file diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index e4f10fe..0000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,64 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: benchmark - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to run benchmarks: - benchmark: - - # Define a display name: - name: 'Run benchmarks' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Define the sequence of job steps... - steps: - - # Checkout the repository: - - name: 'Checkout repository' - # Pin action to full length commit SHA - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0 - - # Install Node.js: - - name: 'Install Node.js' - # Pin action to full length commit SHA - uses: actions/setup-node@b39b52d1213e96004bfcb1c61a8a6fa8ab84f3e8 # v4.0.1 - with: - node-version: 20 - timeout-minutes: 5 - - # Install dependencies: - - name: 'Install production and development dependencies' - run: | - npm install || npm install || npm install - timeout-minutes: 15 - - # Run benchmarks: - - name: 'Run benchmarks' - run: | - npm run benchmark diff --git a/.github/workflows/cancel.yml b/.github/workflows/cancel.yml deleted file mode 100644 index b5291db..0000000 --- a/.github/workflows/cancel.yml +++ /dev/null @@ -1,57 +0,0 @@ -#/ -# @license Apache-2.0 -# -# Copyright (c) 2021 The Stdlib Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -#/ - -# Workflow name: -name: cancel - -# Workflow triggers: -on: - # Allow the workflow to be manually run: - workflow_dispatch: - -# Workflow jobs: -jobs: - - # Define a job to cancel existing workflow runs: - cancel: - - # Define a display name: - name: 'Cancel workflow runs' - - # Define the type of virtual host machine: - runs-on: 'ubuntu-latest' - - # Time limit: - timeout-minutes: 3 - - # Define the sequence of job steps... - steps: - - # Cancel existing workflow runs: - - name: 'Cancel existing workflow runs' - # Pin action to full length commit SHA - uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # v0.12.1 - with: - workflow_id: >- - benchmark.yml, - examples.yml, - test.yml, - test_coverage.yml, - test_install.yml, - publish.yml - access_token: ${{ github.token }} diff --git a/.github/workflows/close_pull_requests.yml b/.github/workflows/close_pull_requests.yml deleted file mode 100644 index 5f39cc6..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/utils/async/function-sequence) of the main repository where we’ll review and provide feedback. If this is your first stdlib contribution, be 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 31edc84..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: '45 9 * * 5' - - # 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 + + ```
@@ -247,7 +238,7 @@ f( 5, 3, done ); ## 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]. @@ -310,11 +301,11 @@ Copyright © 2016-2025. The Stdlib [Authors][stdlib-authors]. [stdlib-license]: https://raw.githubusercontent.com/stdlib-js/utils-async-function-sequence/main/LICENSE -[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose +[@stdlib/utils/async/compose]: https://github.com/stdlib-js/utils-async-compose/tree/esm -[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence +[@stdlib/utils/function-sequence]: https://github.com/stdlib-js/utils-function-sequence/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 00997e2..0000000 --- a/benchmark/benchmark.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench-harness' ); -var randu = require( '@stdlib/random-base-randu' ); -var isnan = require( '@stdlib/math-base-assert-is-nan' ); -var pkg = require( './../package.json' ).name; -var funseqAsync = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var f; - var i; - - f = funseqAsync( c, d, e ); - - i = 0; - b.tic(); - - return next(); - - function next( error, result ) { - i += 1; - if ( error ) { - b.fail( 'should not return an error' ); - } - if ( i <= b.iterations ) { - return f( randu()*100.0, next ); - } - b.toc(); - if ( isnan( result ) ) { - b.fail( 'should not return NaN' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } - - function c( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, 2.0*x ); - } - } - - function d( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x+3.0 ); - } - } - - function e( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x/5.0 ); - } - } -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index 137efb3..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/utils/async/function-sequence" -%% click B href "https://github.com/stdlib-js/utils-async-function-sequence/tree/main" -%% click C href "https://github.com/stdlib-js/utils-async-function-sequence/tree/production" -%% click D href "https://github.com/stdlib-js/utils-async-function-sequence/tree/esm" -%% click E href "https://github.com/stdlib-js/utils-async-function-sequence/tree/deno" -%% click F href "https://github.com/stdlib-js/utils-async-function-sequence/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/utils/async/function-sequence -[production-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/production -[deno-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/deno -[deno-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/umd -[umd-readme]: https://github.com/stdlib-js/utils-async-function-sequence/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/utils-async-function-sequence/tree/esm -[esm-readme]: https://github.com/stdlib-js/utils-async-function-sequence/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 cc45ced..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1,3 +0,0 @@ -/// -import funseqAsync from '../docs/types/index'; -export = funseqAsync; \ No newline at end of file diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index a8a5815..0000000 --- a/dist/index.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict";var m=function(e,r){return function(){return r||e((r={exports:{}}).exports,r),r.exports}};var f=m(function(y,o){"use strict";var c=require("@stdlib/assert-is-function"),v=require("@stdlib/string-format");function p(){var e,r,t;if(e=arguments.length,e<2)throw new Error("insufficient arguments. Must provide multiple functions to execute sequentially.");for(r=new Array(e),t=0;t 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide multiple functions to execute sequentially.' );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. All arguments must be functions. Value: `%s`.', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = funseqAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Function sequence.\n*\n* @module @stdlib/utils-async-function-sequence\n*\n* @example\n* var funseqAsync = require( '@stdlib/utils-async-function-sequence' );\n*\n* function a( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, 2*x );\n* }\n* }\n*\n* function b( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x+3 );\n* }\n* }\n*\n* function c( x, next ) {\n* setTimeout( onTimeout, 0 );\n* function onTimeout() {\n* next( null, x/5 );\n* }\n* }\n*\n* var f = funseqAsync( a, b, c );\n*\n* function done( error, result ) {\n* if ( error ) {\n* throw error;\n* }\n* console.log( result );\n* // => 3\n* }\n*\n* f( 6, done );\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"], - "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAa,QAAS,4BAA6B,EACnDC,EAAS,QAAS,uBAAwB,EA+C9C,SAASC,GAAc,CACtB,IAAIC,EACAC,EACAC,EAEJ,GADAF,EAAS,UAAU,OACdA,EAAS,EACb,MAAM,IAAI,MAAO,kFAAmF,EAGrG,IADAC,EAAI,IAAI,MAAOD,CAAO,EAChBE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,CAAE,EAAI,UAAWA,CAAE,EACjB,CAACL,EAAYI,EAAGC,CAAE,CAAE,EACxB,MAAM,IAAI,UAAWJ,EAAQ,kEAAmEG,EAAGC,CAAE,CAAE,CAAE,EAG3G,OAAOC,EASP,SAASA,GAAW,CACnB,IAAIC,EACAC,EACAH,EAOJ,IAJAE,EAAO,UAAW,UAAU,OAAO,CAAE,EAGrCC,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BH,EAAI,EAAGA,EAAIG,EAAK,OAAQH,IAC7BG,EAAMH,CAAE,EAAI,UAAWA,CAAE,EAG1BG,EAAK,KAAMC,CAAK,EAGhBJ,EAAI,EACJD,EAAGC,CAAE,EAAE,MAAO,KAAMG,CAAK,EAUzB,SAASC,EAAMC,EAAOC,EAAS,CAC9B,GAAKD,EACJ,OAAOH,EAAMG,CAAM,EAGpB,GADAL,GAAK,EACAA,IAAMF,EACV,OAAOI,EAAM,KAAMI,CAAO,EAE3BP,EAAGC,CAAE,EAAGM,EAAQF,CAAK,CACtB,CACD,CACD,CAKAV,EAAO,QAAUG,IC1EjB,IAAIU,EAAO,IAKX,OAAO,QAAUA", - "names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "funseqAsync", "nFuncs", "f", "i", "pipeline", "done", "args", "next", "error", "result", "main"] -} diff --git a/docs/repl.txt b/docs/repl.txt deleted file mode 100644 index aed7854..0000000 --- a/docs/repl.txt +++ /dev/null @@ -1,72 +0,0 @@ - -{{alias}}( ...fcn ) - Returns a pipeline function. - - Starting from the left, the pipeline function evaluates each function and - passes the result as the first argument of the next function. The result of - the rightmost function is the result of the whole. - - The last argument for each provided function is a `next` callback which - should be invoked upon function completion. The callback accepts two - arguments: - - - error: error argument. - - result: function result. - - If a provided function calls the `next` callback with a truthy `error` - argument, the pipeline function suspends execution and immediately calls the - `done` callback for subsequent `error` handling. - - Execution is *not* guaranteed to be asynchronous. To guarantee asynchrony, - wrap the `done` callback in a function which either executes at the end of - the current stack (e.g., `nextTick`) or during a subsequent turn of the - event loop (e.g., `setImmediate`, `setTimeout`). - - Only the leftmost function is explicitly permitted to accept multiple - arguments. All other functions are evaluated as binary functions. - - The function will throw if provided fewer than two input arguments. - - Parameters - ---------- - fcn: ...Function - Functions to evaluate in sequential order. - - Returns - ------- - out: Function - Pipeline function. - - Examples - -------- - > function a( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, 2*x ); - ... } - ... }; - > function b( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x+3 ); - ... } - ... }; - > function c( x, next ) { - ... setTimeout( onTimeout, 0 ); - ... function onTimeout() { - ... next( null, x/5 ); - ... } - ... }; - > var f = {{alias}}( a, b, c ); - > function done( error, result ) { - ... if ( error ) { - ... throw error; - ... } - ... console.log( result ); - ... }; - > f( 6, done ) - 3 - - See Also - -------- - diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index 60ecaa1..0000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,92 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 funseqAsync = require( './index' ); - -/** -* First function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const a = ( x: number, next: Function ): void => { - next( null, x * 2 ); -}; - -/** -* Second function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const b = ( x: number, next: Function ): void => { - next( null, x + 3 ); -}; - -/** -* Third function. -* -* @param x - result -* @param next - invoked upon function completion -*/ -const c = ( x: number, next: Function ): void => { - next( null, x / 5 ); -}; - - -// TESTS // - -// The function returns a pipeline function... -{ - funseqAsync( a, b, c ); // $ExpectType PipelineFunction -} - -// The compiler throws an error if the function is provided a first argument which is not a function... -{ - funseqAsync( '5' ); // $ExpectError - funseqAsync( 5 ); // $ExpectError - funseqAsync( true ); // $ExpectError - funseqAsync( false ); // $ExpectError - funseqAsync( null ); // $ExpectError - funseqAsync( undefined ); // $ExpectError - funseqAsync( [ 1, 2, 3 ] ); // $ExpectError - funseqAsync( {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided another argument which is not a function... -{ - funseqAsync( a, '5' ); // $ExpectError - funseqAsync( a, true ); // $ExpectError - funseqAsync( a, false ); // $ExpectError - funseqAsync( a, null ); // $ExpectError - funseqAsync( a, [] ); // $ExpectError - funseqAsync( a, {} ); // $ExpectError - - funseqAsync( a, b, '5' ); // $ExpectError - funseqAsync( a, b, true ); // $ExpectError - funseqAsync( a, b, false ); // $ExpectError - funseqAsync( a, b, null ); // $ExpectError - funseqAsync( a, b, [] ); // $ExpectError - funseqAsync( a, b, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - funseqAsync(); // $ExpectError - funseqAsync( a ); // $ExpectError -} diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index eece0e7..0000000 --- a/examples/index.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 funseqAsync = require( './../lib' ); - -function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } -} - -function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } -} - -function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } -} - -var f = funseqAsync( a, b, c ); - -function done( error, result ) { - if ( error ) { - throw error; - } - console.log( result ); - // => 2 -} - -f( 5, 3, done ); 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..266289e --- /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 r from"https://cdn.jsdelivr.net/gh/stdlib-js/assert-is-function@v0.2.2-esm/index.mjs";import t from"https://cdn.jsdelivr.net/gh/stdlib-js/error-tools-fmtprodmsg@v0.2.2-esm/index.mjs";function n(){var n,e,o;if((n=arguments.length)<2)throw new Error(t("1RB1Z"));for(e=new Array(n),o=0;o 3\n* }\n*\n* f( 6, done );\n*/\nfunction funseqAsync() {\n\tvar nFuncs;\n\tvar f;\n\tvar i;\n\tnFuncs = arguments.length;\n\tif ( nFuncs < 2 ) {\n\t\tthrow new Error( format('1RB1Z') );\n\t}\n\tf = new Array( nFuncs );\n\tfor ( i = 0; i < nFuncs; i++ ) {\n\t\tf[ i ] = arguments[ i ];\n\t\tif ( !isFunction( f[ i ] ) ) {\n\t\t\tthrow new TypeError( format( '1RBAj', f[ i ] ) );\n\t\t}\n\t}\n\treturn pipeline;\n\n\t/**\n\t* Pipeline function.\n\t*\n\t* @private\n\t* @param {...*} args - arguments\n\t* @param {Callback} done - callback to invoke after invoking all functions\n\t*/\n\tfunction pipeline() {\n\t\tvar done;\n\t\tvar args;\n\t\tvar i;\n\n\t\t// Cache the callback function:\n\t\tdone = arguments[ arguments.length-1 ];\n\n\t\t// Copy arguments which should be provided to the first invoked function...\n\t\targs = new Array( arguments.length-1 );\n\t\tfor ( i = 0; i < args.length; i++ ) {\n\t\t\targs[ i ] = arguments[ i ];\n\t\t}\n\t\t// Append the callback an invoked function should call upon completion:\n\t\targs.push( next );\n\n\t\t// Start invoking provided functions:\n\t\ti = 0;\n\t\tf[ i ].apply( null, args );\n\n\t\t/**\n\t\t* Callback invoked upon completion of a provided function.\n\t\t*\n\t\t* @private\n\t\t* @param {(Error|null)} error - error object\n\t\t* @param {*} result - result to pass to next function\n\t\t* @returns {void}\n\t\t*/\n\t\tfunction next( error, result ) {\n\t\t\tif ( error ) {\n\t\t\t\treturn done( error );\n\t\t\t}\n\t\t\ti += 1;\n\t\t\tif ( i === nFuncs ) {\n\t\t\t\treturn done( null, result );\n\t\t\t}\n\t\t\tf[ i ]( result, next );\n\t\t}\n\t}\n}\n\n\n// EXPORTS //\n\nexport default funseqAsync;\n"],"names":["funseqAsync","nFuncs","f","i","arguments","length","Error","format","Array","isFunction","TypeError","done","args","push","next","error","result","apply"],"mappings":";;8LAsEA,SAASA,IACR,IAAIC,EACAC,EACAC,EAEJ,IADAF,EAASG,UAAUC,QACL,EACb,MAAM,IAAIC,MAAOC,EAAO,UAGzB,IADAL,EAAI,IAAIM,MAAOP,GACTE,EAAI,EAAGA,EAAIF,EAAQE,IAExB,GADAD,EAAGC,GAAMC,UAAWD,IACdM,EAAYP,EAAGC,IACpB,MAAM,IAAIO,UAAWH,EAAQ,QAASL,EAAGC,KAG3C,OASA,WACC,IAAIQ,EACAC,EACAT,EAOJ,IAJAQ,EAAOP,UAAWA,UAAUC,OAAO,GAGnCO,EAAO,IAAIJ,MAAOJ,UAAUC,OAAO,GAC7BF,EAAI,EAAGA,EAAIS,EAAKP,OAAQF,IAC7BS,EAAMT,GAAMC,UAAWD,GAGxBS,EAAKC,MAcL,SAASC,EAAMC,EAAOC,GACrB,OAAKD,EACGJ,EAAMI,IAEdZ,GAAK,KACMF,EACHU,EAAM,KAAMK,QAEpBd,EAAGC,GAAKa,EAAQF,EAChB,IApBDX,EAAI,EACJD,EAAGC,GAAIc,MAAO,KAAML,EAoBpB,CACF"} \ No newline at end of file diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index 711430a..0000000 --- a/lib/index.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Function sequence. -* -* @module @stdlib/utils-async-function-sequence -* -* @example -* var funseqAsync = require( '@stdlib/utils-async-function-sequence' ); -* -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lib/main.js b/lib/main.js deleted file mode 100644 index 4f12390..0000000 --- a/lib/main.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert-is-function' ); -var format = require( '@stdlib/error-tools-fmtprodmsg' ); - - -// MAIN // - -/** -* Function sequence. -* -* @param {...Function} f - functions to evaluate in sequential order -* @throws {Error} must provide more than one argument -* @throws {TypeError} must provide functions -* @returns {Function} pipeline function -* -* @example -* function a( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, 2*x ); -* } -* } -* -* function b( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x+3 ); -* } -* } -* -* function c( x, next ) { -* setTimeout( onTimeout, 0 ); -* function onTimeout() { -* next( null, x/5 ); -* } -* } -* -* var f = funseqAsync( a, b, c ); -* -* function done( error, result ) { -* if ( error ) { -* throw error; -* } -* console.log( result ); -* // => 3 -* } -* -* f( 6, done ); -*/ -function funseqAsync() { - var nFuncs; - var f; - var i; - nFuncs = arguments.length; - if ( nFuncs < 2 ) { - throw new Error( format('1RB1Z') ); - } - f = new Array( nFuncs ); - for ( i = 0; i < nFuncs; i++ ) { - f[ i ] = arguments[ i ]; - if ( !isFunction( f[ i ] ) ) { - throw new TypeError( format( '1RBAj', f[ i ] ) ); - } - } - return pipeline; - - /** - * Pipeline function. - * - * @private - * @param {...*} args - arguments - * @param {Callback} done - callback to invoke after invoking all functions - */ - function pipeline() { - var done; - var args; - var i; - - // Cache the callback function: - done = arguments[ arguments.length-1 ]; - - // Copy arguments which should be provided to the first invoked function... - args = new Array( arguments.length-1 ); - for ( i = 0; i < args.length; i++ ) { - args[ i ] = arguments[ i ]; - } - // Append the callback an invoked function should call upon completion: - args.push( next ); - - // Start invoking provided functions: - i = 0; - f[ i ].apply( null, args ); - - /** - * Callback invoked upon completion of a provided function. - * - * @private - * @param {(Error|null)} error - error object - * @param {*} result - result to pass to next function - * @returns {void} - */ - function next( error, result ) { - if ( error ) { - return done( error ); - } - i += 1; - if ( i === nFuncs ) { - return done( null, result ); - } - f[ i ]( result, next ); - } - } -} - - -// EXPORTS // - -module.exports = funseqAsync; diff --git a/package.json b/package.json index 5547183..55b4d81 100644 --- a/package.json +++ b/package.json @@ -3,31 +3,8 @@ "version": "0.2.2", "description": "Function sequence.", "license": "Apache-2.0", - "author": { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - }, - "contributors": [ - { - "name": "The Stdlib Authors", - "url": "https://github.com/stdlib-js/stdlib/graphs/contributors" - } - ], - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": { - "test": "make test", - "test-cov": "make test-cov", - "examples": "make examples", - "benchmark": "make benchmark" - }, + "type": "module", + "main": "./index.mjs", "homepage": "https://stdlib.io", "repository": { "type": "git", @@ -36,35 +13,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/assert-is-function": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2", - "@stdlib/error-tools-fmtprodmsg": "^0.2.2" - }, - "devDependencies": { - "@stdlib/math-base-assert-is-nan": "^0.2.2", - "@stdlib/random-base-randu": "^0.2.1", - "@stdlib/utils-noop": "^0.2.2", - "tape": "git+https://github.com/kgryte/tape.git#fix/globby", - "istanbul": "^0.4.1", - "tap-min": "git+https://github.com/Planeshifter/tap-min.git", - "@stdlib/bench-harness": "^0.2.2" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "stdutils", diff --git a/stats.html b/stats.html new file mode 100644 index 0000000..9b0bda5 --- /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 dc63369..0000000 --- a/test/test.js +++ /dev/null @@ -1,298 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2018 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var noop = require( '@stdlib/utils-noop' ); -var funseqAsync = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof funseqAsync, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided multiple functions to execute sequentially', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.throws( bar, Error, 'throws an error' ); - t.end(); - - function foo() { - funseqAsync(); - } - - function bar() { - funseqAsync( noop ); - } -}); - -tape( 'the function throws an error if not provided a function', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - NaN, - null, - void 0, - true, - [], - {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue1( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue2( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - t.throws( badValue3( values[i] ), TypeError, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue1( value ) { - return function badValue() { - funseqAsync( value, noop ); - }; - } - - function badValue2( value ) { - return function badValue() { - funseqAsync( noop, value ); - }; - } - - function badValue3( value ) { - return function badValue() { - funseqAsync( noop, noop, value ); - }; - } -}); - -tape( 'the function returns a function', function test( t ) { - var fcn = funseqAsync( noop, noop ); - t.strictEqual( typeof fcn, 'function', 'returns a function' ); - t.end(); -}); - -tape( 'the function returns a pipeline function', function test( t ) { - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'the function supports providing a leftmost multi-parameter function', function test( t ) { - var f; - - function a( x, y, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, x*y ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - f( 5, 3, done ); - - function done( error, v ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( v, 2, 'returns pipeline result' ); - } - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 1, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, r/10 ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 2, 'invokes expected number of functions' ); - t.end(); - } -}); - -tape( 'if an error is encountered while invoking a provided function, the pipeline function suspends execution and immediately returns the error', function test( t ) { - var count; - var f; - - function a( x, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, x*3 ); - } - } - - function b( z, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( null, z+5 ); - } - } - - function c( r, next ) { - setTimeout( onTimeout, 0 ); - function onTimeout() { - count += 1; - next( new Error( 'beep' ) ); - } - } - - f = funseqAsync( a, b, c ); - count = 0; - f( 5, done ); - - function done( error ) { - if ( error ) { - t.pass( error.message ); - } else { - t.fail( 'should return an error' ); - } - t.strictEqual( count, 3, 'invokes expected number of functions' ); - t.end(); - } -});