-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js.map
7 lines (7 loc) · 5.88 KB
/
index.js.map
1
2
3
4
5
6
7
{
"version": 3,
"sources": ["../lib/main.js", "../lib/index.js"],
"sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar format = require( '@stdlib/string-format' );\n\n\n// MAIN //\n\n/**\n* Invokes a function until a test condition is true.\n*\n* @param {Function} predicate - function which indicates whether to continue invoking a function\n* @param {Function} fcn - function to invoke\n* @param {Callback} done - callback to invoke upon completion\n* @param {*} [thisArg] - execution context for the invoked function\n* @throws {TypeError} first argument must be a function\n* @throws {TypeError} second argument must be a function\n* @throws {TypeError} third argument must be a function\n*\n* @example\n* function predicate( i, clbk ) {\n* clbk( null, i >= 5 );\n* }\n*\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* console.log( 'beep: %d', i );\n* next();\n* }\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* untilAsync( predicate, fcn, done );\n*/\nfunction untilAsync( predicate, fcn, done, thisArg ) {\n\tvar args;\n\tvar idx;\n\tif ( !isFunction( predicate ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a function. Value: `%s`.', predicate ) );\n\t}\n\tif ( !isFunction( fcn ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fcn ) );\n\t}\n\tif ( !isFunction( done ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a function. Value: `%s`.', done ) );\n\t}\n\targs = [];\n\tidx = 0;\n\tpredicate( idx, onPredicate );\n\n\t/**\n\t* Callback invoked upon a predicate result.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {boolean} result - predicate result\n\t* @returns {void}\n\t*/\n\tfunction onPredicate( error, result ) {\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tif ( !result ) {\n\t\t\treturn fcn.call( thisArg, idx, next );\n\t\t}\n\t\tif ( args.length ) {\n\t\t\targs.unshift( null ); // error argument\n\t\t}\n\t\tdone.apply( null, args );\n\t}\n\n\t/**\n\t* Callback invoked upon completion of a provided function.\n\t*\n\t* @private\n\t* @param {(Error|null)} error - error object\n\t* @param {...*} results - function results\n\t* @returns {void}\n\t*/\n\tfunction next( error ) {\n\t\tvar i;\n\t\tif ( error ) {\n\t\t\treturn done( error );\n\t\t}\n\t\tidx += 1;\n\n\t\t// Cache the most recent results...\n\t\tif ( arguments.length > 1 ) {\n\t\t\targs = new Array( arguments.length-1 );\n\t\t\tfor ( i = 1; i < arguments.length; i++ ) {\n\t\t\t\targs[ i-1 ] = arguments[ i ];\n\t\t\t}\n\t\t}\n\t\t// Run the test condition:\n\t\tpredicate( idx, onPredicate );\n\t}\n}\n\n\n// EXPORTS //\n\nmodule.exports = untilAsync;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2018 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Invoke a function until a test condition is true.\n*\n* @module @stdlib/utils-async-until\n*\n* @example\n* var untilAsync = require( '@stdlib/utils-async-until' );\n*\n* function predicate( i, clbk ) {\n* clbk( null, i >= 5 );\n* }\n*\n* function fcn( i, next ) {\n* setTimeout( onTimeout, i );\n* function onTimeout() {\n* console.log( 'beep: %d', i );\n* next();\n* }\n* }\n*\n* function done( error ) {\n* if ( error ) {\n* throw error;\n* }\n* }\n*\n* untilAsync( predicate, fcn, 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,EAqC9C,SAASC,EAAYC,EAAWC,EAAKC,EAAMC,EAAU,CACpD,IAAIC,EACAC,EACJ,GAAK,CAACR,EAAYG,CAAU,EAC3B,MAAM,IAAI,UAAWF,EAAQ,oEAAqEE,CAAU,CAAE,EAE/G,GAAK,CAACH,EAAYI,CAAI,EACrB,MAAM,IAAI,UAAWH,EAAQ,qEAAsEG,CAAI,CAAE,EAE1G,GAAK,CAACJ,EAAYK,CAAK,EACtB,MAAM,IAAI,UAAWJ,EAAQ,oEAAqEI,CAAK,CAAE,EAE1GE,EAAO,CAAC,EACRC,EAAM,EACNL,EAAWK,EAAKC,CAAY,EAU5B,SAASA,EAAaC,EAAOC,EAAS,CACrC,GAAKD,EACJ,OAAOL,EAAMK,CAAM,EAEpB,GAAK,CAACC,EACL,OAAOP,EAAI,KAAME,EAASE,EAAKI,CAAK,EAEhCL,EAAK,QACTA,EAAK,QAAS,IAAK,EAEpBF,EAAK,MAAO,KAAME,CAAK,CACxB,CAUA,SAASK,EAAMF,EAAQ,CACtB,IAAIG,EACJ,GAAKH,EACJ,OAAOL,EAAMK,CAAM,EAKpB,GAHAF,GAAO,EAGF,UAAU,OAAS,EAEvB,IADAD,EAAO,IAAI,MAAO,UAAU,OAAO,CAAE,EAC/BM,EAAI,EAAGA,EAAI,UAAU,OAAQA,IAClCN,EAAMM,EAAE,CAAE,EAAI,UAAWA,CAAE,EAI7BV,EAAWK,EAAKC,CAAY,CAC7B,CACD,CAKAV,EAAO,QAAUG,IC5EjB,IAAIY,EAAO,IAKX,OAAO,QAAUA",
"names": ["require_main", "__commonJSMin", "exports", "module", "isFunction", "format", "untilAsync", "predicate", "fcn", "done", "thisArg", "args", "idx", "onPredicate", "error", "result", "next", "i", "main"]
}