starts-with

Returns `true` if the given string or array starts with prefix using strict equality for comparisons. Using fastest implementation.

MIT 5 个版本
安装
npm install starts-with
yarn add starts-with
pnpm add starts-with
bun add starts-with
README

starts-with npmjs.com The MIT License

Returns true if the given string or array starts with prefix using strict equality for comparisons. Using fastest implementation.

code climate standard code style travis build status coverage status dependency status

Install

npm i starts-with --save
npm test

Usage

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
  • ends-with: Returns true if the given string or array ends with suffix using strict equality for comparisons.
  • each-string-index: Get the index for each occurrence of a string, in a string. Much faster than regex, and useful for doing simple find and replace operations for specific strings.
  • starts-with-any: Returns true if the given string or array begins with any of the given substrings.

Contributing

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.

Charlike Make Reagent new message to charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github

版本列表
1.0.2 2015-07-09
1.0.1 2015-07-09
1.0.0 2015-03-31
0.1.0 2014-12-08
0.0.0 2014-12-06