Example #1
0
		}, function(err, response) {
			if (err) return callback(Error.create('Failed to create empty index into elasticsearch', null, err));
			if (!_.contains([200, 400], response.statusCode)) return callback(Error.http(response.statusCode, 'Failed to create empty index into elasticsearch', response.toJSON()));
			callback(null);
		});
Example #2
0
 .then(function (requestStates) {
   if (_.contains(requestStates, INCOMPLETE)) {
     throw new Error('responding to requests did not complete!');
   }
 });
Example #3
0
exports.canCompile = function (filename) {
  var ext = path.extname(filename);
  return _.contains([".js", ".es6", ".jsx"], ext);
};
Example #4
0
					elem.getText().then(function(text){
						arr.push(text);
						if (counter++ == elems.length){
							assert.ok(_.contains(arr, "Электричество"), "lost account");
						}
					});
Example #5
0
 return _.pick(store.values, function(value, key) {
     return _.contains(fieldNames, key) && !_.isNull(value);
 });
 .end(function (err, res) {
     assert.isTrue(_.contains(res.text, "Connected to BrowserSync"));
     done();
 });
 .filter(function (part) {
     return _.contains(VERSION_BASE_PARTS, precision) || semver[part];
 })
Example #8
0
        return filters.doFilter('slug.reservedSlugs', config.slugs.reserved).then(function then(slugList) {
            // Some keywords cannot be changed
            slugList = _.union(slugList, config.slugs.protected);

            return _.contains(slugList, slug) ? slug + '-' + baseName : slug;
        }).then(function then(slug) {
Example #9
0
 function isUniversal(page, key) {
   if (_.contains(self.options.universal || [], key) || _.contains(self.options.universal || [], page.type + ':' + key)) {
     return;
   }
 }
Example #10
0
File: cdn.js Project: avjpl/bosco
function cmd(bosco, args) {

    var minify = _.contains(args,'minify');
    var port = bosco.config.get('cdn:port') || 7334;
    var repoPattern = bosco.options.watch || '$^';
    var repoRegex = new RegExp(repoPattern);
    var repoTag = bosco.options.tag;

    bosco.log('Starting pseudo CDN on port: ' + (port+'').blue);

    var repos = bosco.config.get('github:repos');
    if(!repos) return bosco.error('You are repo-less :( You need to initialise bosco first, try \'bosco clone\'.');

    var startServer = function(staticAssets, staticRepos, serverPort) {

        var server = http.createServer(function(request, response) {

            var url = request.url.replace('/','');

            if(staticAssets[url]) {
                var asset = staticAssets[url];
                response.writeHead(200, {
                    'Content-Type': asset.mimeType,
                    'Cache-Control': 'no-cache, must-revalidate',
                    'Pragma': 'no-cache',
                    'Expires': 'Sat, 21 May 1952 00:00:00 GMT'
                });

                getContent(staticAssets[url], function(err, content) {
                    if(err) {
                        response.writeHead(500, {'Content-Type': 'text/html'});
                        response.end('<h2>There was an error: ' + err.message + '</h2>');
                    } else {
                        response.end(content);
                    }
                });

          } else {
              if (request.url == '/repos') {
                  response.writeHead(200, {'Content-Type': 'text/html'});
                  return response.end(staticRepos.formattedRepos);
              }
              response.writeHead(404, {'Content-Type': 'text/html'});
              response.end(staticAssets.formattedAssets);
          }
        });

        server.listen(serverPort);
        bosco.log('Server is listening on ' + serverPort);

    }

    var startMonitor = function(staticAssets) {

      var watchSet = {};
      _.forOwn(staticAssets, function(asset, key) {
          if(asset.repo && !asset.repo.match(repoRegex)) {
            return;
          }
          if(!minify) {
            if(asset.path) {  watchSet[asset.path] = key; }
            return;
          }
          if(asset.extname == '.manifest') {
              var manifestFiles = asset.files;
              manifestFiles.forEach(function(file) {
                  if(file) { watchSet[file.path] = asset.tag; }
              });
          }
      });

      var filterFn = function(f, stat) {
        return f.match(repoRegex) && stat.isDirectory() || watchSet[f];
      }

      watch.createMonitor(bosco.getOrgPath(), {filter: filterFn, ignoreDotFiles: true, ignoreUnreadableDir: true, ignoreDirectoryPattern: /node_modules|\.git/, interval: 1000}, function (monitor) {

        bosco.log('Watching '+ _.keys(monitor.files).length + ' files ...');

        monitor.on('changed', function (f) {

          var fileKey = watchSet[f];

          if(!minify) {
              if(fileKey) {
                  fs.readFile(staticAssets[fileKey].path, function (err, data) {
                      if (err) {
                          bosco.log('Error reloading '+fileKey);
                          bosco.log(err.toString());
                          return;
                      }

                      staticAssets[fileKey].data = data;
                      staticAssets[fileKey].content = data.toString();
                      bosco.log('Reloaded ' + fileKey);
                  });
              }
          } else {
              if(fileKey) {
                  bosco.log('Recompiling tag ' + fileKey.blue + ' due to change in ' + f.blue);
                  var options = {
                    repos: repos,
                    minify: minify,
                    buildNumber: 'local',
                    tagFilter: fileKey,
                    watchBuilds: false,
                    reloadOnly: true
                }
                  bosco.staticUtils.getStaticAssets(options, function(err, updatedAssets) {
                      // Clear old for tag
                      _.forOwn(staticAssets, function(value, key) {
                          if(value.tag == fileKey) delete staticAssets[key];
                      });
                      // Add new
                      _.forOwn(updatedAssets, function(value, key) {
                          staticAssets[key] = value;
                      });
                      bosco.log('Reloaded minified assets for tag ' + fileKey.blue);
                  });
              }
          }
        })
      });

    }

    var getContent = function(asset, next) {
        if(asset.extname == '.scss') {
            sass.render(asset.content, next);
        } else {
            next(null, asset.data || asset.content);
        }
    }

    if(minify) bosco.log('Minifying front end assets, this can take some time ...');

    var options = {
        repos: repos,
        buildNumber: 'local',
        minify: minify,
        tagFilter: null,
        watchBuilds: true,
        reloadOnly: false,
        repoRegex: repoRegex,
        repoTag: repoTag
    }

    var executeAsync = {
        staticAssets: bosco.staticUtils.getStaticAssets.bind(null, options),
        staticRepos: bosco.staticUtils.getStaticRepos.bind(null, options)
    }

    async.parallel(executeAsync, function(err, results){
        startServer(results.staticAssets, results.staticRepos, port);
        startMonitor(results.staticAssets);
    });

}
 function containsName(persons, name) {
   return _.contains(_.pluck(persons, 'name'), name);
 }
Example #12
0
 .filter(function(n){
   var isSratch = _.contains(n.name,'__i3_scratch');
   return options.showScratch | !isSratch;
 });
Example #13
0
 return function (record) {
   var runnerWithChilds = ['workflow', 'action-chain', 'mistral-v1', 'mistral-v2'];
   return _.contains(runnerWithChilds, record.action.runner_type);
 };
Example #14
0
var IrcConnection = function (hostname, port, ssl, nick, user, pass, state) {
    var that = this;

    EventEmitter2.call(this,{
        wildcard: true,
        delimiter: ' '
    });
    this.setMaxListeners(0);
    
    // Socket state
    this.connected = false;

    // If registeration with the IRCd has completed
    this.registered = false;

    // If we are in the CAP negotiation stage
    this.cap_negotiation = true;

    // User information
    this.nick = nick;
    this.user = user;  // Contains users real hostname and address
    this.username = this.nick.replace(/[^0-9a-zA-Z\-_.\/]/, '');
    this.password = pass;
    
    // State object
    this.state = state;
    
    // IrcServer object
    this.server = new IrcServer(this, hostname, port);
    
    // IrcUser objects
    this.irc_users = Object.create(null);

    // TODO: use `this.nick` instead of `'*'` when using an IrcUser per nick
    this.irc_users[this.nick] = new IrcUser(this, '*');

    // IrcChannel objects
    this.irc_channels = Object.create(null);

    // IRC connection information
    this.irc_host = {hostname: hostname, port: port};
    this.ssl = !(!ssl);
    
    // SOCKS proxy details
    // TODO: Wildcard matching of hostnames and/or CIDR ranges of IP addresses
    if ((global.config.socks_proxy && global.config.socks_proxy.enabled) && ((global.config.socks_proxy.all) || (_.contains(global.config.socks_proxy.proxy_hosts, this.irc_host.hostname)))) {
        this.socks = {
            host: global.config.socks_proxy.address,
            port: global.config.socks_proxy.port,
            user: global.config.socks_proxy.user,
            pass: global.config.socks_proxy.pass
        };
    } else {
        this.socks = false;
    }

    // Options sent by the IRCd
    this.options = Object.create(null);
    this.cap = {requested: [], enabled: []};

    // Is SASL supported on the IRCd
    this.sasl = false;
    
    // Buffers for data sent from the IRCd
    this.hold_last = false;
    this.held_data = '';

    this.applyIrcEvents();

    // Call any modules before making the connection
    global.modules.emit('irc connecting', {connection: this})
        .done(function () {
            that.connect();
        });
};
Example #15
0
 _.each(this.infos.hooks, function(hook, hookName) {
     if (_.contains(Plugin.HOOKS, hookName)) return;
     that.book.log.warn.ln("Hook '"+hookName+" 'used by plugin '"+that.packageInfos.name+"' has been removed or is deprecated");
 });
Example #16
0
  self._apos.beforePutPage = function(req, page, callback) {

    if (_.contains(self.neverTypes, page.type)) {
      return superBeforePutPage(req, page, callback);
    }

    ensureProperties(page, req);

    // We translate top-level properties specifically called out for translation,
    // plus all top-level areas not specifically denied translation. A recursive
    // walk of all areas is a bad idea here because it would make more sense
    // to just translate the entire top-level area. -Tom

    var before = JSON.stringify(page.localized[req.locale] || {});

    _.each(page, function(value, key) {
      if (!isArea(value)) {
        return;
      }
      if (isUniversal(page, key)) {
        return;
      }
      page.localized[req.locale][key] = value;
      // Revert .body to the default culture's body, unless
      // that doesn't exist yet, in which case we let it spawn from
      // the current culture
      if (_.has(page.localized[self.defaultLocale], key)) {
        page[key] = page.localized[self.defaultLocale][key];
      } else {
        page.localized[self.defaultLocale][key] = page[key];
      }
    });

    // Other properties are localized only if they are on the list.

    _.each(self.localized, function(name) {
      name = localizeForPage(page, name);
      if (!name) {
        return;
      }
      page.localized[req.locale][name] = page[name];
      // Revert .title to the default culture's title, unless
      // that doesn't exist yet, in which case we let it spawn from
      // the current culture
      if (_.has(page.localized[self.defaultLocale], name)) {
        page[name] = page.localized[self.defaultLocale][name];
      } else {
        page.localized[self.defaultLocale][name] = page[name];
      }
    });

    var after = JSON.stringify(page.localized[req.locale] || {});

    if (before !== after) {
      page.localizedAt[req.locale] = new Date();
      if (req.locale === self.defaultLocale) {
        page.localizedStale = _.without(_.keys(self.locales), self.defaultLocale);
      } else {
        // modifies in place
        _.pull(page.localizedStale, req.locale);
      }
    }

    return superBeforePutPage(req, page, callback);
  };
 .end(function (err, res) {
     assert.isTrue(_.contains(res.text, instance.options.snippet));
     done();
 });
Example #18
0
 "cache": function(test) {
   test.expect(1);
   test.ok(_.contains(five.Board.cache, board));
   test.done();
 },
Example #19
0
 paths.forEach(function (route, index) {
   if (routes ? _.contains(routes, route.path) : re.test(route.path)) {
     paths.splice(index, 1);
   }
 });
Example #20
0
app.use(function (req, res, next) {
    // CSRF protection.
    if (_.contains(csrfExclude, req.path)) return next();
    csrf(req, res, next);
});
 return _.map(file.split('-'), function (word) {
   if (!_.contains(exceptionList, word)) {
     word = word[0].toUpperCase() + word.slice(1);
   }
   return word;
 }).join(' ');
Example #22
0
 it('should filter out an event with type `foo`', function() {
   var foo = {'type': 'foo'};
   if (!_.contains(Preprocess.TYPES_TO_INCLUDE, 'foo')) {
     expect(Preprocess.filterData([foo])).to.have.length(0);
   }
 });
Example #23
0
 var driver = _.findKey(DRIVER_CFG, function (models) {
   return _.contains(models, model);
 }); 
Example #24
0
function convertApi(v2, apiDeclaration, definitions) {
  if (v2.info.version == null) {
    v2.info.version = apiDeclaration.apiVersion;
  }

  if (v2.host === "unknown" || v2.basePath === "unknown") {
    var base = url.parse(apiDeclaration.basePath);
    v2.host = base.host;
    v2.basePath = base.pathname;

    // This assumes that the the schemes in the apiDeclaration basePath are the only ones supported.
    //
    if (!_.contains(v2.schemes, base.scheme)) {
      v2.schemes.push(base.protocol.replace(':', ''));
    }
  }

  var resourceProduces = apiDeclaration.produces;
  var resourceConsumes = apiDeclaration.consumes;

  // What to do with authorizations -> security?
  // Assuming security is an array of permissions/oauth scopes
  //
  // Pull apiDeclaration level security down to operations
  //
  var resourceSecurity = null;

  if (apiDeclaration.authorizations &&
    apiDeclaration.authorizations.oauth &&
    apiDeclaration.authorizations.oauth.scopes) {
    resourceSecurity = _.map(apiDeclaration.authorizations.oauth.scopes, function(scope) {
      return scope.scope;
    });
  }

  _.each(apiDeclaration.apis, function(api) {
    var path = v2.paths[api.path] = {};

    _.each(api.operations, function(operation) {
      var method = {};

      assign(method, 'summary', operation, 'summary');
      assign(method, 'description', operation, 'notes');
      assign(method, 'operationId', operation, 'nickname');

      if (resourceProduces) {
        method.produces = resourceProduces;
      }

      assign(method, 'produces', operation, 'produces');

      if (resourceConsumes) {
        method.consumes = resourceConsumes;
      }

      assign(method, 'consumes', operation, 'consumes');

      if (operation.parameters && operation.parameters.length > 0) {
        method.parameters = _.map(operation.parameters, function(parameter) {
          var converted = {
            name: parameter.name,
            in: parameter.paramType === 'form' ? 'formData' : parameter.paramType,
          }

          if (parameter.description) {
            // TODO: [rfeng] Convert html to md
            // converted.description = md(parameter.description);
            converted.description = parameter.description;
          }

          converted.required = parameter.paramType === 'body' ? true : parameter.required;
          assign(converted, 'uniqueItems', parameter, 'uniqueItems');

          var target = converted;
          var props = {};

          if (parameter.paramType === 'body' && parameter.type === "array") {
            // This would not validate through the schema.  Issue?
            //
            //props.type = "array";
            //props.items = {
            props.schema = {
              '$ref': "#/definitions/" + parameter.items['$ref']
            };
          } else if (_.contains(primitiveTypes, parameter.type)) {
            props.type = parameter.type;

            if (parameter.format) {
              props.format = parameter.format;
            }
          } else {
            props.schema = {
              '$ref': "#/definitions/" + parameter.type
            }
          }
          /*
           // Do not apply to parameters.  It seems to be in 1.2 by way of dataTypeBase.json.  Issue?
           // Commented out to pass validation.
           //
           assign(props, 'default', parameter, 'defaultValue');
           assign(props, 'enum', parameter, 'enum');

           if (parameter.type === "integer") {
           if (parameter.minimum) props.minimum = parseInt(parameter.minimum);
           if (parameter.maximum) props.maximum = parseInt(parameter.maximum);
           } else if (parameter.type === "number") {
           if (parameter.minimum) props.minimum = parseFloat(parameter.minimum);
           if (parameter.maximum) props.maximum = parseFloat(parameter.maximum);
           }
           */

          if (parameter.allowMultiple) {
            target.type = "array";
            target.items = props;
          } else {
            _.extend(target, props);
          }
          // Files hasn't made it over yet.
          //
          if (target.type === 'File') {
            target.type = 'string';
          }

          assign(converted, 'x-typeArguments', parameter, 'typeArguments');

          return converted;
        });
      }

      var responses = {};

      if (
        operation.type &&

        operation.type !== "void") {
        var items = {};
        var response = {
          description: "Success",
          schema: {}
        }

        if (operation.type === "array") {
          response.schema.type =
            "array";
          response.schema.items = {
            '$ref': "#/definitions/" + operation.items['$ref']
          };
        } else if (_.contains(primitiveTypes, operation.type)) {
          response.schema.type = operation.type;

          if (operation.format) {
            response.schema.format = operation.format;
          }
        } else {
          response.schema['$ref'] = "#/definitions/" + operation.type;
        }
        responses["200"] = response;
      }

      if (operation.responseMessages) {
        _.each(operation.responseMessages, function(response) {
          responses[response.code] = {
            description: response.message
          };
        });
      }
      if (_.isEmpty(responses)) {
        responses["200"] = {description: "Success"};
      }

      method.responses = responses;

      if (resourceSecurity) {
        method.security = resourceSecurity;
      }

      // TODO schemes
      // What to do with authorizations -> security?
      // Assuming security is an array of permissions/oauth scopes
      //
      if (operation.authorizations && operation.authorizations.oauth &&
        operation.authorizations.oauth.scopes) {
        method.security = _.map(operation.authorizations.oauth.scopes,
          function(scope) {
            return scope.scope;
          });
      }

      path[operation.method.toLowerCase()] = method;
    });
  })

  _.each(apiDeclaration.models, function(model, name) {
    var definition = {};

    assign(definition, 'required', model, 'required');
    definition.properties = {};
    _.each(model.properties, function(property, name) {
      var converted = _.clone(property);

      assign(converted, 'type', property, 'type');
      assign(converted, 'schema', property, 'schema');
      assign(converted, 'items', property, 'items');
      assign(converted, 'default', property, 'defaultValue');
      assign(converted, 'enum', property, 'enum');

      if (property.type === "integer") {
        if (property.minimum) {
          converted.minimum = parseInt(property.minimum);
        }
        if (property.maximum) {
          converted.maximum = parseInt(property.maximum);
        }
      } else if (converted.type === "number") {
        if (property.minimum) {
          converted.minimum = parseFloat(property.minimum);
        }
        if (property.maximum) {
          converted.maximum = parseFloat(property.maximum);
        }
      }

      definition.properties[name] = converted;
    });

    // TODO
    // subTypes
    // discriminator
    //

    assign(definition, 'x-typeParameters', model, 'typeParameters');

    definitions[name] = definition;
  });
}
Example #25
0
 var removedComments = _.reject(comments[id], function(comment) {
     return _.contains(removedIds, comment._id.toString());
 });
Example #26
0
    _.each(api.operations, function(operation) {
      var method = {};

      assign(method, 'summary', operation, 'summary');
      assign(method, 'description', operation, 'notes');
      assign(method, 'operationId', operation, 'nickname');

      if (resourceProduces) {
        method.produces = resourceProduces;
      }

      assign(method, 'produces', operation, 'produces');

      if (resourceConsumes) {
        method.consumes = resourceConsumes;
      }

      assign(method, 'consumes', operation, 'consumes');

      if (operation.parameters && operation.parameters.length > 0) {
        method.parameters = _.map(operation.parameters, function(parameter) {
          var converted = {
            name: parameter.name,
            in: parameter.paramType === 'form' ? 'formData' : parameter.paramType,
          }

          if (parameter.description) {
            // TODO: [rfeng] Convert html to md
            // converted.description = md(parameter.description);
            converted.description = parameter.description;
          }

          converted.required = parameter.paramType === 'body' ? true : parameter.required;
          assign(converted, 'uniqueItems', parameter, 'uniqueItems');

          var target = converted;
          var props = {};

          if (parameter.paramType === 'body' && parameter.type === "array") {
            // This would not validate through the schema.  Issue?
            //
            //props.type = "array";
            //props.items = {
            props.schema = {
              '$ref': "#/definitions/" + parameter.items['$ref']
            };
          } else if (_.contains(primitiveTypes, parameter.type)) {
            props.type = parameter.type;

            if (parameter.format) {
              props.format = parameter.format;
            }
          } else {
            props.schema = {
              '$ref': "#/definitions/" + parameter.type
            }
          }
          /*
           // Do not apply to parameters.  It seems to be in 1.2 by way of dataTypeBase.json.  Issue?
           // Commented out to pass validation.
           //
           assign(props, 'default', parameter, 'defaultValue');
           assign(props, 'enum', parameter, 'enum');

           if (parameter.type === "integer") {
           if (parameter.minimum) props.minimum = parseInt(parameter.minimum);
           if (parameter.maximum) props.maximum = parseInt(parameter.maximum);
           } else if (parameter.type === "number") {
           if (parameter.minimum) props.minimum = parseFloat(parameter.minimum);
           if (parameter.maximum) props.maximum = parseFloat(parameter.maximum);
           }
           */

          if (parameter.allowMultiple) {
            target.type = "array";
            target.items = props;
          } else {
            _.extend(target, props);
          }
          // Files hasn't made it over yet.
          //
          if (target.type === 'File') {
            target.type = 'string';
          }

          assign(converted, 'x-typeArguments', parameter, 'typeArguments');

          return converted;
        });
      }

      var responses = {};

      if (
        operation.type &&

        operation.type !== "void") {
        var items = {};
        var response = {
          description: "Success",
          schema: {}
        }

        if (operation.type === "array") {
          response.schema.type =
            "array";
          response.schema.items = {
            '$ref': "#/definitions/" + operation.items['$ref']
          };
        } else if (_.contains(primitiveTypes, operation.type)) {
          response.schema.type = operation.type;

          if (operation.format) {
            response.schema.format = operation.format;
          }
        } else {
          response.schema['$ref'] = "#/definitions/" + operation.type;
        }
        responses["200"] = response;
      }

      if (operation.responseMessages) {
        _.each(operation.responseMessages, function(response) {
          responses[response.code] = {
            description: response.message
          };
        });
      }
      if (_.isEmpty(responses)) {
        responses["200"] = {description: "Success"};
      }

      method.responses = responses;

      if (resourceSecurity) {
        method.security = resourceSecurity;
      }

      // TODO schemes
      // What to do with authorizations -> security?
      // Assuming security is an array of permissions/oauth scopes
      //
      if (operation.authorizations && operation.authorizations.oauth &&
        operation.authorizations.oauth.scopes) {
        method.security = _.map(operation.authorizations.oauth.scopes,
          function(scope) {
            return scope.scope;
          });
      }

      path[operation.method.toLowerCase()] = method;
    });
Example #27
0
 apache.tables.forEach(function (table) {
   expect(_.contains(tables, table)).to.be(true);
 });
Example #28
0
        method.parameters = _.map(operation.parameters, function(parameter) {
          var converted = {
            name: parameter.name,
            in: parameter.paramType === 'form' ? 'formData' : parameter.paramType,
          }

          if (parameter.description) {
            // TODO: [rfeng] Convert html to md
            // converted.description = md(parameter.description);
            converted.description = parameter.description;
          }

          converted.required = parameter.paramType === 'body' ? true : parameter.required;
          assign(converted, 'uniqueItems', parameter, 'uniqueItems');

          var target = converted;
          var props = {};

          if (parameter.paramType === 'body' && parameter.type === "array") {
            // This would not validate through the schema.  Issue?
            //
            //props.type = "array";
            //props.items = {
            props.schema = {
              '$ref': "#/definitions/" + parameter.items['$ref']
            };
          } else if (_.contains(primitiveTypes, parameter.type)) {
            props.type = parameter.type;

            if (parameter.format) {
              props.format = parameter.format;
            }
          } else {
            props.schema = {
              '$ref': "#/definitions/" + parameter.type
            }
          }
          /*
           // Do not apply to parameters.  It seems to be in 1.2 by way of dataTypeBase.json.  Issue?
           // Commented out to pass validation.
           //
           assign(props, 'default', parameter, 'defaultValue');
           assign(props, 'enum', parameter, 'enum');

           if (parameter.type === "integer") {
           if (parameter.minimum) props.minimum = parseInt(parameter.minimum);
           if (parameter.maximum) props.maximum = parseInt(parameter.maximum);
           } else if (parameter.type === "number") {
           if (parameter.minimum) props.minimum = parseFloat(parameter.minimum);
           if (parameter.maximum) props.maximum = parseFloat(parameter.maximum);
           }
           */

          if (parameter.allowMultiple) {
            target.type = "array";
            target.items = props;
          } else {
            _.extend(target, props);
          }
          // Files hasn't made it over yet.
          //
          if (target.type === 'File') {
            target.type = 'string';
          }

          assign(converted, 'x-typeArguments', parameter, 'typeArguments');

          return converted;
        });
 /**
  * Chooses version parts between the declared version and the latest.
  * Base parts (major, minor, patch) are only included if they are in the original declaration.
  * Added parts (release, build) are always included. They are only present if we are checking --greatest versions
  * anyway.
 */
 function chooseVersion(part) {
     return versionUtil.isWildPart(declaredSemver[part]) ? declaredSemver[part] :
         _.contains(versionUtil.VERSION_BASE_PARTS, part) && declaredSemver[part] ? latestSemver[part] :
         _.contains(versionUtil.VERSION_ADDED_PARTS, part) ? latestSemver[part] :
         undefined;
 }
Example #30
0
 _.each(splitEl, function (split, index) {
   split = split.trim();
   if (/\w/.test(split) && split.length <= maxLength && !_.contains(targetPool,split)) {
     targetPool.push(split);
   }
 });