How to use the comb.isUndefined 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 COVERAGE_HEADER = string.format('\n %s \n', string.style("Test Coverage", "bold"));
var TABLE_SEP = string.format("+%--42s+%--11s+%--6s+%--7s+%--7s+", "-", "-", "-", "-", "-");
TABLE_SEP = comb.hitch(string, "format", TABLE_SEP + "\n%s\n" + TABLE_SEP)
var PRINT_FORMAT = comb.hitch(string, "format", "| %-40s | %9s | %4s | %5s | %6s|");
/**
 * Report test coverage in tabular format
 *
 * @param  {Object} cov
 */

var reportCoverage = process.argv[2];
reportCoverage = comb.isUndefined(reportCoverage) ? false : reportCoverage == 'true';
var showFileSource = process.argv[3];
showFileSource = comb.isUndefined(showFileSource) ? false : showFileSource == 'true';
var fileMatcher = /.js$/;

var printFile = function (file) {
    sys.error(PRINT_FORMAT(file.name, "" + file.coverage, "" + file.LOC, "" + file.SLOC, "" + file.totalMisses));
};

var printFileSource = function (file) {
    if (file.name == "dataset/sql.js" && file.coverage < 100) {
        sys.error(string.format('\n %s \n %s \n' + string.style(file.name, "bold"), file.source));
    }
}

function reportCoverageTable(cov) {
    // Stats
    var print = sys.error;
    print(COVERAGE_HEADER);
github C2FO / patio / test / runner.js View on Github external
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

var COVERAGE_HEADER = string.format('\n %s \n', string.style("Test Coverage", "bold"));
var TABLE_SEP = string.format("+%--42s+%--11s+%--6s+%--7s+%--7s+", "-", "-", "-", "-", "-");
TABLE_SEP = comb.hitch(string, "format", TABLE_SEP + "\n%s\n" + TABLE_SEP)
var PRINT_FORMAT = comb.hitch(string, "format", "| %-40s | %9s | %4s | %5s | %6s|");
/**
 * Report test coverage in tabular format
 *
 * @param  {Object} cov
 */

var reportCoverage = process.argv[2];
reportCoverage = comb.isUndefined(reportCoverage) ? false : reportCoverage == 'true';
var showFileSource = process.argv[3];
showFileSource = comb.isUndefined(showFileSource) ? false : showFileSource == 'true';
var fileMatcher = /.js$/;

var printFile = function (file) {
    sys.error(PRINT_FORMAT(file.name, "" + file.coverage, "" + file.LOC, "" + file.SLOC, "" + file.totalMisses));
};

var printFileSource = function (file) {
    if (file.name == "dataset/sql.js" && file.coverage < 100) {
        sys.error(string.format('\n %s \n %s \n' + string.style(file.name, "bold"), file.source));
    }
}

function reportCoverageTable(cov) {
    // Stats
github C2FO / patio / example / application / plugins / ExpressPlugin.js View on Github external
routes: function () {
                if (comb.isUndefined(this.__routes)) {
                    var routes = this.__routes = [
                        ["get", "/" + this.tableName + "/:id", comb.hitch(this, "findByIdRoute")],
                        ["delete", "/" + this.tableName + "/:id", comb.hitch(this, "removeByIdRoute")]
                    ];
                }
                return this.__routes;
            }
github C2FO / patio / lib / plugins / inheritance.js View on Github external
return db.from(table).insert(insert).chain(function (id) {
                        if (comb.isUndefined(self.primaryKeyValue) && !comb.isUndefined(id) && index === 0) {
                            self.__ignore = true;
                            //how to handle composite keys.
                            self[pk] = id;
                            self.__ignore = false;
                        }
                    });
                }, 1).chain(function () {
github C2FO / patio / lib / plugins / inheritance.js View on Github external
ret = asyncArray.forEach(tables,function (table, index) {
                    var cols = ctiColumns[table], insert = {}, val, i = -1, colLength = cols.length, c;
                    while (++i < colLength) {
                        c = cols[i];
                        if ((index !== 0 || (index === 0 && (!isRestricted || pk.indexOf(c) === -1))) && !comb.isUndefined(val = self[c])) {
                            insert[c] = val;
                        }
                    }
                    return db.from(table).insert(insert).chain(function (id) {
                        if (comb.isUndefined(self.primaryKeyValue) && !comb.isUndefined(id) && index === 0) {
                            self.__ignore = true;
                            //how to handle composite keys.
                            self[pk] = id;
                            self.__ignore = false;
                        }
                    });
                }, 1).chain(function () {
                        self.__isNew = false;
github doug-martin / super-request / index.js View on Github external
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":
                    //testing for cookies
                    key = expect[1];
                    if (!comb.isUndefinedOrNull(getCookie(key, this._jar, this._baseUrl))) {
                        throw new Error("expected cookie " + key + " to be null or undefined " + "\n" + expect[2]);
                    }
github C2FO / patio / lib / plugins / inheritance.js View on Github external
cols.forEach(function (c) {
                    if (!comb.isUndefined(changed[c])) {
                        update[c] = changed[c];
                    }
                });
                return comb.isEmpty(update) ? new Promise().callback() : self.db.from(table).filter(q).update(update);