node-django-urlify

1.0.4 • Public • Published

node-django-urlify

Django's urlify.js for the node environment.

Build Status Coverage Status

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

Licenses

Package Sidebar

Install

npm i node-django-urlify

Weekly Downloads

0

Version

1.0.4

License

MIT

Last publish

Collaborators

  • radiovisual