Skip to content

✨ It's a simple idea for changing any text into a slug for the url to improve SEO and make it more friendly in NestJs 🚀🔮

License

Notifications You must be signed in to change notification settings

AAVision/nestjs-slug

Repository files navigation

Nest Logo

nestjs-slug

It's a simple idea for changing any text into a slug for the url.

Install it

$ npm install nestjs-slug --save

Package uses

The package consists of two methods:

generateSlug(text: string, options?: {
    seperator?: string;
    lowerCase?: boolean;
    upperCase?: boolean;
    length?: number;
    trim?: boolean;
    timestamp?: boolean;
    trimBySepator?: number;
    removeSpecialCharacters?: boolean;
}) : string

  isSlug(text: string): boolean  <-- to check if a slug

Examples

importing SlugService in app.service.ts:

  import { Injectable } from '@nestjs/common';
  import { SlugService } from 'nestjs-slug'; <---

  @Injectable()
  export class AppService {

    slug:string = "";

    constructor(
      private slugService: SlugService  <---
    ){}

    this.slug = this.slugService.generateSlug("iphone 14 pro max black")
    
  }

License

nestjs-slug is MIT licensed.

About

✨ It's a simple idea for changing any text into a slug for the url to improve SEO and make it more friendly in NestJs 🚀🔮

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published