lint: remove usages of "=="
Before adoption: this commit came in with the history the project adopted, so no landing records it.
closes #3540
authored by Alejandro Estrada · committed by Douglas Christopher Wilson · parent 972ada9 · Browse files · 16 files·+24 added−23 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Diff stats
16 files+24 added−23 removed
- tests:+13 added−13 removed
- other:+11 added−10 removed
Provenance
- Commit
40e04ec- Tree
bbf3cbf- Author
Alejandro Estrada <estrada9166@hotmail.com>- Committer
Douglas Christopher Wilson <doug@somethingdoug.com>- Parent
972ada9
16 files changed+24 added−23 removed
modified:examples/auth/index.js+1 added-1 removed
63 unmodified lines6465666768686970717258 unmodified lines63 unmodified lines // the hash against the pass / salt, if there is a match we // found the user hash({ password: pass, salt: user.salt }, function (err, pass, salt, hash) { if (err) return fn(err); if (hash == user.hash) return fn(null, user); if (hash === user.hash) return fn(null, user) fn(new Error('invalid password')); });}
58 unmodified linesmodified:examples/cookies/index.js+1 added-1 removed
6 unmodified lines7891011111213141532 unmodified lines6 unmodified linesvar logger = require('morgan');var cookieParser = require('cookie-parser');
// custom log formatif ('test' != process.env.NODE_ENV) app.use(logger(':method :url'));if (process.env.NODE_ENV !== 'test') app.use(logger(':method :url'))
// parses request cookies, populating// req.cookies and req.signedCookies// when the secret is passed, used32 unmodified linesmodified:examples/error/index.js+1 added-1 removed
3 unmodified lines4 5 var express = require('../../');6 var logger = require('morgan');7 var app = module.exports = express();8-var test = app.get('env') == 'test';8+var test = app.get('env') === 'test'9 10 if (!test) app.use(logger('dev'));11 12 // error handling middleware have an arity of 439 unmodified linesmodified:examples/error-pages/index.js+2 added-2 removed
4 unmodified lines5 var express = require('../../');6 var path = require('path');7 var app = module.exports = express();8 var logger = require('morgan');9-var silent = 'test' == process.env.NODE_ENV;9+var silent = process.env.NODE_ENV === 'test'10 11 // general config12 app.set('views', path.join(__dirname, 'views'));13 app.set('view engine', 'ejs');4 unmodified lines18 app.enable('verbose errors');19 20 // disable them in production21 // use $ NODE_ENV=production node examples/error-pages22-if ('production' == app.settings.env) app.disable('verbose errors');22+if (app.settings.env === 'production') app.disable('verbose errors')23 24 silent || app.use(logger('dev'));25 26 // Routes75 unmodified linesmodified:examples/route-map/index.js+1 added-1 removed
2 unmodified lines3 */4 5 var express = require('../../lib/express');6 7-var verbose = process.env.NODE_ENV != 'test';7+var verbose = process.env.NODE_ENV !== 'test'8 9 var app = module.exports = express();10 11 app.map = function(a, route){61 unmodified linesmodified:examples/route-middleware/index.js+2 added-2 removed
32 unmodified lines33 34 function andRestrictToSelf(req, res, next) {35 // If our authenticated user is the user we are viewing36 // then everything is fine :)37- if (req.authenticatedUser.id == req.user.id) {37+ if (req.authenticatedUser.id === req.user.id) {38 next();39 } else {40 // You may want to implement specific exceptions41 // such as UnauthorizedError or similar so that you4 unmodified lines46 }47 48 function andRestrictTo(role) {49 return function(req, res, next) {50- if (req.authenticatedUser.role == role) {50+ if (req.authenticatedUser.role === role) {51 next();52 } else {53 next(new Error('Unauthorized'));54 }34 unmodified linesmodified:examples/search/public/client.js+1 added-1 removed
3 unmodified lines4567889101112133 unmodified linessearch.addEventListener('keyup', function(){ var xhr = new XMLHttpRequest; xhr.open('GET', '/search/' + search.value, true); xhr.onreadystatechange = function(){ if (4 == xhr.readyState) { if (xhr.readyState === 4) { code.textContent = xhr.responseText; } }; xhr.send();}, false);modified:examples/view-locals/index.js+1 added-1 removed
11 unmodified lines12 13 // filter ferrets only14 15 function ferrets(user) {16- return user.species == 'ferret';16+ return user.species === 'ferret'17 }18 19 // naive nesting approach,20 // delegating errors to next(err)133 unmodified linesmodified:test/app.param.js+1 added-1 removed
6 unmodified lines7 it('should map app.param(name, ...) logic', function(done){8 var app = express();9 10 app.param(function(name, regexp){11- if (Object.prototype.toString.call(regexp) == '[object RegExp]') { // See #155711+ if (Object.prototype.toString.call(regexp) === '[object RegExp]') { // See #155712 return function(req, res, next, val){13 var captures;14 if (captures = regexp.exec(String(val))) {15 req.params[name] = captures[1];351 unmodified linesmodified:test/app.router.js+2 added-2 removed
39 unmodified lines40 it('should include ' + method.toUpperCase(), function(done){41 var app = express();42 43 app[method]('/foo', function(req, res){44- if ('head' == method) {44+ if (method === 'head') {45 res.end();46 } else {47 res.end(method);48 }49 });50 51 request(app)52 [method]('/foo')53- .expect('head' == method ? '' : method, done);53+ .expect(method === 'head' ? '' : method, done)54 })55 56 it('should reject numbers for app.' + method, function(){57 var app = express();1031 unmodified linesmodified:test/req.signedCookies.js+1 added-1 removed
9 unmodified lines10 11 app.use(cookieParser('secret'));12 13 app.use(function(req, res){14- if ('/set' == req.path) {14+ if (req.path === '/set') {15 res.cookie('obj', { foo: 'bar' }, { signed: true });16 res.end();17 } else {18 res.send(req.signedCookies);18 unmodified linesmodified:test/res.format.js+3 added-3 removed
15 unmodified lines16 res.send('<p>hey</p>');17 },18 19 'application/json': function(a, b, c){20- assert(req == a);21- assert(res == b);22- assert(next == c);20+ assert(req === a)21+ assert(res === b)22+ assert(next === c)23 res.send({ message: 'hey' });24 }25 });26 });189 unmodified linesmodified:test/res.json.js+1 added-1 removed
127 unmodified lines128 it('should be passed to JSON.stringify()', function(done){129 var app = express();130 131 app.set('json replacer', function(key, val){132- return '_' == key[0]132+ return key[0] === '_'133 ? undefined134 : val;135 });136 77 unmodified linesmodified:test/res.jsonp.js+1 added-1 removed
267 unmodified lines268 it('should be passed to JSON.stringify()', function(done){269 var app = express();270 271 app.set('json replacer', function(key, val){272- return '_' == key[0]272+ return key[0] === '_'273 ? undefined274 : val;275 });276 91 unmodified linesmodified:test/Router.js+4 added-4 removed
6 unmodified lines7 8 describe('Router', function(){9 it('should return a function with router methods', function() {10 var router = new Router();11- assert(typeof router == 'function');11+ assert(typeof router === 'function')12 13- assert(typeof router.get == 'function');14- assert(typeof router.handle == 'function');15- assert(typeof router.use == 'function');13+ assert(typeof router.get === 'function')14+ assert(typeof router.handle === 'function')15+ assert(typeof router.use === 'function')16 });17 18 it('should support .use of other routers', function(done){19 var router = new Router();541 unmodified linesmodified:.eslintrc.yml+1 added
1 root: true2 3 rules:4 eol-last: error5+ eqeqeq: [error, allow-null]6 indent: [error, 2, { SwitchCase: 1 }]7 no-trailing-spaces: error8 no-unused-vars: [error, { vars: all, args: none, ignoreRestSiblings: true }]