UNPKG

474 BJavaScriptView Raw
1/**
2 * @description match的自动补全
3 */
4import config from 'MATCH/config';
5import { isObj } from 'LIB/util';
6
7const autoComplete = (
8 result: object,
9 data: object
10) => {
11
12 if (!config.autoComplete) return;
13
14 for (let i in data) {
15 if (!result.hasOwnProperty(i)) {
16 result[i] = data[i];
17 } else if (isObj(result[i]) && isObj(data[i])) {
18 autoComplete(result[i], data[i]);
19 }
20 }
21};
22
23export default autoComplete;