New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

sails-hook-sluggable

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sails-hook-sluggable

Easy to create unique slugs for your Waterline models in Sails

latest
Source
npmnpm
Version
0.1.4
Version published
Weekly downloads
20
-4.76%
Maintainers
1
Weekly downloads
 
Created
Source

Sails unique slugs

Easy to create unique slugs for your Waterline models in Sails

Installation

Add this hook to your Sails app:

$ npm install sails-hook-sluggable

That's all!

Usage

Add an attribute of type slug in a model:

module.exports = {

  attributes: {
    title: {
      type: 'string',
      required: true,
      unique: true
    },
    content: {
      type: 'text'
    },
    name: {
      type: 'string'
    },
    slug: {
      type: 'slug',
      from: 'title',
      unique: true
    }
  }
};


## Parameters

    username: {
      type: 'slug',
      from: "first_name,last_name",     // Field name for generate Slug, default 'title'
      defaultField: "full_name",        // IF `from` value null than use Field, default null
      multiField: true,                 // Use multi Field for generate Slug, default false
      defaultValue: "slug",             // If Fields are null default string, default 'slug'
      remove : null,                    // (optional) regex to remove characters, default null
      lower : true,                     // result in lower case, default 'true
      separator : "-",                  // replace spaces with replacement, default "-"
    }

Keywords

Sails

FAQs

Package last updated on 26 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts