Socket
Socket
Sign inDemoInstall

match-at

Package Overview
Dependencies
Maintainers
2
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

match-at

Relocatable regular expressions.


Version published
Weekly downloads
23K
increased by8.14%
Maintainers
2
Weekly downloads
 
Created
Source

match-at Build Status

Introduction

Like String.prototype.match if it only checked the regex at the given index instead of searching the entire string.

matchAt(/world/, 'hello world', 6);  // ['world']
matchAt(/world/, 'hello world', 0);  // null

Almost like 'hello world'.slice(i).match(/^world/) except the resulting match object's .index property corresponds to the original string, and it doesn't actually slice the string. Most engines optimize taking a substring so this probably isn't particularly valuable in practice, but it was an entertaining exercise and could be useful if you reminisce about these semantics.

License

MIT.

FAQs

Package last updated on 06 Sep 2017

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc