Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/arthurlacoste/js-slug-me
This is a simple javascript function that returns slugified string.
https://github.com/arthurlacoste/js-slug-me
Last synced: about 1 month ago
JSON representation
This is a simple javascript function that returns slugified string.
- Host: GitHub
- URL: https://github.com/arthurlacoste/js-slug-me
- Owner: arthurlacoste
- License: mit
- Created: 2016-06-03T08:49:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-30T12:32:34.000Z (about 7 years ago)
- Last Synced: 2024-11-24T10:04:39.237Z (about 2 months ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# Slugme
[![NPM Version][npm-version]][npm-url]
[![travis][travis-badge]][travis-url]
[![xo][xo-badge]][xo-url]This is a simple javascript function that returns slugified string.
The slugification is useful for URL build from accentuated strings.It replaces accentuated chars to non-accentuated and spaces by the minus sign. All other chars (non-alphanumeric) are removed or replaced.
Work both in Node & browser environment.
## Install
```
npm i slugme -S
```## Usage
```js
const slugme = require('slugme');
const result = slugme('Être en été est à mi-chemin de noël');console.log(result);
//=> etre-en-ete-est-a-mi-chemin-de-noel
```
## Browser
Example:
```html
Slug : « »
const slugLive = function (input,output) {
const valueIn = document.getElementById(input).value;
var idOut = document.getElementById(output);
idOut.innerHTML = slugme(valueIn);
}slugLive('slug-this','slugme');
```
## Misc
- [Golang version](https://github.com/metal3d/go-slugify)
## Licence
MIT
[npm-version]:https://img.shields.io/npm/v/slugme.svg
[npm-url]: https://npmjs.org/package/slugme
[travis-badge]: http://img.shields.io/travis/arthurlacoste/js-slug-me.svg
[travis-url]: https://travis-ci.org/arthurlacoste/js-slug-me
[xo-badge]: https://img.shields.io/badge/code_style-XO-5ed9c7.svg
[xo-url]: https://github.com/sindresorhus/xo