Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

Commit

Permalink
refactor(lodash): remove startsWith (#690)
Browse files Browse the repository at this point in the history
The comparison is a single letter, and the first part is also a string (because it's the value from find), meaning that they can simply be compared I think
  • Loading branch information
Haroenv committed May 7, 2019
1 parent 987a21c commit 14ba235
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/functions/formatSort.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use strict';

var find = require('lodash/find');
var startsWith = require('lodash/startsWith');

/**
* Transform sort format from user friendly notation to lodash format
Expand All @@ -14,7 +13,7 @@ module.exports = function formatSort(sortBy, defaults) {
var sortInstructions = sortInstruction.split(':');
if (defaults && sortInstructions.length === 1) {
var similarDefault = find(defaults, function(predicate) {
return startsWith(predicate, sortInstruction[0]);
return predicate[0] === sortInstruction[0];
});
if (similarDefault) {
sortInstructions = similarDefault.split(':');
Expand Down

0 comments on commit 14ba235

Please sign in to comment.