Ember.keys is deprected in favor of Object.keys

This commit is contained in:
Robin Ward 2016-04-28 16:37:20 -04:00
parent 187d7d6f96
commit 400c061046
No known key found for this signature in database
GPG key ID: 0E091E2B4ED1B83D
15 changed files with 19 additions and 19 deletions

View file

@ -107,7 +107,7 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
$('noscript').remove();
Ember.keys(requirejs._eak_seen).forEach(function(key) {
Object.keys(requirejs._eak_seen).forEach(function(key) {
if (/\/pre\-initializers\//.test(key)) {
var module = require(key, null, null, true);
if (!module) { throw new Error(key + ' must export an initializer.'); }
@ -115,7 +115,7 @@ window.Discourse = Ember.Application.createWithMixins(Discourse.Ajax, {
}
});
Ember.keys(requirejs._eak_seen).forEach(function(key) {
Object.keys(requirejs._eak_seen).forEach(function(key) {
if (/\/initializers\//.test(key)) {
var module = require(key, null, null, true);
if (!module) { throw new Error(key + ' must export an initializer.'); }

View file

@ -218,7 +218,7 @@ export default Ember.Component.extend({
const mouseTrap = Mousetrap(this.$('.d-editor-input')[0]);
const shortcuts = this.get('toolbar.shortcuts');
Ember.keys(shortcuts).forEach(sc => {
Object.keys(shortcuts).forEach(sc => {
const button = shortcuts[sc];
mouseTrap.bind(sc, () => {
this.send(button.action, button);
@ -244,7 +244,7 @@ export default Ember.Component.extend({
this.appEvents.off('composer:insert-text');
const mouseTrap = this._mouseTrap;
Ember.keys(this.get('toolbar.shortcuts')).forEach(sc => mouseTrap.unbind(sc));
Object.keys(this.get('toolbar.shortcuts')).forEach(sc => mouseTrap.unbind(sc));
this.$('.d-editor-preview').off('click.preview');
},

View file

@ -12,7 +12,7 @@ export var queryParams = {
// Basic controller options
var controllerOpts = {
needs: ['discovery/topics'],
queryParams: Ember.keys(queryParams),
queryParams: Object.keys(queryParams),
};
// Aliases for the values

View file

@ -142,7 +142,7 @@ const controllerOpts = {
};
Ember.keys(queryParams).forEach(function(p) {
Object.keys(queryParams).forEach(function(p) {
// If we don't have a default value, initialize it to null
if (typeof controllerOpts[p] === 'undefined') {
controllerOpts[p] = null;

View file

@ -70,7 +70,7 @@ export default Ember.DefaultResolver.extend({
// If we end with the name we want, use it. This allows us to define components within plugins.
const suffix = parsedName.type + 's/' + parsedName.fullNameWithoutType,
dashed = Ember.String.dasherize(suffix),
moduleName = Ember.keys(requirejs.entries).find(function(e) {
moduleName = Object.keys(requirejs.entries).find(function(e) {
return (e.indexOf(suffix, e.length - suffix.length) !== -1) ||
(e.indexOf(dashed, e.length - dashed.length) !== -1);
});

View file

@ -60,7 +60,7 @@ function findOutlets(collection, callback) {
const disabledPlugins = Discourse.Site.currentProp('disabled_plugins') || [];
Ember.keys(collection).forEach(function(res) {
Object.keys(collection).forEach(function(res) {
if (res.indexOf("/connectors/") !== -1) {
// Skip any disabled plugins
for (let i=0; i<disabledPlugins.length; i++) {

View file

@ -6,7 +6,7 @@ function resolveParams(ctx, options) {
if (hash) {
if (options.hashTypes) {
Ember.keys(hash).forEach(function(k) {
Object.keys(hash).forEach(function(k) {
const type = options.hashTypes[k];
if (type === "STRING" || type === "StringLiteral") {
params[k] = hash[k];

View file

@ -1,5 +1,5 @@
export function autoLoadModules() {
Ember.keys(requirejs.entries).forEach(entry => {
Object.keys(requirejs.entries).forEach(entry => {
if ((/\/helpers\//).test(entry)) {
require(entry, null, null, true);
}

View file

@ -108,7 +108,7 @@ const Post = RestModel.extend({
// Put the metaData into the request
if (metaData) {
data.meta_data = {};
Ember.keys(metaData).forEach(function(key) { data.meta_data[key] = metaData.get(key); });
Object.keys(metaData).forEach(function(key) { data.meta_data[key] = metaData.get(key); });
}
return data;

View file

@ -41,7 +41,7 @@ const Site = RestModel.extend({
}
});
Ember.keys(remaining).forEach(parentCategoryId => {
Object.keys(remaining).forEach(parentCategoryId => {
const category = result.findBy('id', parseInt(parentCategoryId, 10)),
index = result.indexOf(category);

View file

@ -136,7 +136,7 @@ const User = RestModel.extend({
},
copy() {
return Discourse.User.create(this.getProperties(Ember.keys(this)));
return Discourse.User.create(this.getProperties(Object.keys(this)));
},
save() {

View file

@ -15,7 +15,7 @@ export function mapRoutes() {
// will be built automatically. You can supply a `resource` property to
// automatically put it in that resource, such as `admin`. That way plugins
// can define admin routes.
Ember.keys(requirejs._eak_seen).forEach(function(key) {
Object.keys(requirejs._eak_seen).forEach(function(key) {
if (/route-map$/.test(key)) {
var module = require(key, null, null, true);
if (!module || !module.default) { throw new Error(key + ' must export a route map.'); }

View file

@ -4,7 +4,7 @@ import { queryParams } from 'discourse/controllers/discovery-sortable';
function filterQueryParams(params, defaultParams) {
const findOpts = defaultParams || {};
if (params) {
Ember.keys(queryParams).forEach(function(opt) {
Object.keys(queryParams).forEach(function(opt) {
if (params[opt]) { findOpts[opt] = params[opt]; }
});
}
@ -38,7 +38,7 @@ function findTopicList(store, tracking, filter, filterParams, extras) {
// Clean up any string parameters that might slip through
filterParams = filterParams || {};
Ember.keys(filterParams).forEach(function(k) {
Object.keys(filterParams).forEach(function(k) {
const val = filterParams[k];
if (val === "undefined" || val === "null" || val === 'false') {
filterParams[k] = undefined;

View file

@ -3,12 +3,12 @@ export default function(helpers) {
const fixturesByUrl = {};
// Load any fixtures automatically
Ember.keys(require._eak_seen).forEach(entry => {
Object.keys(require._eak_seen).forEach(entry => {
if (/^fixtures/.test(entry)) {
const fixture = require(entry, null, null, true);
if (fixture && fixture.default) {
const obj = fixture.default;
Ember.keys(obj).forEach(url => {
Object.keys(obj).forEach(url => {
fixturesByUrl[url] = obj[url];
this.get(url, () => response(obj[url]));
});

View file

@ -132,7 +132,7 @@ window.asyncTestDiscourse = helpers.asyncTestDiscourse;
window.controllerFor = helpers.controllerFor;
window.fixture = helpers.fixture;
Ember.keys(requirejs.entries).forEach(function(entry) {
Object.keys(requirejs.entries).forEach(function(entry) {
if ((/\-test/).test(entry)) {
require(entry, null, null, true);
}