node-django-urlify
v1.0.4
Published
Django's urlify.js for the node environment.
Downloads
8
Maintainers
Readme
node-django-urlify
Django's urlify.js for the node environment.
This module is a direct translation of Django's urlify.js, allowing you to urlify (slugify) strings just like Django, only in the node environment.
Install
$ npm install --save node-django-urlify
Usage
const urlify = require('node-django-urlify');
urlify('Étonnamment Beau Générateur de Limace');
//=> 'etonnamment-beau-generateur-limace'
API
urlify(string, numChars, allowUnicode)
input
Type: string
The string of characters you want to urlify/slugify.
numChars
Type: number
Default: no truncating by default
Set this number to truncate the return string to a specific length.
urlify('Hello World!', 7)
//=> 'hello-w'
allowUnicode
Type: boolean
Default: false
You can set the allowUnicode parameter to true
, if you want to allow Unicode characters:
urlify('你好 World', -1, true)
//=> '你好-world'
Related
- python-urlify Django's urlify.js ported to Python
Licenses
- node-django-urlify MIT © Michael Wuergler
- Django License Copyright (c) Django Software Foundation and individual contributors.