From 14ba235fd306e5e58b19f460c59ec7b81576dec1 Mon Sep 17 00:00:00 2001 From: Haroen Viaene Date: Mon, 6 May 2019 18:40:19 +0200 Subject: [PATCH] refactor(lodash): remove startsWith (#690) 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 --- src/functions/formatSort.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/functions/formatSort.js b/src/functions/formatSort.js index 6be88f452..5a92e86dc 100644 --- a/src/functions/formatSort.js +++ b/src/functions/formatSort.js @@ -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 @@ -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(':');