Remove merge helper and add more type declarations. (#5649)
This commit is contained in:
parent
6af8e64711
commit
0eae6a432c
@ -7,3 +7,27 @@ declare module "micromatch" {
|
|||||||
nocase: boolean,
|
nocase: boolean,
|
||||||
}): Array<string>;
|
}): Array<string>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
declare module "resolve" {
|
||||||
|
declare export default {
|
||||||
|
sync: (string, {| basedir: string |}) => string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "json5" {
|
||||||
|
declare export default {
|
||||||
|
parse: (string) => mixed,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "lodash/defaults" {
|
||||||
|
declare export default <T: Object>(T, Object) => T;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "lodash/clone" {
|
||||||
|
declare export default <T>(obj: T) => T;
|
||||||
|
}
|
||||||
|
|
||||||
|
declare module "lodash/merge" {
|
||||||
|
declare export default <T: Object>(T, Object) => T;
|
||||||
|
}
|
||||||
|
|||||||
@ -1,21 +0,0 @@
|
|||||||
// @flow
|
|
||||||
|
|
||||||
import mergeWith from "lodash/mergeWith";
|
|
||||||
|
|
||||||
export default function<T: {}>(dest?: T, src?: T) {
|
|
||||||
if (!dest || !src) return;
|
|
||||||
|
|
||||||
mergeWith(dest, src, function (a, b) {
|
|
||||||
if (b && Array.isArray(a)) {
|
|
||||||
const newArray = b.slice(0);
|
|
||||||
|
|
||||||
for (const item of a) {
|
|
||||||
if (newArray.indexOf(item) < 0) {
|
|
||||||
newArray.push(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return newArray;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
@ -4,7 +4,7 @@ import * as context from "../index";
|
|||||||
import Plugin from "./plugin";
|
import Plugin from "./plugin";
|
||||||
import * as messages from "babel-messages";
|
import * as messages from "babel-messages";
|
||||||
import defaults from "lodash/defaults";
|
import defaults from "lodash/defaults";
|
||||||
import merge from "./helpers/merge";
|
import merge from "lodash/merge";
|
||||||
import removed from "./removed";
|
import removed from "./removed";
|
||||||
import buildConfigChain from "./build-config-chain";
|
import buildConfigChain from "./build-config-chain";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user