Skip to content

Commit

Permalink
Replace merge utility with spread syntax. (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
wtgtybhertgeghgtwtg authored and sudo-suhas committed Dec 24, 2017
1 parent f1e37fa commit 65bd092
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
3 changes: 1 addition & 2 deletions src/createConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import get from 'lodash/get';
import omit from 'lodash/omit';

import mapParentConfig from './mapParentConfig';
import { merge } from './utils';

const webpackMerge = strategy({
entry: 'append',
Expand All @@ -28,7 +27,7 @@ const prepare = config => {
// plugins are ommited by default too.
// It's not ideal, but it's better to let the user make a conscious choice about it.
const props = ['context', 'plugins', 'entry', 'output'];
return merge(omit(config, props), { plugins });
return { ...omit(config, props), plugins };
};

export const _createConfig = cacheDir => (settings, rawParentConfig) => {
Expand Down
12 changes: 7 additions & 5 deletions src/createSettings.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import get from 'lodash/get';
import isNil from 'lodash/isNil';
import { merge } from './utils';
import createHash from './createHash';
import normalizeEntry from './normalizeEntry';
import getEnv from './getEnv';
Expand Down Expand Up @@ -31,16 +30,19 @@ export const _createSettings = getEnv => ({ originalSettings, index, parentConfi
config: {},
};

const settings = merge(defaults, otherSettings, {
const settings = {
...defaults,
...otherSettings,
entry: normalizeEntry(entry),
id: getInstanceId(index),
env: getEnv(env),
inherit: isNil(inherit) ? false : inherit,
});
};

return merge(settings, {
return {
...settings,
hash: createHash(settings),
});
};
};

export default _createSettings(getEnv);
4 changes: 2 additions & 2 deletions src/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { RawSource } from 'webpack-sources';
import path from 'path';

import { cacheDir, getManifestPath, getInjectPath } from './paths';
import { concat, merge, keys } from './utils/index.js';
import { concat, keys } from './utils/index.js';
import createCompileIfNeeded from './createCompileIfNeeded';
import createConfig from './createConfig';
import createMemory from './createMemory';
Expand Down Expand Up @@ -103,7 +103,7 @@ class AutoDLLPlugin {
};
}, {});

compilation.assets = merge(compilation.assets, dllAssets);
compilation.assets = { ...compilation.assets, ...dllAssets };

callback();
});
Expand Down
1 change: 0 additions & 1 deletion src/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export { default as safeClone } from './safeClone';
export const concat = Array.prototype.concat.bind([]);
export const merge = (...args) => Object.assign({}, ...args);
export const keys = Object.keys;

0 comments on commit 65bd092

Please sign in to comment.