Socket
Socket
Sign inDemoInstall

starts-with

Package Overview
Dependencies
0
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    starts-with

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


Version published
Weekly downloads
43K
decreased by-9.87%
Maintainers
1
Install size
8.25 kB
Created
Weekly downloads
 

Changelog

Source

1.0.2 - 2015-07-09

  • Release v1.0.2 / npm@v1.0.2
  • fixes for codeclimate's jshint on benchmark/**/*

Readme

Source

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 freenode #charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github

Keywords

FAQs

Last updated on 09 Jul 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc