--- a/backbone.shard.js Thu Mar 21 15:30:18 2013 +0900
+++ b/backbone.shard.js Thu Mar 21 15:47:33 2013 +0900
- * (c) 2012 Anton Shestakov.
+ * (c) 2013 Anton Shestakov.
* This extension to Backbone may be freely distributed
return _.map(this.models, function(model) { return model.get(attr); });
- return _(this.models).chain();
// Underscore methods that we want to implement on the Shard.
var methods = ['forEach', 'each', 'map', 'collect', 'reduce', 'foldl',
'inject', 'reduceRight', 'foldr', 'find', 'detect', 'filter', 'select',
- 'reject', 'every', 'all', 'some', 'any', 'include', 'contains', 'invoke'
- , 'max', 'min', 'sortedIndex', 'toArray', 'size', 'first', 'head',
- 'take', 'initial', 'rest', 'tail', 'last', 'without', 'indexOf',
- 'shuffle', 'lastIndexOf', 'isEmpty'];
+ 'reject', 'every', 'all', 'some', 'any', 'include', 'contains', 'invoke',
+ 'max', 'min', 'toArray', 'size', 'first', 'head', 'take', 'initial', 'rest',
+ 'tail', 'drop', 'last', 'without', 'indexOf', 'shuffle', 'lastIndexOf',
// Mix in each Underscore method as a proxy to `Shard#models`.
_.each(methods, function(method) {
--- a/demo.html Thu Mar 21 15:30:18 2013 +0900
+++ b/demo.html Thu Mar 21 15:47:33 2013 +0900
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>
- <script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js"></script>
+ <script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js"></script>
<script src="backbone.shard.js"></script>
--- a/test/index.html Thu Mar 21 15:30:18 2013 +0900
+++ b/test/index.html Thu Mar 21 15:47:33 2013 +0900
<script src="http://code.jquery.com/qunit/qunit-1.10.0.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.4.4/underscore-min.js"></script>
- <script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/0.9.2/backbone-min.js"></script>
+ <script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js"></script>
<script src="../backbone.shard.js"></script>
<script src="basic-filters.js"></script>
--- a/test/underscore-methods.js Thu Mar 21 15:30:18 2013 +0900
+++ b/test/underscore-methods.js Thu Mar 21 15:47:33 2013 +0900
-// TODO: test sortedIndex
test('Underscore methods: basics', function() {
strictEqual(shard.first(), a, 'first() works');
strictEqual(shard.last(), c, 'last() works');
}, ''), 'cba', 'reduceRight() works');
-test('Underscore methods: method aliases (working in Backbone.Collection since 0.9.9)', function() {
+test('Underscore methods: method aliases', function() {
strictEqual(shard.head(), a, 'head() works');
deepEqual(shard.tail(), [b, c], 'tail() works');
+ deepEqual(shard.drop(), [b, c], 'drop() works');
deepEqual(shard.countBy('data'), {a: 1, b: 1, c: 1}, 'countBy() works');
deepEqual(shard.select(function(model) {