How to use the comb.partial 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 / test / runner.js View on Github external
(function run(files) {
        var f = files.shift();
        if (f) {
            console.log("RUNNING %s", f);
            require(f).then(comb.partial(run, files), function(err){
                console.log(err);
                run(files);
            });
        } else {
            ret.callback();
        }
    })(files);
    return ret;
github C2FO / patio / benchmark / benchmark.js View on Github external
var printDurations = function (header, module, limit, durations) {
    console.log(header);
    var msg = "%-15s (%02s runs): Average duration % 8dms for %d items";
    for (var testName in durations) {
        if (testName !== "total") {
            console.log(format(msg, testName, durations.total, durations[testName] / durations.total), limit);
        }
    }
    module.disconnect();
};

console.log("Starting Benchmark...");
bench(noTransactions, "NO TRANSACTIONS MODEL", TIMES, LIMIT)
    .chain(comb.partial(printDurations, "NO TRANSACTIONS MODEL", noTransactions, LIMIT))
    .chain(comb.partial(bench, defaults, "DEFAULT MODEL", TIMES, LIMIT))
    .chain(comb.partial(printDurations, "DEFAULT MODEL", defaults, LIMIT))
    .chain(function () {
        console.log("DONE");
    }, defaults.disconnectErr);
github C2FO / patio / benchmark / benchmark.js View on Github external
var printDurations = function (header, module, limit, durations) {
    console.log(header);
    var msg = "%-15s (%02s runs): Average duration % 8dms for %d items";
    for (var testName in durations) {
        if (testName !== "total") {
            console.log(format(msg, testName, durations.total, durations[testName] / durations.total), limit);
        }
    }
    module.disconnect();
};

console.log("Starting Benchmark...");
bench(noTransactions, "NO TRANSACTIONS MODEL", TIMES, LIMIT)
    .chain(comb.partial(printDurations, "NO TRANSACTIONS MODEL", noTransactions, LIMIT))
    .chain(comb.partial(bench, defaults, "DEFAULT MODEL", TIMES, LIMIT))
    .chain(comb.partial(printDurations, "DEFAULT MODEL", defaults, LIMIT))
    .chain(function () {
        console.log("DONE");
    }, defaults.disconnectErr);
github C2FO / patio / example / associations / manyToMany.alternatePrimaryKeys.example.js View on Github external
name: "Compiler Construction 2",
                                subject: "Computer Science",
                                description: "More Assemblers, interpreters and compilers. Compilation of simple expressions and statements. "
                                    + "Analysis of regular expressions. Organization of a compiler, including compile-time and run-time "
                                    + "symbol tables, lexical scan, syntax scan, object code generation and error diagnostics."
                            },

                            {
                                semester: "FALL",
                                name: "Operating Systems",
                                subject: "Computer Science"
                            }
                        ]
                    });
                })
                .chain(comb.partial(printResults, studentDs, classDs));
        });
    }, disconnectError);
github C2FO / patio / benchmark / benchmark.js View on Github external
var loop = function (async, cb, limit) {
    var saves = [];
    limit = limit || LIMIT;
    for (var i = 0; i < limit; i++) {
        saves.push(async ? cb(i) : comb.partial(cb, i));
    }
    if (async) {
        saves = new comb.PromiseList(saves, true);
    }
    return async ? saves : comb.serial(saves);
};
github C2FO / patio / example / associations / manyToMany.example.js View on Github external
name: "Compiler Construction 2",
                                subject: "Computer Science",
                                description: "More Assemblers, interpreters and compilers. Compilation of simple expressions and statements. "
                                    + "Analysis of regular expressions. Organization of a compiler, including compile-time and run-time "
                                    + "symbol tables, lexical scan, syntax scan, object code generation and error diagnostics."
                            },

                            {
                                semester: "FALL",
                                name: "Operating Systems",
                                subject: "Computer Science"
                            }
                        ]
                    });
                })
                .chain(comb.partial(printResults, studentDs, classDs));
        });
    }, disconnectError);
github C2FO / patio / example / database / transaction.example.js View on Github external
});
};


var connectAndExecute = function (cb) {
    return connectAndCreateSchema()
        .chain(function (db) {
            return cb(db);
        })
        .chain(disconnect, disconnectError);
};

connectAndExecute(multipleTransactions)
    .chain(comb.partial(connectAndExecute, multipleTransactionsError), disconnectError)
    .chain(comb.partial(connectAndExecute, simpleTransaction), disconnectError)
    .chain(comb.partial(connectAndExecute, nestedTransaction), disconnectError)
    .chain(comb.partial(connectAndExecute, inOrderTransaction), disconnectError)
    .chain(comb.partial(connectAndExecute, errorTransaciton), disconnectError)
    .chain(comb.partial(connectAndExecute, errorCallbackTransaciton), disconnectError);
github C2FO / patio / example / database / transaction.example.js View on Github external
patio.logInfo(format("COUNT = " + count));
            });
        });
};


var connectAndExecute = function (cb) {
    return connectAndCreateSchema()
        .chain(function (db) {
            return cb(db);
        })
        .chain(disconnect, disconnectError);
};

connectAndExecute(multipleTransactions)
    .chain(comb.partial(connectAndExecute, multipleTransactionsError), disconnectError)
    .chain(comb.partial(connectAndExecute, simpleTransaction), disconnectError)
    .chain(comb.partial(connectAndExecute, nestedTransaction), disconnectError)
    .chain(comb.partial(connectAndExecute, inOrderTransaction), disconnectError)
    .chain(comb.partial(connectAndExecute, errorTransaciton), disconnectError)
    .chain(comb.partial(connectAndExecute, errorCallbackTransaciton), disconnectError);
github C2FO / patio / example / database / transaction.example.js View on Github external
};


var connectAndExecute = function (cb) {
    return connectAndCreateSchema()
        .chain(function (db) {
            return cb(db);
        })
        .chain(disconnect, disconnectError);
};

connectAndExecute(multipleTransactions)
    .chain(comb.partial(connectAndExecute, multipleTransactionsError), disconnectError)
    .chain(comb.partial(connectAndExecute, simpleTransaction), disconnectError)
    .chain(comb.partial(connectAndExecute, nestedTransaction), disconnectError)
    .chain(comb.partial(connectAndExecute, inOrderTransaction), disconnectError)
    .chain(comb.partial(connectAndExecute, errorTransaciton), disconnectError)
    .chain(comb.partial(connectAndExecute, errorCallbackTransaciton), disconnectError);
github C2FO / patio / example / database / transaction.example.js View on Github external
var connectAndExecute = function (cb) {
    return connectAndCreateSchema()
        .chain(function (db) {
            return cb(db);
        })
        .chain(disconnect, disconnectError);
};

connectAndExecute(multipleTransactions)
    .chain(comb.partial(connectAndExecute, multipleTransactionsError), disconnectError)
    .chain(comb.partial(connectAndExecute, simpleTransaction), disconnectError)
    .chain(comb.partial(connectAndExecute, nestedTransaction), disconnectError)
    .chain(comb.partial(connectAndExecute, inOrderTransaction), disconnectError)
    .chain(comb.partial(connectAndExecute, errorTransaciton), disconnectError)
    .chain(comb.partial(connectAndExecute, errorCallbackTransaciton), disconnectError);