Sha256: 6a4250b4aa6fc1a5bcd9496a22eb622bad6d385462f9dcfa3f4a86c35892adfb
Contents?: true
Size: 1.2 KB
Versions: 20
Compression:
Stored size: 1.2 KB
Contents
'use strict'; var copy = require('es5-ext/object/copy') , normalizeOptions = require('es5-ext/object/normalize-options') , ensureCallable = require('es5-ext/object/valid-callable') , map = require('es5-ext/object/map') , callable = require('es5-ext/object/valid-callable') , validValue = require('es5-ext/object/valid-value') , bind = Function.prototype.bind, defineProperty = Object.defineProperty , hasOwnProperty = Object.prototype.hasOwnProperty , define; define = function (name, desc, options) { var value = validValue(desc) && callable(desc.value), dgs; dgs = copy(desc); delete dgs.writable; delete dgs.value; dgs.get = function () { if (!options.overwriteDefinition && hasOwnProperty.call(this, name)) return value; desc.value = bind.call(value, options.resolveContext ? options.resolveContext(this) : this); defineProperty(this, name, desc); return this[name]; }; return dgs; }; module.exports = function (props/*, options*/) { var options = normalizeOptions(arguments[1]); if (options.resolveContext != null) ensureCallable(options.resolveContext); return map(props, function (desc, name) { return define(name, desc, options); }); };
Version data entries
20 entries across 20 versions & 4 rubygems