New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

multichar-regex

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

multichar-regex - npm Package Compare versions

Comparing version 1.0.0 to 2.0.0

8

matches.js
var multichar = require('./index')
module.exports = function (string) {
var matches = []
var matches = {}
var match
while (match = multichar.exec(string)) {
matches.push({
value: match[0],
index: match.index,
length: match[0].length
})
matches[match.index] = match[0]
}
return matches
}
{
"name": "multichar-regex",
"version": "1.0.0",
"version": "2.0.0",
"description": "a regular expression that matches all the surrogate pairs and combining-marked characters in a string",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -22,4 +22,4 @@ # multichar-regex

matches('oh hi, doggy 🐶 meet the sun: ☀️')
=> [ { value: '🐶', index: 13, length: 2 },
{ value: '☀️', index: 30, length: 2 } ]
// index: value
=> { '13': '🐶', '30': '☀️' }
```

@@ -26,0 +26,0 @@

@@ -25,7 +25,7 @@ var test = require('tape')

var matches = match('oh hi doggy 🐶, are you from 🇨🇦?')
assert.deepEqual(matches, [
{ value: '🐶', index: 12, length: 2 },
{ value: '🇨🇦', index: 29, length: 4 }
], 'it does')
assert.deepEqual(matches, {
12: '🐶',
29: '🇨🇦'
}, 'it does')
assert.end()
})
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