/ cloudformation-templates / node_modules / aws-cdk / node_modules / es5-ext / lib / Object / map-to-array.js
map-to-array.js
1 'use strict'; 2 3 var callable = require('./valid-callable') 4 , forEach = require('./for-each') 5 6 , defaultCb; 7 8 defaultCb = function (value, key) { 9 return [key, value]; 10 }; 11 12 module.exports = function (obj, cb) { 13 var a = [], thisArg = arguments[2]; 14 cb = (cb == null) ? defaultCb : callable(cb); 15 16 forEach(obj, function (value, key) { 17 a.push(cb.call(thisArg, value, key, this)); 18 }, obj, arguments[3]); 19 return a; 20 };