slugo
The smallest possible slug utility for Node.js and Browser
Last updated 5 months ago by egoist .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install slugo 
SYNC missed versions from official npm registry.

slugo

NPM version NPM downloads CircleCI donate

There're many npm packages that slugify string for you, some support unicode and some others even support CJK character. But I would never include a library which weights 2MB in browser. So that's the purpose of this library which only does basic transformation, eg: remove html tags / special chars / convert space to hyphen, and does not touch non-ascii chars. This is similar to the way GitHub handles the headings in README.

And the size of this library is about 700B minified and 400B gzipped.

Install

yarn add slugo

CDN: https://unpkg.com/slugo/dist/

Usage

const slugo = require('slugo')

slugo('hello world, <strong>my kitten!</strong>')
//=> hello-world-my-kitten

You can also access window.slugo if you're using the CDN version.

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Author

slugo © egoist, Released under the MIT License.
Authored and maintained by egoist with help from contributors (list).

egoist.moe · GitHub @egoist · Twitter @_egoistlily

Current Tags

  • 0.3.1                                ...           latest (5 months ago)

7 Versions

  • 0.3.1                                ...           5 months ago
  • 0.3.0                                ...           5 months ago
  • 0.2.3                                ...           a year ago
  • 0.2.2                                ...           a year ago
  • 0.2.1                                ...           3 years ago
  • 0.2.0                                ...           3 years ago
  • 0.1.0                                ...           3 years ago
Maintainers (1)
Downloads
Today 1
This Week 4
This Month 51
Last Day 3
Last Week 28
Last Month 47
Dependencies (0)
None
Dev Dependencies (5)

Copyright 2014 - 2016 © taobao.org |