How to use the any-promise.all 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 ethereum / web3.js / packages / web3-eth-accounts / src / index.js View on Github external
callback(e);
            return Promise.reject(e);
        }

        callback(null, result);
        return result;
    }


    // Resolve immediately if nonce, chainId, price and signing options are provided
    if (tx.nonce !== undefined && tx.chainId !== undefined && tx.gasPrice !== undefined && hasTxSigningOptions) {
        return Promise.resolve(signed(tx));
    }

    // Otherwise, get the missing info from the Ethereum Node
    return Promise.all([
        isNot(tx.chainId) ? _this._ethereumCall.getChainId() : tx.chainId,
        isNot(tx.gasPrice) ? _this._ethereumCall.getGasPrice() : tx.gasPrice,
        isNot(tx.nonce) ? _this._ethereumCall.getTransactionCount(_this.privateKeyToAccount(privateKey).address) : tx.nonce,
        isNot(hasTxSigningOptions) ? _this._ethereumCall.getNetworkId() : 1
    ]).then(function(args) {
        if (isNot(args[0]) || isNot(args[1]) || isNot(args[2]) || isNot(args[3])) {
            throw new Error('One of the values "chainId", "networkId", "gasPrice", or "nonce" couldn\'t be fetched: ' + JSON.stringify(args));
        }
        return signed(_.extend(tx, {chainId: args[0], gasPrice: args[1], nonce: args[2], networkId: args[3]}));
    });
};
github SwellRT / swellrt / pad / node_modules / typings / node_modules / typings-core / dist / prune.js View on Github external
function rmDependency(options) {
    var path = options.path, emitter = options.emitter;
    var _a = path_2.getDependencyPath(options), directory = _a.directory, definition = _a.definition, config = _a.config;
    function remove(path) {
        return fs_1.isFile(path)
            .then(function (exists) {
            if (!exists) {
                emitter.emit('enoent', { path: path });
                return;
            }
            return fs_1.unlink(path);
        });
    }
    return Promise.all([
        remove(config),
        remove(definition)
    ])
        .then(function () { return fs_1.rmdirUntil(directory, path); });
}
exports.rmDependency = rmDependency;
github VadimDez / ng2-pdf-viewer / node_modules / typings-core / dist / lib / dependencies.js View on Github external
function resolveTypeDependencyMap(src, dependencies, options) {
    var cwd = path_1.dirname(src);
    var keys = Object.keys(dependencies);
    return Promise.all(keys.map(function (name) {
        var resolveOptions = extend(options, { name: name, cwd: cwd, dev: false, ambient: false, peer: false });
        return resolveDependency(parse_1.parseDependency(dependencies[name]), resolveOptions);
    }))
        .then(function (results) { return zipObject(keys, results); });
}
function checkCircularDependency(tree, filename) {
github SwellRT / swellrt / pad / node_modules / typings / node_modules / typings-core / dist / lib / dependencies.js View on Github external
function resolveAllDependencies(options) {
    return Promise.all([
        resolveBowerDependencies(options).catch(function () { return extend(exports.DEFAULT_DEPENDENCY); }),
        resolveNpmDependencies(options).catch(function () { return extend(exports.DEFAULT_DEPENDENCY); }),
        resolveTypeDependencies(options).catch(function () { return extend(exports.DEFAULT_DEPENDENCY); })
    ])
        .then(function (trees) { return mergeDependencies.apply(void 0, [exports.DEFAULT_DEPENDENCY].concat(trees)); });
}
exports.resolveAllDependencies = resolveAllDependencies;
github SwellRT / swellrt / pad / node_modules / typings / node_modules / typings-core / dist / prune.js View on Github external
function transformBundles(config, options) {
    var production = options.production;
    var resolutions = path_2.normalizeResolutions(config.resolution, options);
    var dependencies = extend(config.dependencies, config.peerDependencies, production ? {} : config.devDependencies);
    var globalDependencies = extend(config.globalDependencies, production ? {} : config.globalDevDependencies);
    return Promise.all(Object.keys(resolutions).map(function (type) {
        return transformBundle(resolutions[type], type, dependencies, globalDependencies, options);
    })).then(function () { return undefined; });
}
function transformBundle(path, resolution, dependencies, globalDependencies, options) {
github SwellRT / swellrt / pad / node_modules / typings / node_modules / typings-core / dist / lib / dependencies.js View on Github external
function resolveTypeDependencyMap(src, dependencies, options) {
    var cwd = path_1.dirname(src);
    var keys = Object.keys(dependencies);
    return Promise.all(keys.map(function (name) {
        var resolveOptions = extend(options, { name: name, cwd: cwd, dev: false, global: false, peer: false });
        return resolveDependency(parse_1.parseDependency(dependencies[name]), resolveOptions);
    }))
        .then(function (results) { return zipObject(keys, results); });
}
function checkCircularDependency(tree, filename) {
github VadimDez / ng2-pdf-viewer / node_modules / typings-core / dist / install.js View on Github external
.then(function (tree) {
        var cwd = path_1.dirname(tree.src);
        var queue = [];
        function addToQueue(deps, ambient) {
            for (var _i = 0, _a = Object.keys(deps); _i < _a.length; _i++) {
                var name = _a[_i];
                var tree_1 = deps[name];
                queue.push(compile_1.default(tree_1, { cwd: cwd, name: name, ambient: ambient, emitter: emitter, meta: true }));
            }
        }
        addToQueue(tree.dependencies, false);
        addToQueue(tree.devDependencies, false);
        addToQueue(tree.peerDependencies, false);
        addToQueue(tree.ambientDependencies, true);
        addToQueue(tree.ambientDevDependencies, true);
        return Promise.all(queue)
            .then(function (results) {
            return Promise.all(results.map(function (x) { return writeResult(x); }))
                .then(function () { return writeBundle(results, options); })
                .then(function () { return ({ tree: tree }); });
        });
    });
}
github VadimDez / ng2-pdf-viewer / node_modules / typings-core / dist / uninstall.js View on Github external
function uninstallFrom(name, options) {
    var cwd = options.cwd, ambient = options.ambient, emitter = options.emitter;
    var location = path_1.getDependencyLocation({ name: name, cwd: cwd, ambient: ambient });
    return Promise.all([
        fs_1.rmUntil(location.main, { cwd: cwd, emitter: emitter }),
        fs_1.rmUntil(location.browser, { cwd: cwd, emitter: emitter })
    ]);
}
function writeToConfig(names, options) {

any-promise

Resolve any installed ES6 compatible promise

MIT
Latest version published 9 years ago

Package Health Score

67 / 100
Full package analysis