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

slug

Package Overview
Dependencies
Maintainers
1
Versions
74
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

slug - npm Package Compare versions

Comparing version 4.0.3 to 4.0.4

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [4.0.4](https://github.com/Trott/slug/compare/v4.0.3...v4.0.4) (2021-04-16)
### Bug Fixes
* honor special character replacements in charmap ([f5e18c9](https://github.com/Trott/slug/commit/f5e18c9ff8e21e5c5bc636f34b811b4b73e1b204))
## [4.0.3](https://github.com/Trott/slug/compare/v4.0.2...v4.0.3) (2021-02-24)

@@ -2,0 +9,0 @@

2

package.json
{
"name": "slug",
"description": "slugifies even utf-8 chars!",
"version": "4.0.3",
"version": "4.0.4",
"homepage": "https://github.com/Trott/slug",

@@ -6,0 +6,0 @@ "author": "dodo (https://github.com/dodo)",

@@ -174,2 +174,4 @@ /* global btoa */

const disallowedChars = opts.mode === 'rfc3986' ? /[^\w\s\-.~]/ : /[^A-Za-z0-9\s]/
let result = ''

@@ -194,10 +196,12 @@ for (let char, i = 0, l = string.length; i < l; i++) {

char = opts.charmap[char]
} else if (char.includes(opts.replacement)) {
// preserve the replacement character in case it is excluded by disallowedChars
char = char.replace(opts.replacement, ' ')
} else {
char = char.replace(disallowedChars, '')
}
}
// next line preserves the replacement character in case it is included in allowedChars
char = char.replace(opts.replacement, ' ')
result += char
}
const allowedChars = opts.mode === 'rfc3986' ? /[^\w\s\-.~]/g : /[^A-Za-z0-9\s]/g
result = result.replace(allowedChars, '') // allowed
if (opts.remove) {

@@ -204,0 +208,0 @@ result = result.replace(opts.remove, '')

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