Ilia Ablamonov
19b88d2c2d
Fixed Collection#set regression when parse returns falsy value
...
Fixes #3871
2015-12-01 10:00:36 +04:00
John-David Dalton
24ac0661bc
Ensure attr is a string when passed to this.map.
2015-11-24 09:11:00 -08:00
John-David Dalton
c23fb5dc4d
Simplify pluck, thanks @jridgewell.
2015-11-23 22:28:37 -08:00
John-David Dalton
1be3730cef
Change _.invoke use to _.map.
2015-11-23 16:37:14 -08:00
mieszko4
681dea993d
Make item arrayizing consistent through the file
2015-11-17 05:44:44 +01:00
Justin Ridgewell
569f07e6a6
Merge pull request #3820 from jridgewell/reduce-deopt
...
Deopt Underscore methods that change on arguments
2015-10-28 09:36:49 -05:00
Justin Ridgewell
7ed8582d19
Deopt Underscore methods that change on arguments
...
All of our currently deoptimized Underscore methods (`pick`, `omit`,
`invoke`, `without`, and `difference`) change behavior based on the
number of arguments pass to the call. This both adds `reduce` (and
friends).
Supersedes (and incorporates) #3810 .
2015-10-28 10:22:11 -04:00
Graeme Yeates
d1880dda6c
Merge pull request #3834 from jridgewell/model-change-id-regression
...
Fix _onModelEvent regression
2015-10-26 15:18:41 -04:00
Justin Ridgewell
67667c5b8f
Fix _onModelEvent regression
...
Fixes #3662 .
2015-10-26 15:13:17 -04:00
Justin Ridgewell
7bbbcc8c51
Always return removed array from #_removeModels
...
Fixes #3835 .
2015-10-26 11:19:26 -04:00
Justin Ridgewell
fda02db428
Fix 1.2.2 Model#id regression
...
Fixes #3778 .
2015-10-22 11:04:25 -04:00
just-boris
345dd7b128
Allow to make reduce without initial value
2015-10-07 10:59:00 -04:00
Jacob Buck
6cff9419fb
Add findIndex and findLastIndex underscore methods to Collection.
2015-09-30 10:20:33 +13:00
Jeremy Ashkenas
979adf5200
Merge pull request #3803 from jridgewell/removeModels-regression
...
Fix _removeModels regression
2015-09-25 10:48:48 -04:00
Justin Ridgewell
4b64eebcba
Fix _removeModels regression
...
Fixes #3693 .
This leaves open the question of whether events triggered on the model
during a ‘remove’ listener should also trigger on the model. Just
something to revisit for V2.
```js
col.on('other', (model) => {
// Should this be triggered?
});
col.on('remove', (model) => {
// If the model is really "removed" (we can't `#get` it anymore)
// by the time this listener is called, then I'd argue that this
// shouldn't trigger the 'other' event on the collection...
model.trigger('other');
});
```
2015-09-23 11:24:16 -04:00
Graeme Yeates
3c6fabbc8f
Use _.create in extend
2015-09-18 12:58:02 -04:00
Jeremy Ashkenas
05fde9e201
Backbone.js 1.2.3
2015-09-03 11:56:05 -04:00
Andrew Humphreys
91d0824190
fix error when adding model to collection at an out of bounds index
2015-08-21 17:15:07 +01:00
Jeremy Ashkenas
00f8b6fe79
Backbone.js 1.2.2
2015-08-19 15:03:44 -04:00
Jeremy Ashkenas
09fca1dc7e
Merge pull request #3663 from jridgewell/collection-set-style-compat
...
Collection#set style (Backwards Compatible)
2015-08-18 17:35:20 -04:00
John-David Dalton
1f29c6713a
Add Modernizr style check for 'onhashchange' to avoid issues in IE compat modes. [ closes #3730 ]
2015-08-10 12:55:41 -07:00
Graeme Yeates
a2763083c6
Merge pull request #3676 from jridgewell/collection-includes
...
Add Collection#includes for underscore v1.8
2015-08-06 21:17:43 -04:00
John-David Dalton
7dc9708cc1
Use _.bind instead of context param of _.sortBy.
2015-08-03 13:52:51 -07:00
Justin Ridgewell
376249e46b
Add Collection#includes for underscore v1.8
2015-08-03 16:35:15 -04:00
Justin Ridgewell
f55b4a2245
Merge pull request #3680 from akre54/multi-event-maps
...
Event maps should support multiple event syntax
2015-06-18 10:21:50 -04:00
Adam Krebs
28ea4b7785
fix addMethod examples
2015-06-12 15:12:15 -04:00
Adam Krebs
adf13ce852
Reorganize addUnderscoreMethods logic
2015-06-12 13:58:38 -04:00
Justin Ridgewell
b60b7da710
modelProperty doesn't need to check for null
...
Since `#models` is filled with only model instances, there's no need to
check if model isn't `null`.
re: #3667 .
2015-06-12 13:28:55 -04:00
sophietk
007a1b85f4
Collection methods from underscore (reject, filter, some, every, ...) take function, set of model attributes, or attribute name as argument
...
- Expand the use of inherited underscore methods, to iteratee as function, object or string
- Apply iteratee transformation to groupBy, countBy, sortBy, indexBy
2015-06-11 18:04:30 +02:00
Adam Krebs
6b927eb5e7
Event maps should support multiple event syntax
2015-06-10 17:33:03 -04:00
Justin Ridgewell
a3a0484156
Merge pull request #3679 from akre54/doc-improvements
...
Update comments throughout the code
2015-06-10 15:32:46 -04:00
Adam Krebs
2be220f28f
Update comments throughout the code
2015-06-10 14:26:01 -04:00
Justin Ridgewell
c86de5b72b
Use some instead of any
2015-06-10 14:18:36 -04:00
Justin Ridgewell
dce3bdb16e
Merge pull request #3646 from jashkenas/model-set-id-update
...
Update model's id with #get
2015-06-10 11:27:47 -04:00
jdalton
c23f6132c0
Replace _.any with _.some.
2015-06-09 21:44:17 -07:00
jdalton
74427c9e76
Remove the only _.bindAll use.
2015-06-09 11:01:57 -07:00
Jeremy Ashkenas
938a8ff934
Backbone 1.2.1
2015-06-04 18:09:12 -04:00
Justin Ridgewell
6215000047
Ungolf #create assignment
2015-06-03 21:58:53 -04:00
Justin Ridgewell
d1cc8b799c
Use a simple slice
2015-06-03 21:29:57 -04:00
Justin Ridgewell
0052c2fc5c
Keep backwards compatibility with v1
2015-06-03 20:59:59 -04:00
Justin Ridgewell
9a15fcff8b
Use a splicing for-loop for stabler performance
...
- [Base case (`#unshift`)](http://jsperf.com/insert-array-into-another-array/6 )
- ["Normal" collection size](http://jsperf.com/insert-array-into-another-array/8 )
- [Large collection](http://jsperf.com/insert-array-into-another-array/7 )
2015-06-03 02:53:41 -04:00
Justin Ridgewell
7ba78fe66d
Remove unnecessary options clone
2015-06-03 02:53:41 -04:00
Justin Ridgewell
203052e164
Do not update models if nothing is set
2015-06-03 02:53:41 -04:00
Justin Ridgewell
198726d498
Make adding models with at **orders** faster
...
Splicing in a loop is the worst thing you can do:
http://jsperf.com/insert-array-into-another-array/4
2015-06-03 02:53:40 -04:00
Justin Ridgewell
a082d2fdf9
Return only added or merged models
...
Mirrors the change in #3512 .
2015-06-03 02:53:40 -04:00
Justin Ridgewell
c105cc200f
Invert conditional
2015-06-03 02:53:40 -04:00
Justin Ridgewell
e42e3118ac
Invert ternary
2015-06-03 02:53:40 -04:00
Justin Ridgewell
7902a2f13f
Golf assignment
2015-06-03 02:53:40 -04:00
Justin Ridgewell
496d083888
Ungolf assignments
2015-06-03 02:53:40 -04:00
Justin Ridgewell
1b8c9b4627
Declare variables as they are used
2015-06-03 02:53:40 -04:00