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 path = require("path");
var peg = require("../lib/peg");
var objects = require("../lib/utils/objects");
/* Helpers */
@ -256,7 +255,7 @@ while (args.length > 0 && isOption(args[0])) {
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") {
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) {
var functionIndex = addFunctionConst(objects.keys(context.env), code);
var functionIndex = addFunctionConst(Object.keys(context.env), code);
return buildSequence(
[op.UPDATE_SAVED_POS],
@ -347,7 +347,7 @@ function generateBytecode(ast) {
env: env,
action: node
}),
functionIndex = addFunctionConst(objects.keys(env), node.code);
functionIndex = addFunctionConst(Object.keys(env), node.code);
return emitCall
? buildSequence(
@ -396,7 +396,7 @@ function generateBytecode(ast) {
} else {
if (context.action) {
functionIndex = addFunctionConst(
objects.keys(context.env),
Object.keys(context.env),
context.action.code
);

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

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

Loading…
Cancel
Save