* Helper that recursively merges two data objects together.
(to, from)
| 974 | * Helper that recursively merges two data objects together. |
| 975 | */ |
| 976 | function mergeData (to, from) { |
| 977 | if (!from) { return to } |
| 978 | var key, toVal, fromVal; |
| 979 | var keys = Object.keys(from); |
| 980 | for (var i = 0; i < keys.length; i++) { |
| 981 | key = keys[i]; |
| 982 | toVal = to[key]; |
| 983 | fromVal = from[key]; |
| 984 | if (!hasOwn(to, key)) { |
| 985 | set(to, key, fromVal); |
| 986 | } else if (isPlainObject(toVal) && isPlainObject(fromVal)) { |
| 987 | mergeData(toVal, fromVal); |
| 988 | } |
| 989 | } |
| 990 | return to |
| 991 | } |
| 992 | |
| 993 | /** |
| 994 | * Data |
no test coverage detected