How to use the comb.string 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
var fs = require("fs"), path = require("path"), exec = require("child_process").exec, sys = require("sys"), comb = require("comb"), string = comb.string;

/**
 * Coverage reporting based on https://github.com/visionmedia/expresso
 *
 * Copyright (c) 2010 TJ Holowaychuk 
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
 * documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
 * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
github C2FO / patio / example / database / transaction.example.js View on Github external
"use strict";
var patio = require("../../index"),
    sql = patio.sql,
    comb = require("comb"),
    format = comb.string.format;

patio.configureLogging();

//disconnect and error callback helpers
var disconnect = comb.hitch(patio, "disconnect");
var disconnectError = function (err) {
    patio.logError(err);
    return patio.disconnect();
};
patio.configureLogging();
var connectAndCreateSchema = function () {
    //This assumes new tables each time you could just connect to the database
    return patio.connectAndExecute("mysql://test:testpass@localhost:3306/sandbox",
        function (db, patio) {
            //drop and recreate the user
            db.forceCreateTable("user", function () {
github C2FO / patio / lib / dataset / sql.js View on Github external
var comb = require("comb"),
    define = comb.define,
    array = comb.array,
    toArray = array.toArray,
    intersect = array.intersect,
    compact = array.compact,
    string = comb.string,
    format = string.format,
    argsToArray = comb.argsToArray,
    isInstanceOf = comb.isInstanceOf,
    isArray = comb.isArray,
    isNumber = comb.isNumber,
    isDate = comb.isDate,
    isNull = comb.isNull,
    isBoolean = comb.isBoolean,
    isFunction = comb.isFunction,
    isUndefined = comb.isUndefined,
    isObject = comb.isObject,
    isHash = comb.isHash,
    isEmpty = comb.isEmpty,
    merge = comb.merge,
    hitch = comb.hitch,
    isUndefinedOrNull = comb.isUndefinedOrNull,
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,
    isEmpty = comb.isEmpty,
    QueryError = require("../errors").QueryError,
    Dataset = require("../dataset"),
github C2FO / patio / benchmark / benchmark.js View on Github external
var server = "pg://postgres@127.0.0.1:5432/sandbox?maxConnections=10",
    patio = require("../index"),
    TIMES = parseInt(process.env.TIMES || 2),
    LIMIT = parseInt(process.env.LIMIT || 1000),
    comb = require("comb"),
    format = comb.string.format,
    noTransactions = require("./benchmark.noTransacitons"),
    defaults = require("./benchmark.defaults");

patio.camelize = true;


var Entry;
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);
    }
github C2FO / patio / example / associations / manyToMany.alternatePrimaryKeys.example.js View on Github external
var patio = require("../../index"), sql = patio.sql, comb = require("comb"), format = comb.string.format;

patio.camelize = true;

patio.configureLogging();
var DB = patio.connect("mysql://test:testpass@localhost:3306/sandbox");

var disconnect = comb.hitch(patio, "disconnect");
var disconnectError = function (err) {
    patio.logError(err);
    patio.disconnect();
};
debugger;
var Class = patio.addModel("class", {
    static: {
        init: function () {
            this._super(arguments);
github C2FO / patio / example / model.basic.example.js View on Github external
"use strict";
var patio = require("../index"),
    sql = patio.sql,
    comb = require("comb"),
    format = comb.string.format;

patio.camelize = true;
var DB = patio.connect("mysql://test:testpass@localhost:3306/sandbox");
//disconnect and error callback helpers
patio.configureLogging();
var disconnect = function () {
    return patio.disconnect();
};
var disconnectError = function (err) {
    patio.logError(err);
    patio.disconnect();
};

var User = patio.addModel("user", {
    pre: {
        "save": function (next) {
github C2FO / patio / lib / database / index.js View on Github external
var comb = require("comb"),
    format = comb.string.format,
    merge = comb.merge,
    hitch = comb.hitch,
    isNull = comb.isNull,
    define = comb.define,
    isBoolean = comb.isBoolean,
    isUndefined = comb.isUndefined,
    isFunction = comb.isFunction,
    isString = comb.isString,
    isObject = comb.isObject,
    isDate = comb.isDate,
    isArray = Array.isArray,
    isHash = comb.isHash,
    isNumber = comb.isNumber,
    isInstanceOf = comb.isInstanceOf,
    isEmpty = comb.isEmpty,
    sql = require("../sql").sql,
github C2FO / patio / example / associations / manyToMany.alternateJoinTable.example.js View on Github external
var patio = require("../../index"), sql = patio.sql, comb = require("comb"), format = comb.string.format;

patio.camelize = true;
patio.configureLogging({patio: {level: "ERROR"}});
var DB = patio.connect("mysql://test:testpass@localhost:3306/sandbox");

var disconnect = comb.hitch(patio, "disconnect");
var disconnectError = function (err) {
    patio.logError(err);
    patio.disconnect();
};

var Class = patio.addModel("class", {
    static: {
        init: function () {
            this._super(arguments);
            this.manyToMany("students",
github noolsjs / nools / benchmark / manners / model.js View on Github external
(function () {

    "use strict";
    var comb = require("comb"), format = comb.string.format;
    comb.define(null, {
        instance:{
            constructor:function (id, guest, hobby) {
                this.id = id;
                this.guestName = guest;
                this.hobby = hobby;
            },

            toString:function () {
                return ["[Chosen : id=", this.id, " name=", this.guestName, " hobby=", this.hobby, "]"].join(" ");
            }
        }
    }).as(exports, "Chosen");

    comb.define(null, {
        instance:{