Skip to content

Commit

Permalink
Merge pull request #4 from alvarocastro/renovate/xo-0.x
Browse files Browse the repository at this point in the history
Update dependency xo to v0.28.0
  • Loading branch information
alvarocastro authored Mar 23, 2020
2 parents fba4589 + 8639cea commit d99ccd7
Show file tree
Hide file tree
Showing 6 changed files with 1,970 additions and 1,330 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,4 @@ sudo: false
language: node_js
node_js:
- '10'
- '8'
after_success: npm run coverage
18 changes: 9 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
const {comparatorAscending, pickMiddleValue} = require('./utils');

const qs = function (arr, compare = comparatorAscending, getPivot = pickMiddleValue) {
if (arr.length < 2) {
return arr;
const qs = function (array, compare = comparatorAscending, getPivot = pickMiddleValue) {
if (array.length < 2) {
return array;
}

const pivot = getPivot(arr);
const pivot = getPivot(array);
const left = [];
const equal = [];
const right = [];

for (const el of arr) {
const r = compare(el, pivot);
for (const element of array) {
const r = compare(element, pivot);
if (r < 0) {
left.push(el);
left.push(element);
} else if (r > 0) {
right.push(el);
right.push(element);
} else {
equal.push(el);
equal.push(element);
}
}

Expand Down
Loading

0 comments on commit d99ccd7

Please sign in to comment.