Utility functions cleanup: Cleanup lib/utils/objects.js

redux
David Majda 11 years ago
parent 50b2054fbf
commit 1582304f16

@ -1,37 +1,45 @@
/* Object utilities. */
var objects = {
keys: function(object) {
var result = [];
for (var key in object) {
var result = [], key;
for (key in object) {
if (object.hasOwnProperty(key)) {
result.push(key);
}
}
return result;
},
values: function(object) {
var result = [];
for (var key in object) {
var result = [], key;
for (key in object) {
if (object.hasOwnProperty(key)) {
result.push(object[key]);
}
}
return result;
},
clone: function(object) {
var result = {};
for (var key in object) {
var result = {}, key;
for (key in object) {
if (object.hasOwnProperty(key)) {
result[key] = object[key];
}
}
return result;
},
defaults: function(object, defaults) {
for (var key in defaults) {
var key;
for (key in defaults) {
if (defaults.hasOwnProperty(key)) {
if (!(key in object)) {
object[key] = defaults[key];

Loading…
Cancel
Save