backbone-rails 0.9.10 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,12 +1,13 @@
1
- // Underscore.js 1.4.3
2
- // http://underscorejs.org
3
- // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
4
- // Underscore may be freely distributed under the MIT license.
1
+ // Underscore.js 1.4.4
2
+ // ===================
5
3
 
6
- (function() {
4
+ // > http://underscorejs.org
5
+ // > (c) 2009-2013 Jeremy Ashkenas, DocumentCloud Inc.
6
+ // > Underscore may be freely distributed under the MIT license.
7
7
 
8
- // Baseline setup
9
- // --------------
8
+ // Baseline setup
9
+ // --------------
10
+ (function() {
10
11
 
11
12
  // Establish the root object, `window` in the browser, or `global` on the server.
12
13
  var root = this;
@@ -64,7 +65,7 @@
64
65
  }
65
66
 
66
67
  // Current version.
67
- _.VERSION = '1.4.3';
68
+ _.VERSION = '1.4.4';
68
69
 
69
70
  // Collection Functions
70
71
  // --------------------
@@ -224,8 +225,9 @@
224
225
  // Invoke a method (with arguments) on every item in a collection.
225
226
  _.invoke = function(obj, method) {
226
227
  var args = slice.call(arguments, 2);
228
+ var isFunc = _.isFunction(method);
227
229
  return _.map(obj, function(value) {
228
- return (_.isFunction(method) ? method : value[method]).apply(value, args);
230
+ return (isFunc ? method : value[method]).apply(value, args);
229
231
  });
230
232
  };
231
233
 
@@ -235,10 +237,10 @@
235
237
  };
236
238
 
237
239
  // Convenience version of a common use case of `filter`: selecting only objects
238
- // with specific `key:value` pairs.
239
- _.where = function(obj, attrs) {
240
- if (_.isEmpty(attrs)) return [];
241
- return _.filter(obj, function(value) {
240
+ // containing specific `key:value` pairs.
241
+ _.where = function(obj, attrs, first) {
242
+ if (_.isEmpty(attrs)) return first ? null : [];
243
+ return _[first ? 'find' : 'filter'](obj, function(value) {
242
244
  for (var key in attrs) {
243
245
  if (attrs[key] !== value[key]) return false;
244
246
  }
@@ -246,6 +248,12 @@
246
248
  });
247
249
  };
248
250
 
251
+ // Convenience version of a common use case of `find`: getting the first object
252
+ // containing specific `key:value` pairs.
253
+ _.findWhere = function(obj, attrs) {
254
+ return _.where(obj, attrs, true);
255
+ };
256
+
249
257
  // Return the maximum element or (element-based computation).
250
258
  // Can't optimize arrays of integers longer than 65,535 elements.
251
259
  // See: https://bugs.webkit.org/show_bug.cgi?id=80797
@@ -567,26 +575,23 @@
567
575
  // Function (ahem) Functions
568
576
  // ------------------
569
577
 
570
- // Reusable constructor function for prototype setting.
571
- var ctor = function(){};
572
-
573
578
  // Create a function bound to a given object (assigning `this`, and arguments,
574
- // optionally). Binding with arguments is also known as `curry`.
575
- // Delegates to **ECMAScript 5**'s native `Function.bind` if available.
576
- // We check for `func.bind` first, to fail fast when `func` is undefined.
579
+ // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if
580
+ // available.
577
581
  _.bind = function(func, context) {
578
- var args, bound;
579
582
  if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
580
- if (!_.isFunction(func)) throw new TypeError;
581
- args = slice.call(arguments, 2);
582
- return bound = function() {
583
- if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
584
- ctor.prototype = func.prototype;
585
- var self = new ctor;
586
- ctor.prototype = null;
587
- var result = func.apply(self, args.concat(slice.call(arguments)));
588
- if (Object(result) === result) return result;
589
- return self;
583
+ var args = slice.call(arguments, 2);
584
+ return function() {
585
+ return func.apply(context, args.concat(slice.call(arguments)));
586
+ };
587
+ };
588
+
589
+ // Partially apply a function by creating a version that has had some of its
590
+ // arguments pre-filled, without changing its dynamic `this` context.
591
+ _.partial = function(func) {
592
+ var args = slice.call(arguments, 1);
593
+ return function() {
594
+ return func.apply(this, args.concat(slice.call(arguments)));
590
595
  };
591
596
  };
592
597
 
@@ -594,7 +599,7 @@
594
599
  // all callbacks defined on an object belong to it.
595
600
  _.bindAll = function(obj) {
596
601
  var funcs = slice.call(arguments, 1);
597
- if (funcs.length == 0) funcs = _.functions(obj);
602
+ if (funcs.length === 0) funcs = _.functions(obj);
598
603
  each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
599
604
  return obj;
600
605
  };
@@ -1019,7 +1024,7 @@
1019
1024
  max = min;
1020
1025
  min = 0;
1021
1026
  }
1022
- return min + (0 | Math.random() * (max - min + 1));
1027
+ return min + Math.floor(Math.random() * (max - min + 1));
1023
1028
  };
1024
1029
 
1025
1030
  // List of HTML entities for escaping.
@@ -1075,7 +1080,7 @@
1075
1080
  // Useful for temporary DOM ids.
1076
1081
  var idCounter = 0;
1077
1082
  _.uniqueId = function(prefix) {
1078
- var id = '' + ++idCounter;
1083
+ var id = ++idCounter + '';
1079
1084
  return prefix ? prefix + id : id;
1080
1085
  };
1081
1086
 
@@ -1110,6 +1115,7 @@
1110
1115
  // Underscore templating handles arbitrary delimiters, preserves whitespace,
1111
1116
  // and correctly escapes quotes within interpolated code.
1112
1117
  _.template = function(text, data, settings) {
1118
+ var render;
1113
1119
  settings = _.defaults({}, settings, _.templateSettings);
1114
1120
 
1115
1121
  // Combine delimiters into one regular expression via alternation.
@@ -1148,7 +1154,7 @@
1148
1154
  source + "return __p;\n";
1149
1155
 
1150
1156
  try {
1151
- var render = new Function(settings.variable || 'obj', '_', source);
1157
+ render = new Function(settings.variable || 'obj', '_', source);
1152
1158
  } catch (e) {
1153
1159
  e.source = source;
1154
1160
  throw e;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: backbone-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.10
4
+ version: 1.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-04 00:00:00.000000000 Z
12
+ date: 2013-05-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails