Replace underscore with lodash.

This commit is contained in:
John-David Dalton 2014-02-05 00:40:30 -08:00 committed by Hannah Wolfe
parent ca01b732b2
commit 6eab7b3f92
57 changed files with 5052 additions and 1350 deletions

View File

@ -6,7 +6,7 @@ var path = require('path'),
when = require('when'),
semver = require('semver'),
fs = require('fs'),
_ = require('underscore'),
_ = require('lodash'),
spawn = require('child_process').spawn,
buildDirectory = path.resolve(process.cwd(), '.build'),
distDirectory = path.resolve(process.cwd(), '.dist'),
@ -380,7 +380,7 @@ var path = require('path'),
'core/shared/vendor/jquery/jquery-ui-1.10.3.custom.min.js',
'core/client/assets/lib/jquery-utils.js',
'core/client/assets/lib/uploader.js',
'core/shared/vendor/underscore.js',
'core/shared/vendor/lodash.underscore.js',
'core/shared/vendor/backbone/backbone.js',
'core/shared/vendor/handlebars/handlebars-runtime.js',
'core/shared/vendor/moment.js',
@ -435,7 +435,7 @@ var path = require('path'),
'core/shared/vendor/jquery/jquery-ui-1.10.3.custom.min.js',
'core/client/assets/lib/jquery-utils.js',
'core/client/assets/lib/uploader.js',
'core/shared/vendor/underscore.js',
'core/shared/vendor/lodash.underscore.js',
'core/shared/vendor/backbone/backbone.js',
'core/shared/vendor/handlebars/handlebars-runtime.js',
'core/shared/vendor/moment.js',

View File

@ -5,7 +5,7 @@ var dataExport = require('../data/export'),
path = require('path'),
when = require('when'),
nodefn = require('when/node/function'),
_ = require('underscore'),
_ = require('lodash'),
schema = require('../data/schema').tables,
configPaths = require('../config/paths'),
api = {},

View File

@ -1,7 +1,7 @@
// # Ghost Data API
// Provides access to the data model
var _ = require('underscore'),
var _ = require('lodash'),
when = require('when'),
config = require('../config'),
errors = require('../errorHandling'),

View File

@ -1,5 +1,5 @@
var when = require('when'),
_ = require('underscore'),
_ = require('lodash'),
// Holds the persistent notifications
notificationsStore = [],
notifications;

View File

@ -1,5 +1,5 @@
var when = require('when'),
_ = require('underscore'),
_ = require('lodash'),
dataProvider = require('../models'),
permissions = require('../permissions'),
canThis = permissions.canThis,

View File

@ -1,4 +1,4 @@
var _ = require('underscore'),
var _ = require('lodash'),
dataProvider = require('../models'),
when = require('when'),
errors = require('../errorHandling'),

View File

@ -1,5 +1,5 @@
var when = require('when'),
_ = require('underscore'),
_ = require('lodash'),
dataProvider = require('../models'),
settings = require('./settings'),
ONE_DAY = 86400000,

View File

@ -1,5 +1,5 @@
var _ = require('underscore'),
var _ = require('lodash'),
when = require('when'),
errors = require('../errorHandling'),
api = require('../api'),

View File

@ -1,6 +1,6 @@
var path = require('path'),
_ = require('underscore'),
_ = require('lodash'),
when = require('when'),
appProxy = require('./proxy'),
config = require('../config'),

View File

@ -1,4 +1,4 @@
var _ = require('underscore'),
var _ = require('lodash'),
api = require('../api'),
helpers = require('../helpers'),
filters = require('../filters');

View File

@ -1,8 +1,8 @@
var fs = require('fs'),
path = require('path'),
Module = require('module'),
_ = require('underscore');
var fs = require('fs'),
path = require('path'),
Module = require('module'),
_ = require('lodash');
function AppSandbox(opts) {
this.opts = _.defaults(opts || {}, AppSandbox.defaults);

View File

@ -5,7 +5,7 @@ var moment = require('moment'),
path = require('path'),
when = require('when'),
url = require('url'),
_ = require('underscore'),
_ = require('lodash'),
requireTree = require('../require-tree'),
appRoot = path.resolve(__dirname, '../../../'),
corePath = path.resolve(appRoot, 'core/'),

View File

@ -1,5 +1,5 @@
var config = require('../config'),
_ = require('underscore'),
_ = require('lodash'),
path = require('path'),
when = require('when'),
api = require('../api'),

View File

@ -6,7 +6,7 @@
var moment = require('moment'),
RSS = require('rss'),
_ = require('underscore'),
_ = require('lodash'),
url = require('url'),
when = require('when'),

View File

@ -1,5 +1,5 @@
var when = require('when'),
_ = require('underscore'),
_ = require('lodash'),
migration = require('../migration'),
knex = require('../../models/base').knex,
schema = require('../schema').tables,

View File

@ -1,5 +1,5 @@
var sequence = require('when/sequence'),
_ = require('underscore'),
_ = require('lodash'),
Post = require('../../models/post').Post,
Tag = require('../../models/tag').Tag,
Role = require('../../models/role').Role,

View File

@ -1,5 +1,5 @@
var when = require('when'),
_ = require('underscore'),
_ = require('lodash'),
models = require('../../models'),
errors = require('../../errorHandling'),
Importer000;

View File

@ -1,4 +1,4 @@
var _ = require('underscore'),
var _ = require('lodash'),
when = require('when'),
errors = require('../../errorHandling'),
client = require('../../models/base').client,

View File

@ -1,5 +1,5 @@
/*jslint regexp: true */
var _ = require('underscore'),
var _ = require('lodash'),
colors = require('colors'),
fs = require('fs'),
configPaths = require('./config/paths'),
@ -227,16 +227,16 @@ errors = {
}
};
// Ensure our 'this' context in the functions
_.bindAll(
errors,
'throwError',
'logError',
// Ensure our 'this' context for methods and preserve method arity by
// using Function#bind for expressjs
_.each([
'logAndThrowError',
'logErrorWithRedirect',
'renderErrorPage',
'error404',
'error500'
);
], function (funcName) {
errors[funcName] = errors[funcName].bind(errors);
});
module.exports = errors;

View File

@ -1,5 +1,5 @@
var when = require('when'),
_ = require('underscore'),
_ = require('lodash'),
defaults;

View File

@ -3,7 +3,7 @@ var downsize = require('downsize'),
moment = require('moment'),
path = require('path'),
polyglot = require('node-polyglot').instance,
_ = require('underscore'),
_ = require('lodash'),
when = require('when'),
api = require('../api'),

View File

@ -7,7 +7,7 @@ var crypto = require('crypto'),
path = require('path'),
Polyglot = require('node-polyglot'),
semver = require('semver'),
_ = require('underscore'),
_ = require('lodash'),
when = require('when'),
api = require('./api'),

View File

@ -1,6 +1,6 @@
var cp = require('child_process'),
url = require('url'),
_ = require('underscore'),
_ = require('lodash'),
when = require('when'),
nodefn = require('when/node/function'),
nodemailer = require('nodemailer'),

View File

@ -4,7 +4,7 @@
var middleware = require('./middleware'),
express = require('express'),
_ = require('underscore'),
_ = require('lodash'),
url = require('url'),
when = require('when'),
slashes = require('connect-slashes'),

View File

@ -2,7 +2,7 @@
// The following custom middleware functions are all unit testable, and have accompanying unit tests in
// middleware_spec.js
var _ = require('underscore'),
var _ = require('lodash'),
express = require('express'),
busboy = require('./ghost-busboy'),
config = require('../config'),

View File

@ -2,7 +2,7 @@ var ghostBookshelf,
Bookshelf = require('bookshelf'),
when = require('when'),
moment = require('moment'),
_ = require('underscore'),
_ = require('lodash'),
uuid = require('node-uuid'),
config = require('../config'),
Validator = require('validator').Validator,

View File

@ -1,5 +1,5 @@
var migrations = require('../data/migration'),
_ = require('underscore');
_ = require('lodash');
module.exports = {
Post: require('./post').Post,

View File

@ -1,6 +1,6 @@
var Post,
Posts,
_ = require('underscore'),
_ = require('lodash'),
uuid = require('node-uuid'),
when = require('when'),
errors = require('../errorHandling'),

View File

@ -2,7 +2,7 @@ var Settings,
ghostBookshelf = require('./base'),
validator = ghostBookshelf.validator,
uuid = require('node-uuid'),
_ = require('underscore'),
_ = require('lodash'),
errors = require('../errorHandling'),
when = require('when'),
defaultSettings;

View File

@ -1,6 +1,6 @@
var User,
Users,
_ = require('underscore'),
_ = require('lodash'),
uuid = require('node-uuid'),
when = require('when'),
errors = require('../errorHandling'),

View File

@ -1,7 +1,7 @@
// canThis(someUser).edit.posts([id]|[[ids]])
// canThis(someUser).edit.post(somePost|somePostId)
var _ = require('underscore'),
var _ = require('lodash'),
when = require('when'),
Models = require('../models'),
objectTypeModelMap = require('./objectTypeModelMap'),

View File

@ -1,4 +1,4 @@
var _ = require('underscore'),
var _ = require('lodash'),
moment = require('moment'),
path = require('path'),
when = require('when'),

View File

@ -1,7 +1,7 @@
// # Local File System Image Storage module
// The (default) module for storing images, using the local file system
var _ = require('underscore'),
var _ = require('lodash'),
express = require('express'),
fs = require('fs-extra'),
nodefn = require('when/node/function'),

View File

@ -25,7 +25,7 @@ var crypto = require('crypto'),
semver = require('semver'),
when = require('when'),
nodefn = require('when/node/function'),
_ = require('underscore'),
_ = require('lodash'),
url = require('url'),
api = require('./api'),

4979
core/shared/vendor/lodash.underscore.js vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
/*globals describe, before, after, beforeEach, afterEach, it */
var testUtils = require('../../utils'),
should = require('should'),
_ = require('underscore'),
_ = require('lodash'),
request = require('request');
request = request.defaults({jar: true});

View File

@ -1,7 +1,7 @@
/*globals describe, before, beforeEach, afterEach, it */
var testUtils = require('../../utils'),
should = require('should'),
_ = require('underscore'),
_ = require('lodash'),
request = require('request');
request = request.defaults({jar:true})

View File

@ -1,7 +1,7 @@
/*globals describe, before, beforeEach, afterEach, it */
var testUtils = require('../../utils'),
should = require('should'),
_ = require('underscore'),
_ = require('lodash'),
request = require('request');
request = request.defaults({jar:true})

View File

@ -1,7 +1,7 @@
/*globals describe, before, beforeEach, afterEach, it */
var testUtils = require('../../utils'),
should = require('should'),
_ = require('underscore'),
_ = require('lodash'),
request = require('request');
request = request.defaults({jar:true})

View File

@ -1,7 +1,7 @@
/*globals describe, before, beforeEach, afterEach, it */
var testUtils = require('../../utils'),
should = require('should'),
_ = require('underscore'),
_ = require('lodash'),
when = require('when'),
sequence = require('when/sequence'),

View File

@ -1,7 +1,7 @@
/*globals describe, before, beforeEach, afterEach, it*/
var testUtils = require('../../utils'),
should = require('should'),
_ = require("underscore"),
_ = require("lodash"),
// Stuff we are testing
Models = require('../../../server/models'),

View File

@ -1,6 +1,6 @@
/*globals describe, before, beforeEach, afterEach, it */
var testUtils = require('../../utils'),
_ = require("underscore"),
_ = require("lodash"),
when = require('when'),
sequence = require('when/sequence'),
should = require('should'),

View File

@ -2,7 +2,7 @@
var testUtils = require('../../utils'),
should = require('should'),
when = require('when'),
_ = require('underscore'),
_ = require('lodash'),
errors = require('../../../server/errorHandling'),
sinon = require('sinon'),
uuid = require('node-uuid'),

View File

@ -1,14 +1,14 @@
/*globals describe, beforeEach, afterEach, before, it*/
var fs = require('fs'),
path = require('path'),
should = require('should'),
sinon = require('sinon'),
_ = require("underscore"),
helpers = require('../../server/helpers'),
filters = require('../../server/filters'),
var fs = require('fs'),
path = require('path'),
should = require('should'),
sinon = require('sinon'),
_ = require('lodash'),
helpers = require('../../server/helpers'),
filters = require('../../server/filters'),
// Stuff we are testing
appProxy = require('../../server/apps/proxy'),
appProxy = require('../../server/apps/proxy'),
AppSandbox = require('../../server/apps/sandbox');
describe('Apps', function () {

View File

@ -5,7 +5,7 @@ var should = require('should'),
when = require('when'),
path = require('path'),
fs = require('fs'),
_ = require('underscore'),
_ = require('lodash'),
rewire = require("rewire"),
testUtils = require('../utils'),

View File

@ -3,7 +3,7 @@ var testUtils = require('../utils'),
should = require('should'),
sinon = require('sinon'),
when = require('when'),
_ = require("underscore"),
_ = require("lodash"),
errors = require('../../server/errorHandling'),
// Stuff we are testing

View File

@ -4,7 +4,7 @@ var testUtils = require('../utils'),
sinon = require('sinon'),
when = require('when'),
path = require('path'),
_ = require('underscore'),
_ = require('lodash'),
// Stuff we are testing
Filters = require('../../server/filters').Filters;

View File

@ -4,7 +4,7 @@ var testUtils = require('../utils'),
sinon = require('sinon'),
when = require('when'),
assert = require('assert'),
_ = require("underscore"),
_ = require("lodash"),
errors = require('../../server/errorHandling'),
// Stuff we are testing

View File

@ -4,7 +4,7 @@ var testUtils = require('../utils'),
sinon = require('sinon'),
when = require('when'),
_ = require("underscore"),
_ = require("lodash"),
cp = require('child_process'),
// Stuff we are testing

View File

@ -3,7 +3,7 @@ var assert = require('assert'),
should = require('should'),
sinon = require('sinon'),
when = require('when'),
_ = require('underscore'),
_ = require('lodash'),
express = require('express'),
api = require('../../server/api'),
middleware = require('../../server/middleware').middleware;

View File

@ -3,7 +3,7 @@ var testUtils = require('../utils'),
should = require('should'),
sinon = require('sinon'),
when = require('when'),
_ = require("underscore"),
_ = require("lodash"),
errors = require('../../server/errorHandling'),
// Stuff we are testing

View File

@ -3,7 +3,7 @@ var testUtils = require('../utils'),
should = require('should'),
sinon = require('sinon'),
when = require('when'),
_ = require('underscore'),
_ = require('lodash'),
path = require('path'),
rewire = require('rewire'),
api = require('../../server/api'),

View File

@ -3,7 +3,7 @@ var testUtils = require('../utils'),
should = require('should'),
sinon = require('sinon'),
when = require('when'),
_ = require('underscore'),
_ = require('lodash'),
path = require('path'),
hbs = require('express-hbs'),

View File

@ -1,4 +1,4 @@
var _ = require('underscore'),
var _ = require('lodash'),
url = require('url'),
ApiRouteBase = '/ghost/api/v0.1/',
host = 'localhost',

View File

@ -1,4 +1,4 @@
var _ = require('underscore'),
var _ = require('lodash'),
uuid = require('node-uuid'),
DataGenerator = {};

View File

@ -50,7 +50,7 @@
"semver": "2.2.1",
"showdown": "0.3.1",
"sqlite3": "2.1.19",
"underscore": "1.5.2",
"lodash": "2.4.1",
"unidecode": "0.1.3",
"validator": "1.4.0",
"when": "2.7.0"