don't do recurse defaultArg if it's an array

This commit is contained in:
Yotam Mann 2015-09-05 19:17:00 -04:00
parent 7c0318cbdf
commit 4b29736ba2

View file

@ -502,7 +502,10 @@ define(function(){
* @return {*}
*/
Tone.prototype.defaultArg = function(given, fallback){
if (typeof given === "object" && typeof fallback === "object"){
if (typeof given === "object" &&
typeof fallback === "object" &&
!Array.isArray(given) &&
!Array.isArray(fallback)){
var ret = {};
//make a deep copy of the given object
for (var givenProp in given) {