Skip to content

Commit f8342eb

Browse files
author
Clauderic Demers
committed
Remove lodash dependency
1 parent abe0952 commit f8342eb

File tree

3 files changed

+6054
-7
lines changed

3 files changed

+6054
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
"dependencies": {
4949
"babel-runtime": "^6.11.6",
5050
"invariant": "^2.2.1",
51-
"lodash": "^4.12.0",
5251
"prop-types": "^15.5.7"
5352
},
5453
"peerDependencies": {
@@ -102,6 +101,7 @@
102101
"react-tiny-virtual-list": "^2.0.1",
103102
"react-virtualized": "^9.2.2",
104103
"redux": "^3.5.2",
104+
"lodash": "^4.12.0",
105105
"rimraf": "^2.5.2",
106106
"sass-loader": "^3.2.0",
107107
"stack-source-map": "^1.0.4",

src/Manager.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
import find from 'lodash/find';
2-
import sortBy from 'lodash/sortBy';
3-
41
export default class Manager {
52
refs = {};
63

@@ -25,8 +22,7 @@ export default class Manager {
2522
}
2623

2724
getActive() {
28-
return find(
29-
this.refs[this.active.collection],
25+
return this.refs[this.active.collection].find(
3026
// eslint-disable-next-line eqeqeq
3127
({node}) => node.sortableInfo.index == this.active.index
3228
);
@@ -37,6 +33,13 @@ export default class Manager {
3733
}
3834

3935
getOrderedRefs(collection = this.active.collection) {
40-
return sortBy(this.refs[collection], ({node}) => node.sortableInfo.index);
36+
return this.refs[collection].sort(sortByIndex);
4137
}
4238
}
39+
40+
function sortByIndex(
41+
{node: {sortableInfo: {index: index1}}},
42+
{node: {sortableInfo: {index: index2}}}
43+
) {
44+
return (index1 - index2);
45+
}

0 commit comments

Comments
 (0)