* Helper that recursively merges two data objects together.
(to, from)
| 966 | * Helper that recursively merges two data objects together. |
| 967 | */ |
| 968 | function mergeData (to, from) { |
| 969 | if (!from) { return to } |
| 970 | var key, toVal, fromVal; |
| 971 | var keys = Object.keys(from); |
| 972 | for (var i = 0; i < keys.length; i++) { |
| 973 | key = keys[i]; |
| 974 | toVal = to[key]; |
| 975 | fromVal = from[key]; |
| 976 | if (!hasOwn(to, key)) { |
| 977 | set(to, key, fromVal); |
| 978 | } else if (isPlainObject(toVal) && isPlainObject(fromVal)) { |
| 979 | mergeData(toVal, fromVal); |
| 980 | } |
| 981 | } |
| 982 | return to |
| 983 | } |
| 984 | |
| 985 | /** |
| 986 | * Data |
no test coverage detected