Commit 92bcdeb6 authored by Matthew Odle's avatar Matthew Odle

remove Array.from() usages

parent e955fcd0
......@@ -10,7 +10,7 @@ var intervalCreatures = {
console.log('intervalCreatures initialized');
},
manage : function() {
Array.from(Object.keys(this.intervals)).forEach(creature => {
Object.keys(this.intervals).forEach(creature => {
this.spawnCreatureAtIntervals(creature);
if (this[creature] == false) {
return;
......
......@@ -2,7 +2,7 @@
var lasers = {
lasers : {player1 : [], player2 : []},
manage : function() {
Array.from(Object.keys(this.lasers)).forEach(key => {
Object.keys(this.lasers).forEach(key => {
let player = players.players[key];
if (!player) {
return;
......
......@@ -70,7 +70,7 @@ var players = {
},
determineEligibleDirections : function(player) {
player.eligibleDirections = supporting.clone(playerConstants.eligibleDirections);
Array.from(Object.keys(playerConstants.watchPositions)).forEach(direction => {
Object.keys(playerConstants.watchPositions).forEach(direction => {
playerConstants.watchPositions[direction].forEach(playerPosition =>
player.eligibleDirections[direction] = this.boundaries[playerPosition] && player.eligibleDirections[direction]
);
......
......@@ -26,7 +26,7 @@ var dom = {
getLinksElement : function() {
let element = document.createElement('div');
element.className = 'linkButtonWrapper';
Array.from(Object.keys(this.links)).forEach( link => {
Object.keys(this.links).forEach( link => {
let aLink = document.createElement('div');
aLink.className = 'linkButton';
aLink.onclick = function() { window.open(dom.links[link].url) };
......
......@@ -24,7 +24,7 @@ menus = {
main.prepTheCanvas();
};
this.timeSinceSelection = 0;
Array.from(Object.keys(this.show)).forEach(menu => this.show[menu] = false);
Object.keys(this.show).forEach(menu => this.show[menu] = false);
},
processMenus : function() {
this.checkForCheats();
......@@ -74,7 +74,7 @@ menus = {
return screen;
},
hasElements : function(object) {
return Array.from(Object.keys(object)).length > 0;
return Object.keys(object).length > 0;
},
drawMenu : function(screen) {
if (!this.hasElements(screen)) {
......@@ -117,7 +117,7 @@ menus = {
this.timeSinceMenuMove = 0;
},
drawEntries : function(entries) {
Array.from(Object.keys(entries)).forEach((entry, index) => {
Object.keys(entries).forEach((entry, index) => {
let menuElement = entries[entry];
if (!menuElement.component) {
menuElement.component = this.buildDefaultComponent();
......
......@@ -337,7 +337,7 @@ var menusProps = {
order : ['sound', 'back'],
update : function() {
let theSettings = menus.screens.settings.entries;
Array.from(Object.keys(theSettings)).forEach(setting => {
Object.keys(theSettings).forEach(setting => {
if (!theSettings[setting].text) {
theSettings[setting].update();
};
......
......@@ -129,7 +129,7 @@ describe('PLAYER SPEC: ', () => {
it('setEligibleDirectionsToDefault sets all eligibleDirections to true', () => {
testObj.init();
testObj.setEligibleDirectionsToDefault();
Array.from(Object.keys(testObj.watchPositions)).forEach(direction => {
Object.keys(testObj.watchPositions).forEach(direction => {
expect(testObj.eligibleDirections[direction]).toBe(true);
});
});
......
......@@ -16,7 +16,7 @@ describe('DOM SPEC: ', () => {
it('getLinksElement returns links element', () => {
let expected = document.createElement('div');
expected.className = 'linkButtonWrapper';
Array.from(Object.keys(dom.links)).forEach( link => {
Object.keys(dom.links).forEach( link => {
let aLink = document.createElement('div');
aLink.className = 'linkButton';
aLink.onclick = function() { window.open(dom.links[link].url) };
......
......@@ -10,7 +10,7 @@ describe('MENUS SPEC: ', () => {
menus.init();
});
function resetShowFlags() {
Array.from(Object.keys(menus.show)).forEach(menu => menus.show[menu] = false);
Object.keys(menus.show).forEach(menu => menus.show[menu] = false);
};
it('display resets show object and sets selected menu to active', () => {
spyOn(menus, 'disableMenus');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment