@bitty/insist
Version:
Insistently runs a callback and only resolves the promise when its result is truthy.
3 lines (2 loc) • 576 B
JavaScript
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e="undefined"!=typeof globalThis?globalThis:e||self).insist=n()}(this,function(){"use strict";return function e(n,t){return void 0===t&&(t=200),function(e){try{return Promise.resolve(e()).catch(function(){return!1})}catch(e){return Promise.resolve(!1)}}(n).then(function(o){if(!o)return function(e){return new Promise(function(n){return setTimeout(n,e)})}(t).then(function(){return e(n,t)})})}});
//# sourceMappingURL=insist.umd.min.js.map