uslug
    Overview
    Documentation
    Tutorials
    Insights
    Code
    Dependencies
    Contributors
    Jobs

uslug

A permissive slug generator that works with unicode.

1.0.4  •  Updated 3 years ago  •  by Jeremy Selier  •  Unknown License

Permissive slug generator that works with unicode. We keep only characters from the categories Letter, Number and Separator (see Unicode Categories) and the common CJK Unified Ideographs as defined in the version 6.0.0 of the Unicode specification.

Inspired by unicode-slugify. Note that this slug generator is different from node-slug which focus on translating unicode characters to english or latin equivalent.

Quick Examples

uslug('Быстрее и лучше!') // 'быстрее-и-лучше'
uslug('汉语/漢語') // '汉语漢語'

uslug('Y U NO', { lower: false })) // 'Y-U-NO'
uslug('Y U NO', { spaces: true })) // 'y u no'
uslug('Y-U|NO', { allowedChars: '|' })) // 'yu|no'

Installation

npm install uslug

Options

uslug(string, options)

Generate a slug for the string passed.

Arguments

  • string - The string you want to slugify.
  • options - An optional object that can contain:
    • allowedChars: a String of chars that you want to be whitelisted. Default: ‘-_~’.
    • lower: a Boolean to force to lower case the slug. Default: true.
    • spaces: a Boolean to allow spaces. Default: false.

License

This project is distributed under the MIT License. See LICENSE file for more information.

Popularity

Weekly Downloads
19.2K
Stars
70

Maintenance

Development

Last ver 4 years ago
Created 8 years ago
Last commit 4 years ago
4 months between commits

Technology

Node version: 0.12.5
0 unpacked

Compliance

License Unknown
Not OSI Approved
0 vulnerabilities

Contributors

3 contributors
Jeremy Selier
Maintainer, 10 commits, 2 merges
Works at Google
Tobias Butler
5 commits, 1 PRs
vincent
1 commits
Keats
1 PRs
Munksey
1 PRs
Rokt33r
1 PRs

Dependencies

Openbase helps developers choose among and use millions of open-source packages, so they can build amazing products faster.
FacebookTwitterLinkedIn
© 2020 Devstore, Inc.