This package has been deprecated

Author message:

Deprecated

justintime50-slugify

1.4.0 • Public • Published

Slugify

Slugify a string. Perfect for URLs!

Build Status Coverage Status NPM Licence

Showcase

Install

npm i justintime50-slugify

NOTE: This project requires jQuery for an HTML implementation.

Usage

Website

See Slugify in action here: https://justintime50.github.io/slugify.

Javascript Example

Pass in text and slug the result in console.

const slugify = require("justintime50-slugify");

console.log(slugify("Here is my FIRST -- Slug!", { lowercase: true }));
//=> 'here-is-my-first-slug'

Options

  • lowercase: true/false (default: false)

HTML Form Example

Transform a blog title into a slug to easily create our article URL.

<label for="title">Title</label>
<input type="text" class="title" name="title">

<label for="slug">Slug (URL)</label>
<input type="text" class="slug" name="slug">

<script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
<script src="path/to/slugify/index.js"></script>

<script>
    // We slugify whatever is typed into the "title" field into the "slug" field in real time.
    slugifyField(".title", ".slug");
</script>

Development

# Lint the project
npx eslint index.js

# Test the project
npm run test

Attributions

Based on snippets from mathewbyrne and sindresorhus.

Readme

Keywords

Package Sidebar

Install

npm i justintime50-slugify

Weekly Downloads

0

Version

1.4.0

License

MIT

Unpacked Size

62.4 kB

Total Files

10

Last publish

Collaborators

  • justintime50