From: CorasWorksSolutions Date: Mon, 22 Aug 2016 16:14:09 +0000 (-0400) Subject: Update deprecate function to expand values of an argument which is an object X-Git-Tag: 2.15.0~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e387157ada13ab99189484c294e4c4a1ff16a53c;p=thirdparty%2Fmoment.git Update deprecate function to expand values of an argument which is an object --- diff --git a/src/lib/utils/deprecate.js b/src/lib/utils/deprecate.js index 8ed45e5a6..8b4c87a28 100644 --- a/src/lib/utils/deprecate.js +++ b/src/lib/utils/deprecate.js @@ -17,7 +17,22 @@ export function deprecate(msg, fn) { hooks.deprecationHandler(null, msg); } if (firstTime) { - warn(msg + '\nArguments: ' + Array.prototype.slice.call(arguments).join(', ') + '\n' + (new Error()).stack); + var args = []; + var arg; + for (var i = 0; i < arguments.length; i++) { + arg = ''; + if (typeof arguments[i] === 'object') { + arg += '\n[' + i + '] '; + for (var key in arguments[0]) { + arg += key + ': ' + arguments[0][key] + ', '; + } + arg = arg.slice(0, -2); // Remove trailing comma and space + } else { + arg = arguments[i]; + } + args.push(arg); + } + warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + (new Error()).stack); firstTime = false; } return fn.apply(this, arguments);