slu

slugme

This is a simple javascript function that returns slugified string.

Showing:

Popularity

Downloads/wk

44

GitHub Stars

0

Maintenance

Last Commit

4yrs ago

Contributors

1

Package

Dependencies

0

Size (min+gzip)

0.4KB

License

CC-BY-4.0

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Slugme

NPM Version travis xo

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

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:


<input value="Être en été est à mi-chemin de noël" id="slug-this" onkeyup="slugLive('slug-this','slugme');" />
Slug : «&nbsp;<span id="slugme"></span>&nbsp;»

<script src="../index.js"></script>

<script type="text/javascript">

const slugLive = function (input,output) {
  const valueIn = document.getElementById(input).value;
  var idOut = document.getElementById(output);
  idOut.innerHTML = slugme(valueIn);
}

slugLive('slug-this','slugme');

</script>


Misc

Licence

MIT

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100