Skip to content

Commit 20561e9

Browse files
committed
Remove lodash dependency
1 parent 000327b commit 20561e9

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/index.jsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import extend from 'lodash/extend';
2-
import merge from 'lodash/merge';
31
import React from 'react';
42
import ReactDOM from 'react-dom';
53
import Sortable from 'sortablejs';
@@ -30,14 +28,26 @@ const getModelItems = (wrapperComponent) => {
3028
return items.slice(); // returns a shallow copy of the items array
3129
};
3230

31+
const extend = (target, ...sources) => {
32+
sources.forEach((source) => {
33+
for (let key in source) {
34+
if (source.hasOwnProperty(key)) {
35+
target[key] = source[key];
36+
}
37+
}
38+
});
39+
40+
return target;
41+
};
42+
3343
const SortableMixin = (Component, sortableOptions = defaultOptions) => class extends React.Component {
3444
sortableInstance = null;
3545
sortableOptions = sortableOptions;
3646

3747
componentDidMount() {
3848
const wrapperComponent = this;
3949
const sortableComponent = wrapperComponent.refs[refName];
40-
const options = merge({}, defaultOptions, wrapperComponent.sortableOptions);
50+
const options = extend({}, defaultOptions, wrapperComponent.sortableOptions);
4151
const emitEvent = (type, evt) => {
4252
const methodName = options[type];
4353
const method = sortableComponent[methodName];

0 commit comments

Comments
 (0)