Skip to content

Commit

Permalink
Don't use lookbehind assertion in slugify (home-assistant#18438)
Browse files Browse the repository at this point in the history
  • Loading branch information
bramkragten authored Oct 27, 2023
1 parent 4e9b118 commit d3cc57d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/common/string/slugify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const slugify = (value: string, delimiter = "_") => {
.toString()
.toLowerCase()
.replace(p, (c) => b.charAt(a.indexOf(c))) // Replace special characters
.replace(/(?<=\d),(?=\d)/g, "") // Remove Commas between numbers
.replace(/(\d),(?=\d)/g, "$1") // Remove Commas between numbers
.replace(/[^a-z0-9]+/g, delimiter) // Replace all non-word characters
.replace(new RegExp(`(${delimiter})\\1+`, "g"), "$1") // Replace multiple delimiters with single delimiter
.replace(new RegExp(`^${delimiter}+`), "") // Trim delimiter from start of text
Expand Down

0 comments on commit d3cc57d

Please sign in to comment.