Replace objects.keys with Object.keys

See #441.
redux
David Majda 8 years ago
parent 0059cc3bdd
commit d346d2a66d

@ -5,7 +5,6 @@
var fs = require("fs"); var fs = require("fs");
var path = require("path"); var path = require("path");
var peg = require("../lib/peg"); var peg = require("../lib/peg");
var objects = require("../lib/utils/objects");
/* Helpers */ /* Helpers */
@ -256,7 +255,7 @@ while (args.length > 0 && isOption(args[0])) {
nextArg(); nextArg();
} }
if (objects.keys(options.dependencies).length > 0) { if (Object.keys(options.dependencies).length > 0) {
if (options.format !== "amd" && options.format !== "commonjs" && options.format !== "umd") { if (options.format !== "amd" && options.format !== "commonjs" && options.format !== "umd") {
abort("Can't use the -d/--dependency option with the \"" + options.format + "\" module format."); abort("Can't use the -d/--dependency option with the \"" + options.format + "\" module format.");
} }

@ -254,7 +254,7 @@ function generateBytecode(ast) {
} }
function buildSemanticPredicate(code, negative, context) { function buildSemanticPredicate(code, negative, context) {
var functionIndex = addFunctionConst(objects.keys(context.env), code); var functionIndex = addFunctionConst(Object.keys(context.env), code);
return buildSequence( return buildSequence(
[op.UPDATE_SAVED_POS], [op.UPDATE_SAVED_POS],
@ -347,7 +347,7 @@ function generateBytecode(ast) {
env: env, env: env,
action: node action: node
}), }),
functionIndex = addFunctionConst(objects.keys(env), node.code); functionIndex = addFunctionConst(Object.keys(env), node.code);
return emitCall return emitCall
? buildSequence( ? buildSequence(
@ -396,7 +396,7 @@ function generateBytecode(ast) {
} else { } else {
if (context.action) { if (context.action) {
functionIndex = addFunctionConst( functionIndex = addFunctionConst(
objects.keys(context.env), Object.keys(context.env),
context.action.code context.action.code
); );

@ -1260,7 +1260,7 @@ function generateJS(ast, options) {
commonjs: function() { commonjs: function() {
var parts = [], var parts = [],
dependencyVars = objects.keys(options.dependencies), dependencyVars = Object.keys(options.dependencies),
requires = dependencyVars.map( requires = dependencyVars.map(
function(variable) { function(variable) {
return variable return variable
@ -1294,7 +1294,7 @@ function generateJS(ast, options) {
amd: function() { amd: function() {
var dependencyIds = objects.values(options.dependencies), var dependencyIds = objects.values(options.dependencies),
dependencyVars = objects.keys(options.dependencies), dependencyVars = Object.keys(options.dependencies),
dependencies = '[' dependencies = '['
+ dependencyIds.map( + dependencyIds.map(
function(id) { return '"' + js.stringEscape(id) + '"'; } function(id) { return '"' + js.stringEscape(id) + '"'; }
@ -1332,7 +1332,7 @@ function generateJS(ast, options) {
umd: function() { umd: function() {
var parts = [], var parts = [],
dependencyIds = objects.values(options.dependencies), dependencyIds = objects.values(options.dependencies),
dependencyVars = objects.keys(options.dependencies), dependencyVars = Object.keys(options.dependencies),
dependencies = '[' dependencies = '['
+ dependencyIds.map( + dependencyIds.map(
function(id) { return '"' + js.stringEscape(id) + '"'; } function(id) { return '"' + js.stringEscape(id) + '"'; }

@ -2,18 +2,6 @@
/* Object utilities. */ /* Object utilities. */
var objects = { var objects = {
keys: function(object) {
var result = [], key;
for (key in object) {
if (object.hasOwnProperty(key)) {
result.push(key);
}
}
return result;
},
values: function(object) { values: function(object) {
var result = [], key; var result = [], key;

Loading…
Cancel
Save