Returns `true` if the given string or array starts with prefix using strict equality for comparisons. Using fastest implementation from http://jsperf.com/starts-with-comparing-12-implementations
MIT License
Returns
true
if the given string or array starts with prefix using strict equality for comparisons. Using fastest implementation.
npm i starts-with --save
npm test
For more use-cases see the tests
var startsWith = require('starts-with')
startsWith('abcdefghi', 'abcd') //=> true
startsWith(['abc', 'def', 'ghi'], 'abc') //=> true
startsWith(['abc', 'def', 'ghi'], ['abc']) //=> false
startsWith(['cab', 'cdf', 'cef'], 'c') //=> false
startsWith([57, 'a', 'b'], 57) //=> true
startsWith([57, 'a', 'b', 'c'], '57') //=> false
startsWith(['57', 'a', 'b', 'c'], '57') //=> true
true
if the given string
or array
ends with suffix
using strict equality for comparisons.Pull requests and stars are always welcome. For bugs and feature requests, please create an issue. But before doing anything, please read the CONTRIBUTING.md guidelines.