Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support through Ember 2.4 #22

Merged
merged 1 commit into from
May 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"test"
],
"dependencies": {
"ember": ">= 1.5.0 <= 2.0.3"
"ember": ">= 1.5.0 <= 2.5.1"
},
"devDependencies": {
"handlebars": "~2.0.0"
Expand Down
47 changes: 18 additions & 29 deletions dist/rest-model.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
!function(e){if("object"==typeof exports)module.exports=e();else if("function"==typeof define&&define.amd)define(e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.RestModel=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);throw new Error("Cannot find module '"+o+"'")}var f=n[o]={exports:{}};t[o][0].call(f.exports,function(e){var n=t[o][1][e];return s(n?n:e)},f,f.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(_dereq_,module,exports){
'use strict';

var MutatingArray = _dereq_('./lib/mutating-array');
var cache = _dereq_('./lib/cache').create();
var utils = _dereq_('./lib/utils');

Expand Down Expand Up @@ -759,16 +758,28 @@ module.exports = Ember.Object.extend({
return result;
}).bind(this));

var results = MutatingArray.apply(content);
results.set('filters', Ember.copy(this.filters));
return results.runFilters();
return this.runFilters(content);
} else {
var result = this.create(response);
result.setProperties(parents);
return result;
}
},

replace: function replace(idx, amt, objects) {
var filters = this.filters;

filters.forEach(function applyFilter(filter) {
objects = objects.filter(filter);
});

return objects;
},

runFilters: (function (items) {
return this.replace(0, items.length, items);
}).observes('filters.[]'),

/**
* Request a given resource. Will use caching if the request is a "GET"
* request.
Expand Down Expand Up @@ -989,13 +1000,14 @@ module.exports = Ember.Object.extend({
prop[key] = val;
}
});
return this.extend(cp)._super.call(this, prop);
this.extend(cp);
return this._super.call(this, prop);
}
return this._super.call(this, attrs);
}
});

},{"./lib/cache":3,"./lib/mutating-array":4,"./lib/utils":5}],2:[function(_dereq_,module,exports){
},{"./lib/cache":3,"./lib/utils":4}],2:[function(_dereq_,module,exports){
'use strict';

function NullStorage() {
Expand Down Expand Up @@ -1310,29 +1322,6 @@ module.exports = Ember.Object.extend({
},{"./cache-storage":2}],4:[function(_dereq_,module,exports){
'use strict';

module.exports = Ember.Mixin.create({
filters: (function () {
return [];
}).property(),

replace: function replace(idx, amt, objects) {
var filters = this.get('filters');

filters.forEach(function applyFilter(filter) {
objects = objects.filter(filter);
});

return this._super(idx, amt, objects);
},

runFilters: (function () {
return this.replace(0, this.length, this);
}).observes('filters.[]')
});

},{}],5:[function(_dereq_,module,exports){
'use strict';

exports.arraysEqual = function (array1, array2) {
if (array1.length !== array2.length) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion dist/rest-model.min.js

Large diffs are not rendered by default.

22 changes: 17 additions & 5 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
'use strict';

var MutatingArray = require('./lib/mutating-array');
var cache = require('./lib/cache').create();
var utils = require('./lib/utils');

Expand Down Expand Up @@ -761,16 +760,28 @@ module.exports = Ember.Object.extend({
return result;
}.bind(this));

var results = MutatingArray.apply(content);
results.set('filters', Ember.copy(this.filters));
return results.runFilters();
return this.runFilters(content);
} else {
var result = this.create(response);
result.setProperties(parents);
return result;
}
},

replace: function(idx, amt, objects) {
var filters = this.filters;

filters.forEach(function applyFilter(filter) {
objects = objects.filter(filter);
});

return objects;
},

runFilters: function(items) {
return this.replace(0, items.length, items);
}.observes('filters.[]'),

/**
* Request a given resource. Will use caching if the request is a "GET"
* request.
Expand Down Expand Up @@ -988,7 +999,8 @@ module.exports = Ember.Object.extend({
prop[key] = val;
}
});
return this.extend(cp)._super.call(this, prop);
this.extend(cp);
return this._super.call(this, prop);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can no longer chain things like we were doing before

}
return this._super.call(this, attrs);
}
Expand Down
21 changes: 0 additions & 21 deletions lib/mutating-array.js

This file was deleted.

26 changes: 0 additions & 26 deletions test/mutating-array-test.js

This file was deleted.