fix: merge 方法

This commit is contained in:
thinkinggis 2021-01-16 00:35:54 +08:00
parent 0c1d46cba6
commit 90c56d0719
1 changed files with 8 additions and 2 deletions

View File

@ -20,7 +20,7 @@ import {
Properties,
} from '@turf/helpers';
import { EventEmitter } from 'eventemitter3';
import { cloneDeep, isFunction, isString, merge } from 'lodash';
import { cloneDeep, isFunction, isString, mergeWith } from 'lodash';
// @ts-ignore
// tslint:disable-next-line:no-submodule-imports
import Supercluster from 'supercluster/dist/supercluster';
@ -28,6 +28,12 @@ import { getParser, getTransform } from './';
import { cluster } from './transform/cluster';
import { statMap } from './utils/statistics';
import { getColumn } from './utils/util';
function mergeCustomizer(objValue: any, srcValue: any) {
if (Array.isArray(srcValue)) {
return srcValue;
}
}
export default class Source extends EventEmitter {
public data: IParserData;
@ -164,7 +170,7 @@ export default class Source extends EventEmitter {
}
private initCfg(option?: ISourceCFG) {
this.cfg = merge(this.cfg, option);
this.cfg = mergeWith(this.cfg, option, mergeCustomizer);
const cfg = this.cfg;
if (cfg) {
if (cfg.parser) {