1.1.1 • Published 5 years ago

@palmabit/loopback-ds-slugify-mixin v1.1.1

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

loopback-ds-slugify-mixin

Install

  npm i @palmabit/loopback-ds-slugify-mixin --save

Server Config

Add the mixins property to your server/model-config.json:

{
  "_meta": {
    "sources": [
      "loopback/common/models",
      "loopback/server/models",
      "../common/models",
      "./models"
    ],
    "mixins": [
      "loopback/common/mixins",
      "../node_modules/@palmabit/loopback-ds-slugify-mixin",
      "../common/mixins"
    ]
  }
}

Model Config

To use with your Models add the mixins attribute to the definition object of your model config.

  {
    "name": "Widget",
    "properties": {
      "name": {
        "type": "string",
      }
    },
    "mixins": {
    "Slugify": {
      "slugifyOptions": { 
        "replacement": "=",
        "remove": null,
        "lower": true,
        "suffixTimestamp": true
      },
      "slugifiedField": "slug",
      "fieldToSlugify": "name"
    }
  }
  }
  • slugifyOptions: Optional. See https://github.com/simov/slugify for more infos
  • slugifiedField: String Optional. Default is "slug". Support dot notation (ex. "foo.bar") for nested
  • fieldToSlugify: String Required. Support dot notation (ex. "foo.bar") for nested
  • suffixTimestamp: Boolean Optional

Changelog

Changelog File

License

The MIT License (MIT). Please see License File for more information.

1.1.1

5 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.0.1

6 years ago