Slugify
amerta / amerta/payload/utilities/slugify / slugify
Class: slugify
Defined in: amerta/payload/utilities/slugify/index.ts:3
Constructors
Constructor
new slugify(
replacements?):slugify
Defined in: amerta/payload/utilities/slugify/index.ts:5
Parameters
| Parameter | Type | Default value |
| ------ | ------ | ------ |
| replacements | string[][] | defaultReplacements |
Returns
slugify
Properties
replacements
replacements:
string[][]
Defined in: amerta/payload/utilities/slugify/index.ts:4
Methods
escapeRegExp()
escapeRegExp(
str):string
Defined in: amerta/payload/utilities/slugify/index.ts:17
Escape characters with special meaning either inside or outside the character sets
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| str | any | The string to escape. |
Returns
string
- The escaped string.
See
- https://mathiasbynens.be/notes/javascript-escapes
- https://stackoverflow.com/a/6969486/112731
- https://stackoverflow.com/a/1144788/112731
generate()
generate(
str,delimiter?):any
Defined in: amerta/payload/utilities/slugify/index.ts:34
Generate a slugified version of the string using the specified delimiter.
Parameters
| Parameter | Type | Default value | Description |
| ------ | ------ | ------ | ------ |
| str | any | undefined | The string to slugify. |
| delimiter? | string | "-" | The delimiter to use for the slug. |
Returns
any
- The slugified string.
See
- https://gist.github.com/mathewbyrne/1280286
- https://stackoverflow.com/a/2955878/112731