3 var copy = require('es5-ext/object/copy')
4 , map = require('es5-ext/object/map')
5 , callable = require('es5-ext/object/valid-callable')
6 , validValue = require('es5-ext/object/valid-value')
8 , bind = Function.prototype.bind, defineProperty = Object.defineProperty
9 , hasOwnProperty = Object.prototype.hasOwnProperty
12 define = function (name, desc, bindTo) {
13 var value = validValue(desc) && callable(desc.value), dgs;
17 dgs.get = function () {
18 if (hasOwnProperty.call(this, name)) return value;
19 desc.value = bind.call(value, (bindTo == null) ? this : this[bindTo]);
20 defineProperty(this, name, desc);
26 module.exports = function (props/*, bindTo*/) {
27 var bindTo = arguments[1];
28 return map(props, function (desc, name) {
29 return define(name, desc, bindTo);