/ cloudformation-templates / node_modules / aws-cdk / node_modules / es5-ext / lib / Object / bind-methods.js
bind-methods.js
1 'use strict'; 2 3 var bind = Function.prototype.bind 4 , isCallable = require('./is-callable') 5 , forEach = require('./for-each') 6 , value = require('./valid-value'); 7 8 module.exports = function (obj, scope, source) { 9 value(obj); 10 scope = scope || obj; 11 source = source || obj; 12 forEach(source, function (value, key) { 13 if (isCallable(value)) { 14 obj[key] = bind.call(value, scope); 15 } 16 }, obj); 17 return obj; 18 };