How to use the pinkie-promise.all function in pinkie-promise

To help you get started, we’ve selected a few pinkie-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 root-systems / catstack / app / util / fetch-all-data.js View on Github external
export default function fetchAllData(components, getState, dispatch, location, params) {
  const fetchers = components
    .filter((component) => !!component) // Weed out 'undefined' routes
    .filter((component) => component.fetchData) // only look at ones with a static fetchData()
    .map((component) => component.fetchData) // pull out fetch data methods
    .map(fetchData => {
      return fetchData(getState, dispatch, location, params)
    }) // call fetch data methods and return promises

  return Promise.all(fetchers)
}
github tadatuta / betterc / lib / async.js View on Github external
function findAllConfigs(options) {
    var possibleFiles = possibleConfigs(options);

    return Promise.all(possibleFiles.map(fsHelpers.exists)).then(function(exists) {
        var realFiles = possibleFiles.filter(function(file, idx) {
            return exists[idx];
        });

        return Promise.all(realFiles.map(function(file) {
            var parsedConfig;

            try {
                parsedConfig = require(file);
                parsedConfig.__source = file;

                return Promise.resolve(parsedConfig);
            } catch (err) {
                return fsHelpers.read(file).then(function(content) {
                    parsedConfig = nodeEval('(' + content + ')');
github bem-tools / bem-tools-create / lib / create.js View on Github external
var defaultLevels = levelList.filter(function(level) {
                    return levelsMap[level].default;
                });

                var levelByCwd = levelList.filter(function(level) {
                    return cwd.indexOf(level) === 0;
                }).sort().reverse()[0];

                levels = levelByCwd || (defaultLevels.length ? defaultLevels : cwd);
            }

            Array.isArray(entities) || (entities = [entities]);
            Array.isArray(levels) || (levels = [levels]);

            return Promise.all(entities.map(function(input) {
                var isFileGlob = typeof input === 'string';

                return Promise.all((isFileGlob ? braceExpansion(input) : [input]).map(function(filepathOrInput) {
                    var currentLevels = levels;

                    if (typeof filepathOrInput === 'string') {
                        var currentLevel = path.dirname(filepathOrInput);
                        currentLevel !== '.' && (currentLevels = [currentLevel]);
                    }

                    return Promise.all(currentLevels.map(function(relLevel) {
                        var rootDir = config.rootSync() || cwd,
                            level = path.resolve(rootDir, relLevel);

                        return config.level(level).then(function(levelOptions) {
                            levelOptions || (levelOptions = {});
github kevva / xdg-empty-trash / index.js View on Github external
return pify(fs.readdir, Promise)(pth).then(function (files) {
				return Promise.all(files.map(function (file) {
					return pify(rimraf, Promise)(path.join(pth, file));
				}));
			});
		}));
github bencevans / screenshot-desktop / lib / utils.js View on Github external
.then((displays) => {
        const snapsP = displays
          .map(({ id }) => snapshot({ screen: id }))
        Promise.all(snapsP)
          .then(resolve)
          .catch(reject)
      })
      .catch(reject)
github tadatuta / betterc / lib / async.js View on Github external
return Promise.all(possibleFiles.map(fsHelpers.exists)).then(function(exists) {
        var realFiles = possibleFiles.filter(function(file, idx) {
            return exists[idx];
        });

        return Promise.all(realFiles.map(function(file) {
            var parsedConfig;

            try {
                parsedConfig = require(file);
                parsedConfig.__source = file;

                return Promise.resolve(parsedConfig);
            } catch (err) {
                return fsHelpers.read(file).then(function(content) {
                    parsedConfig = nodeEval('(' + content + ')');

                    parsedConfig.__source = file;
                    return parsedConfig;
                });
            }
        }));
github mattdesl / canvas-text / demo.js View on Github external
function loadFonts (fonts) {
  if (document.fonts && document.fonts.load) {
    return Promise.all(fonts.map(function (font) {
      return document.fonts.load(font)
    }))
  } else {
    return new Promise(function (resolve) {
      setTimeout(resolve, 500)
    })
  } 
}
github bem / bem-sdk / packages / config / index.js View on Github external
return this.get().then(function(config) {
        var projectLevels = config.levels || [],
            libNames = config.libs ? Object.keys(config.libs) : [],
            commonOpts = Object.keys(config)
                .filter(key => !specialKeys.has(key))
                .reduce((acc, key) => {
                    acc[key] = config[key];

                    return acc;
                }, {});

        return Promise.all(libNames.map(function(libName) {
            return _this.library(libName).then(function(bemLibConf) {
                return bemLibConf.get().then(function(libConfig) {
                    return libConfig.levels;
                });
            });
        })).then(function(libLevels) {
            var allLevels = [].concat.apply([], libLevels.filter(Boolean)).concat(projectLevels);

            return allLevels.reduce((res, lvl) => {
                res[lvl.path] = merge({}, commonOpts, res[lvl.path] || {}, lvl);
                return res;
            }, {});
        });
    });
};

pinkie-promise

ES2015 Promise ponyfill

MIT
Latest version published 9 years ago

Package Health Score

67 / 100
Full package analysis