How to use vow - 10 common examples

To help you get started, we’ve selected a few vow 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 jscs-dev / node-jscs / test / scripts / integration.js View on Github external
var spawn = require('child_process').spawn;
var chalk = require('chalk');
var vow = require('vow');
var vowFs = require('vow-fs');

var SOURCES = ['lib', 'test/specs'];
var MOCHA = 'node_modules/.bin/mocha';

/**
 * Applying passed presets to JSCS sources and tests, then executing tests.
 * So we can make sure nothing breaks during these reformatting actions.
 */
var presets = process.env.TEST_PRESET && vow.resolve(process.env.TEST_PRESET.split(','));

/**
 * Or applying every available preset if nothing passed and do the same.
 */
presets = presets || vowFs.listDir('./presets')
    .then(function(presetFilenames) {
        var presets = presetFilenames.map(function(presetFilename) {
            return presetFilename.replace('.json', '');
        });

        // List of rules that are not used in any of the default presets
        presets.unshift('./test/scripts/forgotten-rules.json');

        return presets;
    });
github bem-site / bem-forum / server / old / model_old.js View on Github external
initArchives: function (options) {
        var _this = this;

        return vow.all(options.languages
            .filter(function (lang) {
                return options.archive[lang];
            })
            .map(function (lang) {
                var archive = new Archive(options, lang);

                _this.archive[lang] = archive;
                return archive.init();
            }));
    },
github apsavin / bnsf / .bem / techs / vanilla.js.js View on Github external
_readYmlFileAndReplacePlaceholders: function (output, suffix, contentWrapper) {
        var path = output + suffix;
        return Vow.all([this._getConfig(output), this._readFile(path)])
            .spread(function (config, content) {
                for (var key in config) {
                    if (config.hasOwnProperty(key)) {
                        content = content.replace(new RegExp('%' + key + '%', 'g'), config[key]);
                    }
                }
                return {
                    path: path.replace('yml', 'js'),
                    content: contentWrapper.call(this, yml.safeLoad(content))
                };
            }, this);
    },
github bem-archive / bem-site-engine / src / scripts / data_compiler / index.js View on Github external
.spread(function(obj, docs, libraries, people) {
                return vow
                    .all([
                        addDynamicNodes(obj.sitemap, obj.routes, docs, people),
                        addLibraryNodes(obj.sitemap, obj.routes, obj.libraryNodes, libraries)
                    ]).spread(function(dynamic, libraries) {
                        return {
                            sitemap: removeCircularReferences(obj.sitemap),
                            routes: obj.routes,
                            docs: docs,
                            urls: dynamic,
                            people: people
                        };
                    });
            })
            .then(function(content) {
github bem-archive / bem-site-engine / src / cluster / updater.js View on Github external
removeFiles: function() {
                return vow.all([
                    providers.getProviderFile().exists({ path: dataTargetPath }),
                    providers.getProviderFile().exists({ path: sitemapTargetPath })
                ]).spread(function(dataExists, sitemapExists) {
                    var promises = [];
                    if(dataExists) {
                        promises.push(providers.getProviderFile().remove({ path: dataTargetPath }));
                    }
                    if(sitemapExists) {
                        promises.push(providers.getProviderFile().remove({ path: sitemapTargetPath }));
                    }
                    return vow.all(promises);
                });
            },
github bemhint / bemhint / lib / bemhint.js View on Github external
module.exports = function (targets, loadedConfig) {
    var config = new Configuration(loadedConfig);

    return vow.all([scan(targets, config), loadRules()])
        .spread(function (entities, rules) {
            return vow.all(Object.keys(rules).map(function (rule) {
                return new rules[rule]().check(entities);
            }));
        })
        .then(function (res) {
            return _(res)
                .flatten()
                .sortBy('path')
                .value();
        });
};
github bem-archive / bem-site-engine / src / blocks / server.blocks / middleware / __error / middleware__error.node.js View on Github external
return vow.all(langs.map(function (lang) {
            return vow.all([
                vowFs.read(path.join(errorBundlesPath, 'error-404', 'error-404.' + lang + '.html'), 'utf-8'),
                vowFs.read(path.join(errorBundlesPath, 'error-500', 'error-500.' + lang + '.html'), 'utf-8')
            ]).spread(function (error404, error500) {
                errorPages[lang] = {
                    error404: error404.replace(/\{STATICS_HOST\}/g, staticsUrl),
                    error500: error500.replace(/\{STATICS_HOST\}/g, staticsUrl)
                };
            });
        }))
        .then(function () {
github bem-site / bem-forum / server / services / orm.js View on Github external
ORM.prototype.getIssues = function (options) {
    options.page = options.page || DEFAULT.page;
    options.limit = options.per_page || DEFAULT.limit;

    var def = vow.defer();
    ORM.models.issue.find().paginate(options).exec(function(err, models) {
        err ? def.reject() : def.resolve(models);
    });
    return def.promise();
};
github bem-archive / bem-site-engine / src / blocks / server.blocks / provider / _type / provider_type_disk.node.js View on Github external
load: function (options) {
            logger.debug('read file %s from yandex disk', options.path);

            var def = vow.defer();
            disk.readFile(options.path, 'utf8', function (err, content) {
                if (err || !content) {
                    def.reject(err);
                }
                def.resolve(options.archive ? util.unzip(content) : content);
            });
            return def.promise();
        },
github bem-archive / bem-site-engine / src / data / providers / provider-ya-disk.js View on Github external
load: function (options) {
        logger.debug(util.format('load file from %s', options.path), module);
        var def = vow.defer();
        this.disk.readFile(options.path, 'utf8', function (err, content) {
            (err || !content) ? def.reject(err) : def.resolve(content);
        });
        return def.promise();
    },

vow

DOM Promise and Promises/A+ implementation for Node.js and browsers

MIT
Latest version published 5 years ago

Package Health Score

53 / 100
Full package analysis

Popular vow functions