simov / slugify

Slugifies a string
MIT License
1.47k stars 126 forks source link

From 1.5.0 onwards, dashes don't collapse when extended #144

Closed paleite closed 2 years ago

paleite commented 2 years ago

1.5.0 broke the behavior when collapsing dashes in some cases:

I use the following test cases.

expect(slugify("day---night")).toBe("day-night"); // Works
expect(slugify("day   night")).toBe("day-night"); // Works
expect(slugify("day + night")).toBe("day-night"); // Broken in ^1.5.0, but working in <=1.4.7, when using extend as described below 

This is how I extended slugify.

slugify.extend({ "+": "-" }); // Broken in ^1.5.0, but working in <=1.4.7

// Note: The following works as expected, however: { "+": " " }
Trott commented 2 years ago

Looks like I broke this in #115.

Trott commented 2 years ago

Proposed fix in https://github.com/simov/slugify/pull/145. /ping @simov

paleite commented 2 years ago

Whoah, that was fast! 🚀 Thanks 🙂

Trott commented 2 years ago

Fixed in slugify@1.6.4.