Skip to content

Commit

Permalink
Remove lodash dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
clauderic committed May 17, 2018
1 parent abe0952 commit f8342eb
Show file tree
Hide file tree
Showing 3 changed files with 6,054 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -48,7 +48,6 @@
"dependencies": {
"babel-runtime": "^6.11.6",
"invariant": "^2.2.1",
"lodash": "^4.12.0",
"prop-types": "^15.5.7"
},
"peerDependencies": {
Expand Down Expand Up @@ -102,6 +101,7 @@
"react-tiny-virtual-list": "^2.0.1",
"react-virtualized": "^9.2.2",
"redux": "^3.5.2",
"lodash": "^4.12.0",
"rimraf": "^2.5.2",
"sass-loader": "^3.2.0",
"stack-source-map": "^1.0.4",
Expand Down
15 changes: 9 additions & 6 deletions src/Manager.js
@@ -1,6 +1,3 @@
import find from 'lodash/find';
import sortBy from 'lodash/sortBy';

export default class Manager {
refs = {};

Expand All @@ -25,8 +22,7 @@ export default class Manager {
}

getActive() {
return find(
this.refs[this.active.collection],
return this.refs[this.active.collection].find(
// eslint-disable-next-line eqeqeq
({node}) => node.sortableInfo.index == this.active.index
);
Expand All @@ -37,6 +33,13 @@ export default class Manager {
}

getOrderedRefs(collection = this.active.collection) {
return sortBy(this.refs[collection], ({node}) => node.sortableInfo.index);
return this.refs[collection].sort(sortByIndex);
}
}

function sortByIndex(
{node: {sortableInfo: {index: index1}}},
{node: {sortableInfo: {index: index2}}}
) {
return (index1 - index2);
}

0 comments on commit f8342eb

Please sign in to comment.