Permalink
Browse files

Revert "Use _.result instead of getValue where possible"

This reverts commit b1526bb.

Conflicts:
	src/data-object.js
  • Loading branch information...
1 parent d08989c commit e4a38685a07206f8900862f92a64f08cbc7af3c3 Ryan Eastridge committed Jan 3, 2013
Showing with 7 additions and 7 deletions.
  1. +2 −2 src/collection.js
  2. +2 −2 src/data-object.js
  3. +1 −1 src/helpers/collection.js
  4. +2 −2 src/thorax.js
View
@@ -1,4 +1,4 @@
-/*global createRegistryWrapper, dataObject, getEventCallback, modelCidAttributeName, viewCidAttributeName */
+/*global createRegistryWrapper, dataObject, getEventCallback, getValue, modelCidAttributeName, viewCidAttributeName */
var _fetch = Backbone.Collection.prototype.fetch,
_reset = Backbone.Collection.prototype.reset,
collectionCidAttributeName = 'data-collection-cid',
@@ -17,7 +17,7 @@ Thorax.Collection = Backbone.Collection.extend({
}
},
isPopulated: function() {
- return this._fetched || this.length > 0 || (!this.length && !_.result(this, 'url'));
+ return this._fetched || this.length > 0 || (!this.length && !getValue(this, 'url'));
},
shouldFetch: function(options) {
return options.fetch && !!_.result(this, 'url') && !this.isPopulated();
View
@@ -1,4 +1,4 @@
-/*global inheritVars, walkInheritTree */
+/*global getValue, inheritVars, walkInheritTree */
function dataObject(type, spec) {
spec = inheritVars[type] = _.defaults({
@@ -19,7 +19,7 @@ function dataObject(type, spec) {
function setObject(dataObject, options) {
var old = this[type],
- $el = _.result(this, spec.$el);
+ $el = getValue(this, spec.$el);
if (dataObject === old) {
return this;
@@ -40,7 +40,7 @@ Thorax.CollectionHelperView = Thorax.View.extend({
},
// will be used by emptyView and emptyTemplate
_getContext: function(attributes) {
- return _.extend({}, _.result(this.parent, 'context'), attributes || {});
+ return _.extend({}, getValue(this.parent, 'context'), attributes || {});
},
setAsPrimaryCollectionHelper: function(collection) {
this.$el.attr(primaryCollectionAttributeName, collection.cid);
View
@@ -1,4 +1,4 @@
-/*global cloneInheritVars, createInheritVars, createRegistryWrapper, inheritVars */
+/*global cloneInheritVars, createInheritVars, createRegistryWrapper, getValue, inheritVars */
//support zepto.forEach on jQuery
if (!$.fn.forEach) {
@@ -147,7 +147,7 @@ Thorax.View = Backbone.View.extend({
},
_getContext: function(attributes) {
- return _.extend({}, _.result(this, 'context'), attributes || {});
+ return _.extend({}, getValue(this, 'context'), attributes || {});
},
// Private variables in handlebars / options.data in template helpers

0 comments on commit e4a3868

Please sign in to comment.