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 5.1.1 to 5.2.0

7

CHANGELOG.md

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

# [5.2.0](https://github.com/Trott/slug/compare/v5.1.1...v5.2.0) (2021-12-27)
### Features
* add ability to set default locale via setLocale() ([#269](https://github.com/Trott/slug/issues/269)) ([add368d](https://github.com/Trott/slug/commit/add368dbe5065f953d450f4f917fced42a08bf87))
## [5.1.1](https://github.com/Trott/slug/compare/v5.1.0...v5.1.1) (2021-12-13)

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

2

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

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

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

// To reset modifications to slug.charmap, use slug.reset():
slug.reset()
print(slug('I ♥ UNICODE'))
// > i_unicode
print(slug('Telephone-Number')) // lower case by default

@@ -47,15 +52,20 @@ // > telephone-number

print(slug('unicode ♥ is ☢'))
// > unicode-love-is
// To set the default locale:
slug.setLocale('bg')
print(slug('маленький подъезд'))
// > malenykiy-podaezd
print(slug('unicode is ☢'))
// > unicode-is
slug.extend({'☢': 'radioactive'})
print(slug('unicode ♥ is ☢'))
// > unicode-love-is-radioactive
// > unicode-is-radioactive
// slug.extend() modifies the default charmap for the entire process.
// If you need to reset charmap and multicharmap, use slug.reset():
// If you need to reset charmap, multicharmap, and the default locale, use slug.reset():
slug.reset()
print(slug('unicode ♥ is ☢'))
// > unicode-love-is
// > unicode-is

@@ -62,0 +72,0 @@ // Custom removal of characters from resulting slug. Let's say that we want to

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

let defaultLocale = {}
function slugify (string, opts) {

@@ -162,3 +164,3 @@ if (typeof string !== 'string') {

}
const localeMap = locales[opts.locale] || {}
const localeMap = locales[opts.locale] || defaultLocale

@@ -897,2 +899,3 @@ let lengths = []

slug.defaults.modes.rfc3986.multicharmap = slug.defaults.modes.pretty.multicharmap = slug.multicharmap = slug.defaults.multicharmap = Object.assign({}, initialMulticharmap)
defaultLocale = ''
}

@@ -915,2 +918,6 @@

slug.setLocale = function (locale) {
defaultLocale = locales[locale] || {}
}
/* global define */

@@ -917,0 +924,0 @@ // Be compatible with different module systems

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