1.0.6 • Published 1 year ago

unique-slugify v1.0.6

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

Indroduction

This package provides functionality to generate unique slugs or unique IDs in Node js or ts applications.

Installation

   npm i unique-slugify

   import { generateUniqueSlug } from 'unique-slugify    

Usage

node

---- Javascript and Typescript ---

we can use various scenarios in case of we need to generate unique id as a slug for documents for you can check it out :- other scenarios like need of random unique number you can also you this ;

    const uniqueId = generateUniqueSlug();

Example Usage : ( for generating unique id for each document as like ID - use as slug )

  const ProductSchema: Schema = new Schema({
   name: { type: String, required: true },
   slug: { type: String, unique: true, index: true },
   description: { type: String, required: true }
});
ProductSchema.pre<Product>('save', async function (next) {
const slug = generateUniqueSlug();
this.slug = slug;
next();
});     
    ```
1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago