Replace uses of "lodash/each" with native equivalents

This commit is contained in:
Andres Suarez
2016-12-25 23:50:49 -05:00
committed by Logan Smyth
parent 2bee765e6b
commit 658f13e030
7 changed files with 45 additions and 42 deletions

View File

@@ -1,4 +1,3 @@
import each from "lodash/each";
import map from "lodash/map";
import * as t from "babel-types";
@@ -211,19 +210,18 @@ exports.list = {
* Add whitespace tests for nodes and their aliases.
*/
each({
Function: true,
Class: true,
Loop: true,
LabeledStatement: true,
SwitchStatement: true,
TryStatement: true
}, function (amounts, type) {
[
["Function", true],
["Class", true],
["Loop", true],
["LabeledStatement", true],
["SwitchStatement", true],
["TryStatement", true]
].forEach(function ([type, amounts]) {
if (typeof amounts === "boolean") {
amounts = { after: amounts, before: amounts };
}
each([type].concat(t.FLIPPED_ALIAS_KEYS[type] || []), function (type) {
[type].concat(t.FLIPPED_ALIAS_KEYS[type] || []).forEach(function (type) {
exports.nodes[type] = function () {
return amounts;
};