@bustle/slugify

    2.0.0 • Public • Published

    bustle slugify

    Build Status

    This is how you slug our things.

    [1:04 PM]  zeejab the truth is within you reconbot
    [1:04 PM]  reconbot so users is id first, articles and posts is id last
    [1:05 PM]  steve articles is also id first
    [1:06 PM]  zeejab everything new is id last, what steve said
    

    This module just uses the slugify module from npm and adds some minor bustle-specific adjustments.

    Api

    Everything new should be id last, use the function for your named item. This module will be updated as we transition all routes.

    slug(string) -> slug

    Slug any string

    assert.equal(slug('a generic string'), 'a-generic-string')

    slugUser(user:{id!, name}) -> slug

    assert.equal(slugUser({ id: 1, name: 'Penny Dog' }), 'penny-dog-1')
    assert.equal(slugUser({ id: 2 }), '2')

    slugPost(post:{id!, title}) -> slug

    assert.equal(slugPost({ id: 1, title: 'My Great Post!' }), 'my-great-post-1')
    assert.equal(slugPost({ id: 1, title: 'This and That!' }), 'this-that-1')
    assert.equal(slugPost({ id: 2 }), '2')

    slugArticle(article {id!, title})} -> slug

    The only data type where the slug is id first.

    assert.equal(slugArticle({ id: 1, title: 'My Great Post!' }), '1-my-great-post')
    assert.equal(slugArticle({ id: 1, title: 'This and That!' }), '1-this-that')
    assert.equal(slugArticle({ id: 2 }), '2')

    Keywords

    Install

    npm i @bustle/slugify

    DownloadsWeekly Downloads

    98

    Version

    2.0.0

    License

    UNLICENSED

    Unpacked Size

    3.21 kB

    Total Files

    3

    Last publish

    Collaborators

    • eggplantkiller
    • tholman
    • teety
    • tylerlove
    • zeejab
    • anujpan
    • gdub
    • bustle-deploy
    • redterror
    • wabyad
    • sarahganis
    • cg3ntry