neat-slug

    0.0.1 • Public • Published

    Neat Slug for Node.js

    Neat Slug is a simple Node.js module that concatenates keywords of a string with the '-' symbol. There are zero dependencies to this package, so it's very lightweight and quick to install and test.

    Install Neat Slug using npm

     
    npm install neat-slug

    To use Neat Slug, simply require it, and pass it your title text:

     
    var neatSlug = require('neat-slug');
     
    // Make "Oh What a Wonderful World" a slug:
    var slug = neatSlug("Oh what a wonderful world!");
    console.log(slug); // -> 'wonderful-world'
     
    // Turn the title "How to Lose a Guy in Ten Days" into a slug:
    slug = neatSlug("How to lose a guy in ten days");
    // Slug = 'lose-guy-ten-days'

    Neat Slug can also handle more complex strings, as in the example below:

    var titleString = "123 1 2 3 @This., -34/ 1234 #! 90182.2312 $ % ^" +
        " & 1* green ;123: {} 123 a = 123123-_ smoothies with `~)() kale";
     
    var slug = neatSlug(titleString);
    console.log(slug); // -> green-smoothies-kale

    Credits

    Install

    npm i neat-slug

    DownloadsWeekly Downloads

    0

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • graemeboy