Skip to content

As of 1.6.6, extending a character with "null" will break #177

@louh

Description

@louh

This worked in 1.6.5:

  slugify.extend({
    '|': null,
    '%': null,
    $: null
  })

This changes the behavior of slugifying a string like "100%" from "100percent" to simply "100".

However this will break in 1.6.6, with the error message "TypeError: Cannot read properties of null (reading 'replace')".

Updating the extend object to replace "null" with empty strings like so will behave as expected:

  slugify.extend({
    '|': '',
    '%': '',
    $: ''
  })

It looks like this change wasn't documented anywhere so I thought I'd drop this note here in case anyone else goes looking for a fix, like I did.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions