appcelerator/alloy — pull request #588 by FokkeZB (2014-10-13 07:40:51+00:00)
Title: Fixes bug introduced by copy.colors fix

Because `!copy.colors` introduced in https://github.com/appcelerator/alloy/commit/4ed7fd9b8840aaaaf7af71a1a5dbe97a2c43072b was outside the `_.isObject` check it also ran when `copy` was no object, causing a JS exception.

The colors fix was hacky anyway since `} else if(copy.colors) {` never runs because of the `} else if (typeof copy !== 'undefined') {` above it.

The whole problem of a `colors` array being turned into an object was because the `copy_is_array` statement would not be executed if the the array doesn't include a `apiName` index, since `_.isObject()` is also true for arrays :) Changing the order in the if fixes this.