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

@bustle/slugify

Package Overview
Dependencies
Maintainers
22
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bustle/slugify - npm Package Compare versions

Comparing version 1.2.1 to 2.0.0

36

index.js

@@ -1,12 +0,28 @@

const slug = require('./slug')
const slugify = require('slugify')
const STOP_WORDS = ['and', 'or', 'an']
const IGNORE_CHARS = ['$']
const STOP_WORDS = new Set(['and', 'or', 'an'])
IGNORE_CHARS.forEach(char => { slug.charmap[char] = '' })
slugify.extend({
$: '',
'&': '',
'|': '',
'☠': 'skull-bones',
'☣': 'biohazard',
'☭': 'hammer-sickle',
'☯': 'yin-yang',
'☮': 'peace',
'☏': 'telephone',
'☎': 'telephone',
'★': 'star',
'☂': 'umbrella',
'☃': 'snowman',
'✈': 'airplane',
'✉': 'envelope',
'✊': 'raised-fist'
})
function slugify (input) {
return slug(input, { lower: true })
function slug (input) {
return slugify(String(input), { replacement: '-', lower: true, remove: /[^\w\s_~-]+/g })
.split('-')
.filter(word => word && (STOP_WORDS.indexOf(word) === -1))
.filter(word => word && !STOP_WORDS.has(word))
.join('-')

@@ -17,3 +33,3 @@ }

if (!string) { return `${id}` }
return `${slugify(string)}-${id}`
return `${slug(string)}-${id}`
}

@@ -23,7 +39,7 @@

if (!string) { return `${id}` }
return `${id}-${slugify(string)}`
return `${id}-${slug(string)}`
}
module.exports = {
slug: slugify,
slug,
slugUser: user => makeSlug(user.id, user.name),

@@ -30,0 +46,0 @@ slugPost: post => makeSlug(post.id, post.title),

{
"name": "@bustle/slugify",
"version": "1.2.1",
"version": "2.0.0",
"description": "Slug all our things into slugs",

@@ -10,7 +10,7 @@ "main": "index.js",

"engines": {
"node": ">=4.3"
"node": ">=12"
},
"repository": {
"type": "git",
"url": "git+https://github.com/bustlelabs/slugify.git"
"url": "git+https://github.com/bustle/slugify.git"
},

@@ -23,10 +23,13 @@ "keywords": [

"bugs": {
"url": "https://github.com/bustlelabs/slugify/issues"
"url": "https://github.com/bustle/slugify/issues"
},
"homepage": "https://github.com/bustlelabs/slugify#readme",
"homepage": "https://github.com/bustle/slugify#readme",
"devDependencies": {
"mocha": "^3.2.0",
"should": "^11.2.1",
"standard": "^9.0.0"
"mocha": "^8.1.3",
"should": "^13.2.3",
"standard": "^14.3.4"
},
"dependencies": {
"slugify": "^1.4.5"
}
}
# bustle slugify
[![Build Status](https://travis-ci.com/bustlelabs/slugify.svg?token=1KJeREEe58xVHvYm9rGo&branch=master)](https://travis-ci.com/bustlelabs/slugify)
[![Build Status](https://api.travis-ci.org/bustle/slugify.svg?branch=master)](https://travis-ci.org/github/bustle/slugify)

@@ -14,3 +14,3 @@ This is how you slug our things.

This module copies in the `slug` module from npm and the single unicode table it uses for symbol lookups. Installs much faster and doesn't use external services.
This module just uses the `slugify` module from npm and adds some minor bustle-specific adjustments.

@@ -28,4 +28,2 @@ # Api

## slugUser(user:{id!, name}) -> slug
Users have the id last, don't use this until [nighthawk](https://github.com/bustlelabs/nighthawk/issues/331) can deal with it.
```js

@@ -32,0 +30,0 @@ assert.equal(slugUser({ id: 1, name: 'Penny Dog' }), 'penny-dog-1')

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