How to use the any-promise.resolve function in any-promise

To help you get started, we’ve selected a few any-promise examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github VadimDez / ng2-pdf-viewer / node_modules / typings-core / dist / lib / compile.js View on Github external
function stringifyDependencyPath(path, options) {
    var resolved = getPath(path, options);
    var tree = options.tree, ambient = options.ambient, cwd = options.cwd, browser = options.browser, name = options.name, readFiles = options.readFiles, imported = options.imported, meta = options.meta, entry = options.entry, emitter = options.emitter;
    var importedPath = importPath(path, path_3.pathFromDefinition(path), options);
    if (has(imported, importedPath)) {
        return Promise.resolve(null);
    }
    imported[importedPath] = true;
    emitter.emit('compile', { name: name, path: path, tree: tree, browser: browser });
    function loadByModuleName(path) {
        var _a = getModuleNameParts(path, tree), moduleName = _a[0], modulePath = _a[1];
        var compileOptions = { cwd: cwd, browser: browser, readFiles: readFiles, imported: imported, emitter: emitter, name: moduleName, ambient: false, meta: meta };
        var stringifyOptions = cachedStringifyOptions(moduleName, compileOptions, options);
        if (!stringifyOptions) {
            return Promise.resolve(null);
        }
        return compileDependencyPath(modulePath, stringifyOptions);
    }
    if (path_3.isModuleName(resolved)) {
        return loadByModuleName(resolved);
    }
    return cachedReadFileFrom(resolved, options)
github kevinbeaty / underarm / build / underarm.nolodash.js View on Github external
Delay.prototype.init = function(){
  var self = this,
      task = self.task;
  if(task.resolved){
    return task.resolved;
  }

  return Prom
    .resolve(self.xf.init());
};
Delay.prototype.step = function(value, input) {
github ranjithprabhuk / ng2-Dashboard / node_modules / typings-core / dist / utils / fs.js View on Github external
function rmdirUntil(path, until) {
    if (path === until) {
        return Promise.resolve();
    }
    return exports.readdir(path)
        .then(function (files) {
        if (files.length) {
            return;
        }
        return exports.rmdir(path)
            .then(function () { return rmdirUntil(path_1.dirname(path), until); });
    })
        .catch(function (err) {
        if (err.code === 'ENOENT') {
            return;
        }
        return Promise.reject(err);
    });
}
github VadimDez / ng2-pdf-viewer / node_modules / typings-core / dist / utils / fs.js View on Github external
function rmdirUntil(path, options) {
    if (path === options.cwd) {
        return Promise.resolve();
    }
    return exports.readdir(path)
        .then(function (files) {
        if (files.length) {
            return;
        }
        return exports.rmdir(path)
            .then(function () { return rmdirUntil(path_1.dirname(path), options); });
    })
        .catch(function (err) {
        if (err.code === 'ENOENT') {
            return;
        }
        return Promise.reject(err);
    });
}
github ranjithprabhuk / ng2-Dashboard / node_modules / typings-core / dist / install.js View on Github external
}
                }
                else if (options.savePeer) {
                    if (options.global) {
                        throw new TypeError('Unable to use `savePeer` with the `global` flag');
                    }
                    else {
                        config.peerDependencies = extend(config.peerDependencies, (_f = {}, _f[name] = raw, _f));
                    }
                }
            }
            return config;
            var _b, _c, _d, _e, _f;
        });
    }
    return Promise.resolve();
}
function writeBundle(results, options) {
github VadimDez / ng2-pdf-viewer / node_modules / popsicle / dist / index.js View on Github external
if (redirect === REDIRECT_TYPE.FOLLOW_WITH_GET) {
                            request.set('Content-Length', '0');
                            return get(newUrl, 'GET');
                        }
                        if (redirect === REDIRECT_TYPE.FOLLOW_WITH_CONFIRMATION) {
                            if (arg.method === 'GET' || arg.method === 'HEAD') {
                                return get(newUrl, method, body);
                            }
                            if (confirmRedirect(req, res)) {
                                return get(newUrl, method, body);
                            }
                        }
                    }
                    request.downloadLength = num(res.headers['content-length'], 0);
                    res.pipe(responseProxy);
                    return Promise.resolve({
                        body: responseProxy,
                        status: status,
                        statusText: res.statusMessage,
                        headers: res.headers,
                        rawHeaders: res.rawHeaders,
                        url: url
                    });
                }
                req.once('response', function (message) {
github SwellRT / swellrt / pad / node_modules / typings / node_modules / typings-core / dist / utils / fs.js View on Github external
return transformFile(path, function (contents) {
        var indent = contents ? detectIndent(contents).indent : undefined;
        var json = contents ? parseJson(stripBom(contents), path, allowEmpty) : undefined;
        var eol = contents ? path_2.detectEOL(contents) : undefined;
        return Promise.resolve(transform(json))
            .then(function (json) { return stringifyJson(json, indent, eol); });
    });
}
github SwellRT / swellrt / pad / node_modules / typings / node_modules / typings-core / dist / lib / compile.js View on Github external
function loadByModuleName(path) {
        var _a = getModuleNameParts(path, tree), moduleName = _a[0], modulePath = _a[1];
        var compileOptions = { cwd: cwd, resolution: resolution, readFiles: readFiles, imported: imported, emitter: emitter, name: moduleName, global: false, meta: meta };
        var stringifyOptions = cachedStringifyOptions(moduleName, compileOptions, options);
        if (!stringifyOptions) {
            return Promise.resolve(null);
        }
        return compileDependencyPath(modulePath, stringifyOptions, moduleOptions);
    }
    if (path_3.isModuleName(path)) {
github VadimDez / ng2-pdf-viewer / node_modules / popsicle / dist / request.js View on Github external
function chain(fns, arg) {
    return fns.reduce(function (p, fn) {
        return p.then(function () { return fn(arg); });
    }, Promise.resolve());
}
function emitProgress(request) {

any-promise

Resolve any installed ES6 compatible promise

MIT
Latest version published 9 years ago

Package Health Score

67 / 100
Full package analysis