Commit d0191e29 authored by Martin Wortschack's avatar Martin Wortschack

Use literal instead of constructor for creating regex

parent 280a132e
...@@ -53,10 +53,7 @@ export const slugify = str => str.trim().toLowerCase(); ...@@ -53,10 +53,7 @@ export const slugify = str => str.trim().toLowerCase();
* @param {String} str * @param {String} str
* @returns {String} * @returns {String}
*/ */
export const slugifyWithHyphens = str => { export const slugifyWithHyphens = str => str.toLowerCase().replace(/\s+/g, '-');
const regex = new RegExp(/\s+/, 'g');
return str.toLowerCase().replace(regex, '-');
};
/** /**
* Truncates given text * Truncates given text
......
---
title: Use literal instead of constructor for creating regex
merge_request: 22367
author:
type: other
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment