Skip to content

Instantly share code, notes, and snippets.

@Mr0grog
Mr0grog / Object.defineProperties.js
Created December 4, 2012 17:23 — forked from azendal/Object.defineProperties.js
Object.defineProperties modeled in JS
Object.defineProperties = function(O, Properties) {
// 1. If Type(O) is not Object throw a TypeError exception.
if (typeof(O) !== "object" || O == null) {
throw TypeError("Object.defineProperties called on non-object");
}
// 2. Let props be ToObject(Properties)
var props = Object(Properties); // not *exactly* the same, but similar enough
// 3. Let names be an internal list containing the names of each enumerable own property of props.