How to use the comb.async function in comb

To help you get started, we’ve selected a few comb 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 C2FO / patio / lib / model.js View on Github external
var comb = require("comb"),
    asyncArray = comb.async.array,
    isFunction = comb.isFunction,
    isUndefined = comb.isUndefined,
    isDefined = comb.isDefined,
    isBoolean = comb.isBoolean,
    isString = comb.isString,
    argsToArray = comb.argsToArray,
    isInstanceOf = comb.isInstanceOf,
    isHash = comb.isHash,
    when = comb.when,
    merge = comb.merge,
    toArray = comb.array.toArray,
    ModelError = require("./errors").ModelError,
    plugins = require("./plugins"),
    isUndefinedOrNull = comb.isUndefinedOrNull,
    AssociationPlugin = plugins.AssociationPlugin,
    QueryPlugin = plugins.QueryPlugin,
github C2FO / patio / lib / adapters / mysql.js View on Github external
var mysql = require("mysql"),
    comb = require("comb"),
    hitch = comb.hitch,
    asyncArray = comb.async.array,
    define = comb.define,
    merge = comb.merge,
    string = comb.string,
    argsToArray = comb.argsToArray,
    format = string.format,
    Promise = comb.Promise,
    isString = comb.isString,
    array = comb.array,
    toArray = array.toArray,
    isArray = comb.isArray,
    isHash = comb.isHash,
    when = comb.when,
    isInstanceOf = comb.isInstanceOf,
    isFunction = comb.isFunction,
    isUndefinedOrNull = comb.isUndefinedOrNull,
    isUndefined = comb.isUndefined,
github doug-martin / super-request / index.js View on Github external
_parseExpect: function (res, body, promise) {
            var headers = res.headers;
            comb.async.array(this._expects).forEach(function (expect) {
                switch (expect[0]) {
                case "cookie":
                    //testing for cookies
                    var key = expect[1], val = expect[2], cookie = getCookie(key, this._jar, this._baseUrl);
                    if (comb.isUndefined(cookie)) {
                        throw new Error("expected cookie " + key + " to be present");
                    }
                    if (val) {
                        if (comb.isHash(val) && !comb.deepEqual(cookie, val)) {
                            throw new Error("expected cookie " + key + " to equal " + JSON.stringify(val) + "\n" + expect[3]);
                        } else if (cookie.value === val) {
                            throw new Error("expected cookie " + key + " value to equal " + val);
                        }
                    }
                    break;
                case "!cookie":
github C2FO / patio / lib / plugins / association.js View on Github external
var associations = require("../associations"),
    oneToMany = associations.oneToMany,
    manyToOne = associations.manyToOne,
    oneToOne = associations.oneToOne,
    manyToMany = associations.manyToMany,
    fetch = associations.fetch,
    comb = require("comb"),
    asyncArray = comb.async.array,
    Promise = comb.Promise,
    PromiseList = comb.PromiseList;

var RECIPROCAL_ASSOC = {
    "oneToOne": ["manyToOne"],
    "manyToOne": ["oneToMany", "oneToOne"],
    "oneToMany": ["manyToOne"],
    "manyToMany": ["manyToMany"]
};


exports.AssociationPlugin = comb.define(null, {

    instance: {
        /**@lends patio.Model.prototype*/
github doug-martin / grunt-link / tasks / lib / linker.js View on Github external
function exec(cmds) {
        if (!comb.isArray(cmds)) {
            cmds = [cmds];
        }
        return comb.async.array(cmds).forEach(function (cmd) {
            if (cmd) {
                log.debug(util.format("Executing %s %s", cmd.cmd, cmd.args.join(" ")));
                var child = execP(cmd.cmd, cmd.args, { stdio: "inherit" }),
                    ret = new comb.Promise();

                child.on("close", function (code) {
                    if (code !== 0) {
                        ret.errback(new Error("ps process exited with code " + code));
                    } else {
                        ret.callback();
                    }
                });
                child.on("error", ret.errback);
                return ret;
            }
        }, 1);
github C2FO / patio / example / associations / manyToMany.alternateJoinTable.example.js View on Github external
return comb.when(classDs.all(), studentDs.all()).chain(function (results) {
            //enroll the students
            var classes = results[0], students = results[1];
            return comb.async.array(students)
                .map(function (student, i) {
                    if (i === 0) {
                        return student.enroll(classes);
                    } else if (i < classes.length) {
                        return student.enroll(classes.slice(i));
                    }
                })
                .chain(function () {
                    return Student.save({
                        firstName: "Zach",
                        lastName: "Igor",
                        gpa: 2.754,
                        classYear: "Sophmore",
                        classes: [
                            {
                                semester: "FALL",
github C2FO / patio / lib / dataset / actions.js View on Github external
var comb = require("comb"),
    errors = require("../errors"),
    asyncArray = comb.async.array,
    NotImplemented = errors.NotImplemented,
    QueryError = errors.QueryError,
    sql = require("../sql").sql,
    Identifier = sql.Identifier,
    isUndefinedOrNull = comb.isUndefinedOrNull,
    argsToArray = comb.argsToArray,
    isFunction = comb.isFunction,
    isNumber = comb.isNumber,
    QualifiedIdentifier = sql.QualifiedIdentifier,
    AliasedExpression = sql.AliasedExpression,
    define = comb.define,
    isInstanceOf = comb.isInstanceOf,
    merge = comb.merge,
    isBoolean = comb.isBoolean,
    isString = comb.isString,
    flatten = comb.array.flatten,
github C2FO / patio / example / associations / manyToMany.example.js View on Github external
return comb.when(classDs.all(), studentDs.all()).chain(function (results) {
            //enroll the students
            var classes = results[0], students = results[1];
            return comb.async.array(students).map(function (student, i) {
                if (i === 0) {
                    return student.enroll(classes);
                } else if (i < classes.length) {
                    return student.enroll(classes.slice(i));
                }
            })
                .chain(function () {
                    return Student.save({
                        firstName: "Zach",
                        lastName: "Igor",
                        gpa: 2.754,
                        classYear: "Sophmore",
                        classes: [
                            {
                                semester: "FALL",
                                name: "Compiler Construction 2",
github C2FO / patio / example / associations / manyToMany.alternatePrimaryKeys.example.js View on Github external
return comb.when(classDs.all(), studentDs.all()).chain(function (results) {
            //enroll the students
            var classes = results[0], students = results[1];
            return comb.async.array(students)
                .map(function (student, i) {
                    if (i === 0) {
                        return student.enroll(classes);
                    } else if (i < classes.length) {
                        return student.enroll(classes.slice(i));
                    }
                })
                .chain(function () {
                    return Student.save({
                        firstName: "Zach",
                        lastName: "Igor",
                        gpa: 2.754,
                        classYear: "Sophmore",
                        classes: [
                            {
                                semester: "FALL",
github C2FO / patio / lib / plugins / inheritance.js View on Github external
var comb = require("comb"),
    asyncArray = comb.async,
    Promise = comb.Promise,
    PromiseList = comb.PromiseList;

comb.define(null, {
    instance: {},
    "static": {

        configure: function (model) {

        }
    }
}).as(exports, "SingleTableInheritance");


/**
 * @class This plugin enables