Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

string-occurrence

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

string-occurrence - npm Package Compare versions

Comparing version 1.0.0 to 1.1.0

3

index.js
'use strict';
var escape = require('reg-escape');
module.exports = function (input, search) {

@@ -8,4 +9,4 @@ if (typeof input !== 'string') {

return [].concat(search).reduce(function (count, search) {
return count + (input.match(new RegExp(search, 'ig')) || []).length;
return count + (input.match(new RegExp(escape(search), 'ig')) || []).length;
}, 0);
};
{
"name": "string-occurrence",
"version": "1.0.0",
"version": "1.1.0",
"description": "Get the number of occurrences of a string in a string",

@@ -23,9 +23,11 @@ "license": "MIT",

"string",
"occurrence",
"needle",
"haystack",
"search",
"count"
"occurrence",
"needle",
"haystack",
"search",
"count"
],
"dependencies": {},
"dependencies": {
"reg-escape": "^1.0.0"
},
"devDependencies": {

@@ -32,0 +34,0 @@ "ava": "*",

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