From 3a63b24f7552ee9c1649e75ea4a6f92305cf1974 Mon Sep 17 00:00:00 2001 From: Andres Alvarez Date: Sat, 7 Sep 2019 18:41:37 +0200 Subject: [PATCH] Add remover option --- README.md | 1 + index.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 48a0933..19da1af 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ slugify('some string', '_') // some_string slugify('some string', { replacement: '-', // replace spaces with replacement remove: null, // regex to remove characters + remover: '', // replace remove regex match with remover lower: true // result in lower case }) ``` diff --git a/index.js b/index.js index 42e921c..05974da 100644 --- a/index.js +++ b/index.js @@ -29,7 +29,7 @@ .reduce(function (result, ch) { return result + (charMap[ch] || ch) // allowed - .replace(options.remove || /[^\w\s$*_+~.()'"!\-:@]/g, '') + .replace(options.remove || /[^\w\s$*_+~.()'"!\-:@]/g, options.remover || '') }, '') // trim leading/trailing spaces .trim()