Merge pull request #119 from clarkbw/lodash

upgrade lodash and drop underscore.string

Close #119
This commit is contained in:
Miroslav Bajtoš 2015-04-15 17:40:32 +02:00
commit d9c0f12a66
3 changed files with 11 additions and 8 deletions

View File

@ -7,7 +7,6 @@ var ConfigLoader = require('./config-loader');
var debug = require('debug')('loopback:boot:compiler');
var Module = require('module');
var _ = require('lodash');
var _s = require('underscore.string');
var FILE_EXTENSION_JSON = '.json';
@ -384,7 +383,7 @@ function tryResolveAppPath(rootDir, relativePath, resolveOptions) {
function loadModelDefinition(rootDir, jsonFile, allFiles) {
var definition = require(jsonFile);
var basename = path.basename(jsonFile, path.extname(jsonFile));
definition.name = definition.name || _s.capitalize(_s.camelize(basename));
definition.name = definition.name || _.capitalize(_.camelCase(basename));
// find a matching file with a supported extension like `.js` or `.coffee`
var sourceFile = fixFileExtension(jsonFile, allFiles, true);

View File

@ -1,5 +1,4 @@
var assert = require('assert');
var _ = require('lodash');
var semver = require('semver');
var debug = require('debug')('loopback:boot:executor');
var async = require('async');
@ -107,7 +106,7 @@ function setHost(app, instructions) {
function setPort(app, instructions) {
// jscs:disable requireCamelCaseOrUpperCaseIdentifiers
var port = _.find([
var port = find([
process.env.npm_config_port,
process.env.OPENSHIFT_SLS_PORT,
process.env.OPENSHIFT_NODEJS_PORT,
@ -116,7 +115,9 @@ function setPort(app, instructions) {
process.env.npm_package_config_port,
app.get('port'),
3000
], _.isFinite);
], function isNumberLike(v) {
return Number.isFinite(parseInt(v, 10));
});
if (port !== undefined) {
var portType = typeof port;
@ -126,6 +127,10 @@ function setPort(app, instructions) {
}
}
function find(array, predicate) {
return array.filter(predicate)[0];
}
function setApiRoot(app, instructions) {
var restApiRoot =
instructions.config.restApiRoot ||

View File

@ -26,10 +26,9 @@
"async": "~0.9.0",
"commondir": "0.0.1",
"debug": "^2.0.0",
"lodash": "^2.4.1",
"lodash": "^3.6.0",
"semver": "^4.1.0",
"toposort": "^0.2.10",
"underscore.string": "^3.0.3"
"toposort": "^0.2.10"
},
"devDependencies": {
"browserify": "^4.1.8",