New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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 3.3.0 to 3.3.1

7

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

@@ -22,3 +22,4 @@ "author": "dodo (https://github.com/dodo)",

"scripts": {
"test": "standard && nyc --reporter none mocha test/**/*.js && karma start --single-run --browsers ChromeHeadless,FirefoxHeadless .karma.config.js && nyc report --reporter=text --reporter=html && nyc check-coverage --lines 100 --branches 100 --statements 100 --functions 100"
"test": "standard && nyc --reporter none mocha test/**/*.js && karma start --single-run --browsers ChromeHeadless,FirefoxHeadless .karma.config.js && nyc report --reporter=text --reporter=html && nyc check-coverage --lines 100 --branches 100 --statements 100 --functions 100",
"benchmark": "node benchmark/benchmark.js"
},

@@ -34,3 +35,3 @@ "dependencies": {},

"karma-mocha": "^2.0.1",
"mocha": "^7.0.0",
"mocha": "^8.0.1",
"nyc": "^15.0.1",

@@ -37,0 +38,0 @@ "requirejs": "^2.3.6",

@@ -62,2 +62,9 @@ # [slug](https://github.com/Trott/slug)

// > unicode-love-is
// Custom removal of characters from resulting slug. Let's say that we want to
// remove all numbers for some reason.
print(slug('one 1 two 2 three 3'))
// > one-1-two-2-three-3
print(slug('one 1 two 2 three 3', { remove: /[0-9]/g }))
// > one-two-three
```

@@ -83,3 +90,3 @@

replacement: '-',
remove: /[.]/g,
remove: null,
lower: false,

@@ -86,0 +93,0 @@ charmap: slug.charmap,

@@ -102,3 +102,4 @@ /* global btoa */

var lengths = []
for (const key in opts.multicharmap) {
// "let" instead of "const" in next line is for IE11 compatibilty
for (let key in opts.multicharmap) { // eslint-disable-line prefer-const
if (!Object.prototype.hasOwnProperty.call(opts.multicharmap, key)) { continue }

@@ -127,9 +128,11 @@

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

@@ -816,3 +819,3 @@ result = result.replace(/[-\s]+/g, opts.replacement) // convert spaces

replacement: '-',
remove: /[.]/g,
remove: null,
lower: true,

@@ -819,0 +822,0 @@ charmap: slug.defaults.charmap,

Sorry, the diff of this file is not supported yet

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