Download:
child 30:42894d55dd12
parent 28:c8450f79d9d1
29:89ae20cbe0dd
Anton Shestakov <av6@dwimlabs.net>, Sat, 01 Jul 2017 07:33:53 +0800
js: use === where appropriate

2 файлов изменено, 8 вставок(+), 8 удалений(-) [+]
backbone.shard.js file | annotate | diff | comparison | revisions
test/underscore-methods.js file | annotate | diff | comparison | revisions
--- a/backbone.shard.js Sat Jul 01 07:32:07 2017 +0800
+++ b/backbone.shard.js Sat Jul 01 07:33:53 2017 +0800
@@ -16,7 +16,7 @@
this._collection
.on('all', function(event, model) {
- if (event == 'change') {
+ if (event === 'change') {
if (this._filter(model) && _(this.models).contains(model)) {
this.trigger.apply(this, arguments);
}
--- a/test/underscore-methods.js Sat Jul 01 07:32:07 2017 +0800
+++ b/test/underscore-methods.js Sat Jul 01 07:33:53 2017 +0800
@@ -9,7 +9,7 @@
col = new Backbone.Collection([a, b, c, d]);
shard = new Backbone.Shard({
collection: col,
- filter: function(model) { return model.get('data') != 'd'; }
+ filter: function(model) { return model.get('data') !== 'd'; }
});
}
});
@@ -37,10 +37,10 @@
deepEqual(shard.indexBy('data'), {a: a, b: b, c: c}, 'indexBy() works');
var sh = shard.shuffle().reduce(function(memo, model) { return memo += model.get('data'); }, '');
- ok(sh.length == 3 && _(sh).contains('a') && _(sh).contains('b') && _(sh).contains('c'), 'shuffle() works');
+ ok(sh.length === 3 && _(sh).contains('a') && _(sh).contains('b') && _(sh).contains('c'), 'shuffle() works');
var s = shard.sample(999).reduce(function(memo, model) { return memo += model.get('data'); }, '');
- ok(s.length == 3 && _(s).contains('a') && _(s).contains('b') && _(s).contains('c'), 'sample() works');
+ ok(s.length === 3 && _(s).contains('a') && _(s).contains('b') && _(s).contains('c'), 'sample() works');
});
test('Underscore methods: searching and filtering', function() {
@@ -63,15 +63,15 @@
}), c, 'max() works');
strictEqual(shard.find(function(model) {
- return model.get('data') == 'b';
+ return model.get('data') === 'b';
}), b, 'find() works');
deepEqual(shard.filter(function(model) {
- return model.get('data') != 'b';
+ return model.get('data') !== 'b';
}), [a, c], 'filter() works');
deepEqual(shard.reject(function(model) {
- return model.get('data') == 'b';
+ return model.get('data') === 'b';
}), [a, c], 'reject() works');
equal(shard.contains(b), true, 'contains() works');
@@ -119,7 +119,7 @@
equal(shard.includes(b), true, 'includes() works');
deepEqual(shard.select(function(model) {
- return model.get('data') != 'b';
+ return model.get('data') !== 'b';
}), [a, c], 'select() works');
equal(shard.foldl(function(memo, model) {