added .keys method to objects, if not supported, fixes IE issue with pluginfw

This commit is contained in:
Matthias Bartelmeß 2012-03-16 18:21:28 +01:00
parent 0e731a2645
commit d0dd746c8b
2 changed files with 12 additions and 2 deletions

View File

@ -47,7 +47,7 @@ function extend(obj, props)
var forEachImpl = function(fn){
for (var i = 0; i < this.length; i++)
{
var result = func(this[i], i, this);
var result = fn(this[i], i, this);
}
}
@ -64,11 +64,19 @@ function mapImpl(fn)
return result;
}
// From underscore.js
var keysImpl =function(obj) {
if (obj !== Object(obj)) throw new TypeError('Invalid object');
var keys = [];
for (var key in obj) if (obj.hasOwnProperty(key)) keys.push(key);
return keys;
};
Array.prototype.forEach = Array.prototype.forEach || forEachImpl;
Array.prototype.each = Array.prototype.each || forEachImpl;
Array.prototype.map = Array.prototype.map || mapImpl;
Object.keys = Object.keys || keysImpl;
function isArray(testObject)
{

View File

@ -10,6 +10,8 @@ if (!exports.isClient) {
var fs = require("fs");
var tsort = require("./tsort");
var util = require("util");
}else{
require("../ace2_common.js");
}
exports.prefix = 'ep_';