Feature request: `startsWith`
vorillaz opened this issue · comments
Theodore Vorillas commented
Checks whether the input text starts with the given pattern.
@param {String} text
@param {String|Regex} pattern
@param {Number} startingPosition, optional
Example usage
import startsWith from '@plexis/starts-with';
startsWith('This is me', 'This is');
// => true
startsWith('This is me', 'his is', 1);
// => true
startsWith('This is me', 'is is', 2);
// => true
startsWith('This is me', 'This is', 1);
// => false
Brandon Skinner commented
startsWith('This is me', 'This is', 0);
// => false
Wouldn't this be true? Starting from the index of 0 would make it functionally identical to the first example.
Theodore Vorillas commented
@brandon-m-skinner Shoo, you are right. The issue has been updated.