Skip to content

Commit

Permalink
replaces usage of Ember.keys with _.keys to avoid [email protected] deprec…
Browse files Browse the repository at this point in the history
…ation warnings emberjs/ember.js#11511
  • Loading branch information
makepanic authored and samselikoff committed Aug 11, 2015
1 parent 2ff1e99 commit ca951a3
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 14 deletions.
2 changes: 1 addition & 1 deletion addon/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import Response from './response';
var isArray = Ember.isArray;
var isBlank = Ember.isBlank;
var typeOf = Ember.typeOf;
var keys = Ember.keys;
var keys = _.keys;

var defaultCodes = {
get: 200,
Expand Down
13 changes: 7 additions & 6 deletions addon/db.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Ember from 'ember';

var allDigitsRegex = /^\d+$/;
var keys = _.keys;

/*
An identity map.
Expand Down Expand Up @@ -39,7 +40,7 @@ export default function() {
this.loadData = function(data) {
var _this = this;

Ember.keys(data).forEach(function(collection) {
keys(data).forEach(function(collection) {
_this.createCollection(collection);
_this._insert(collection, data[collection]);
});
Expand Down Expand Up @@ -90,7 +91,7 @@ export default function() {
this._where = function(collection, query) {
var records = this[collection];

Object.keys(query).forEach(function(queryKey) {
keys(query).forEach(function(queryKey) {
records = records.filter(function(record) {
return String(record[queryKey]) === String(query[queryKey]);
});
Expand All @@ -103,7 +104,7 @@ export default function() {
if (typeof attrs === 'undefined') {
attrs = target;
this[collection].forEach(function(record) {
Object.keys(attrs).forEach(function(attr) {
keys(attrs).forEach(function(attr) {
record[attr] = attrs[attr];
});
});
Expand All @@ -114,7 +115,7 @@ export default function() {
var id = target;
var record = this._find(collection, id);

Object.keys(attrs).forEach(function(attr) {
keys(attrs).forEach(function(attr) {
record[attr] = attrs[attr];
});

Expand All @@ -125,7 +126,7 @@ export default function() {
var records = this._where(collection, query);

records.forEach(function(record) {
Object.keys(attrs).forEach(function(attr) {
keys(attrs).forEach(function(attr) {
record[attr] = attrs[attr];
});
});
Expand Down Expand Up @@ -156,7 +157,7 @@ export default function() {

this.emptyData = function() {
var _this = this;
Object.keys(this).forEach(function(key) {
keys(this).forEach(function(key) {
if (key === 'loadData' || key === 'emptyData') {
return;
}
Expand Down
4 changes: 1 addition & 3 deletions addon/factory.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import Ember from 'ember';

var Factory = function() {
this.build = function(sequence) {
var object = {};
var attrs = this.attrs || {};

Ember.keys(attrs).forEach(function(key) {
_.keys(attrs).forEach(function(key) {
var type = typeof attrs[key];

if (type === 'function') {
Expand Down
3 changes: 1 addition & 2 deletions addon/server.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Ember from 'ember';
import { pluralize } from './utils/inflector';
import Pretender from 'pretender';
import Db from './db';
Expand Down Expand Up @@ -86,7 +85,7 @@ export default class Server {
this._factoryMap = factoryMap;

// Create a collection for each factory
Ember.keys(factoryMap).forEach(function(type) {
_.keys(factoryMap).forEach(function(type) {
_this.db.createCollection(pluralize(type));
});
}
Expand Down
2 changes: 1 addition & 1 deletion addon/utils/read-modules.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export default function(prefix) {
);
var modulesMap = {fixtures: {}, factories: {}, scenarios: {}};

Ember.keys(requirejs._eak_seen).filter(function(key) {
_.keys(requirejs._eak_seen).filter(function(key) {
return mirageModuleRegExp.test(key);
}).forEach(function(moduleName) {
if (moduleName.match('\.jshint')) { // ignore autogenerated .jshint files
Expand Down
2 changes: 1 addition & 1 deletion app/initializers/ember-cli-mirage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import readModules from 'ember-cli-mirage/utils/read-modules';
function hasModulesOfType(modulesMap, type) {
var modulesOfType = modulesMap[type] || {};

return Ember.keys(modulesOfType).length > 0;
return _.keys(modulesOfType).length > 0;
}

export default {
Expand Down

0 comments on commit ca951a3

Please sign in to comment.