Skip to content

Commit

Permalink
Implement startsWith via indexOf
Browse files Browse the repository at this point in the history
  • Loading branch information
kemitchell committed Oct 3, 2023
1 parent 4c14905 commit 2617c21
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,7 @@ function normalizeGPLIdentifiers (argument) {
}

function startsWith (string, substring) {
return string.substring(0, substring.length) === substring
}

if (!startsWith('applesauce', 'apple')) {
throw new Error('bad impl')
return string.indexOf(substring) === 0
}

function endsWith (string, substring) {
Expand Down

0 comments on commit 2617c21

Please sign in to comment.