Skip to content

Commit

Permalink
[BUGFIX beta] Prefer includes over contains
Browse files Browse the repository at this point in the history
This pr adds the
[ember-runtime-enumerable-includes-polyfill](https://github.com/rwjblue/ember-runtime-enumerable-includes-polyfill)
to add includes if the user's version of Ember doesn't support it.
  • Loading branch information
bmac committed Aug 26, 2016
1 parent 79c81a5 commit 7b0faea
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addon/-private/system/record-arrays/record-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ export default Ember.ArrayProxy.extend(Ember.Evented, {
var content = get(this, 'content');
if (idx === undefined) {
content.addObject(internalModel);
} else if (!content.contains(internalModel)) {
} else if (!content.includes(internalModel)) {
content.insertAt(idx, internalModel);
}
},
Expand Down
2 changes: 1 addition & 1 deletion addon/-private/system/relationships/ext.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ var relatedTypesDescriptor = Ember.computed(function() {

assert("You specified a hasMany (" + meta.type + ") on " + meta.parentType + " but " + meta.type + " was not found.", modelName);

if (!types.contains(modelName)) {
if (!types.includes(modelName)) {
assert("Trying to sideload " + name + " on " + this.toString() + " but the type doesn't exist.", !!modelName);
types.push(modelName);
}
Expand Down
2 changes: 1 addition & 1 deletion addon/-private/system/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -758,7 +758,7 @@ Store = Service.extend({
function makeMissingRecordsRejector(requestedRecords) {
return function rejectMissingRecords(resolvedRecords) {
resolvedRecords = Ember.A(resolvedRecords);
var missingRecords = requestedRecords.reject((record) => resolvedRecords.contains(record));
var missingRecords = requestedRecords.reject((record) => resolvedRecords.includes(record));
if (missingRecords.length) {
warn('Ember Data expected to find records with the following ids in the adapter response but they were missing: ' + Ember.inspect(Ember.A(missingRecords).mapBy('id')), false, {
id: 'ds.store.missing-records-from-adapter'
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"ember-cli-test-info": "^1.0.0",
"ember-cli-version-checker": "^1.1.4",
"ember-inflector": "^1.9.4",
"ember-runtime-enumerable-includes-polyfill": "1.0.0",
"exists-sync": "0.0.3",
"git-repo-info": "^1.1.2",
"inflection": "^1.8.0",
Expand Down

0 comments on commit 7b0faea

Please sign in to comment.