Example #1
0
  allFetched: function () {
    var statuses = _.pluck(this.pages, 'status');

    return _.all(statuses, function (status) {
      return status === "fetched" || status === "error" || status === "dontfetch" || status === "errored";
    });
  },
Example #2
0
    file.walkSync(base, function (currentDir, dirs, files) {
        var ok = _.all(_.map(excludes, function (dir) {
            return currentDir.indexOf(base + dir) != 0;
        }));
        if (!ok) return;
        files.forEach(function (file) {
            if (file.indexOf(".js") != file.length - 3) return;

            var fullPath = currentDir + "/" + file;
            var moduleName = fullPath.substring(base.length + 1, fullPath.lastIndexOf(".js")).replace(/\//g, ".");
            modules.push([fullPath, moduleName]);
        });
    });
Example #3
0
/**
 * Compare two langNodes to see if they are at the same state of the same production rule.
 **/
//TODO: Unit test this.
//TODO: Inline categories are not handled.
function compareLangNodes(langNodeA, langNodeB) {
    if(langNodeA.category === langNodeB.category){
        if(langNodeA.parseData.origin === langNodeB.parseData.origin){
            if(langNodeA.parseData.atComponent === langNodeB.parseData.atComponent){
                if(langNodeA.parseData.stringIdx === langNodeB.parseData.stringIdx){
                    //State is the same, now check that the components are the same:
                    //TODO: Not sure if this works with regexs properly.
                    //console.log(langNodeA.components);
                    //console.log(langNodeB.components);
                    return _.isEqual(langNodeA.components, langNodeB.components);
                    //Problem comparing compiled regex?
                    if(langNodeA.components.length === langNodeB.components.length) {
                        return _.all(_.zip(langNodeA.components, langNodeB.components), function(componentPair) {
                            return componentPair[0].category === componentPair[1].category &&
                                componentPair[0].match === componentPair[1].match &&
                                componentPair[0].terminal === componentPair[1].terminal;
                        });
                    }
                }
            }
        }
    }
    return false;
}
exports.compare = function (k1, k2) {
	return _.all(k1, function(v){
	    return _.contains(k2, v);
	});					
};
Example #5
0
 this.isUpperCase = function(word) {
     return _.all(word.split(''), function(c) {
         return c == c.toUpperCase(); 
     });
 };