--- a/backbone.shard.js Sat Jul 01 07:32:07 2017 +0800
+++ b/backbone.shard.js Sat Jul 01 07:33:53 2017 +0800
.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
col = new Backbone.Collection([a, b, c, d]);
shard = new Backbone.Shard({
- filter: function(model) { return model.get('data') != 'd'; }
+ filter: function(model) { return model.get('data') !== 'd'; }
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() {
strictEqual(shard.find(function(model) {
- return model.get('data') == 'b';
+ return model.get('data') === 'b';
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');
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) {