From d25e11bee6ca5ca523884da132d18e1400e077b9 Mon Sep 17 00:00:00 2001 From: Minteck Date: Tue, 24 Aug 2021 14:41:48 +0200 Subject: Initial commit --- node_modules/strip-outer/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 node_modules/strip-outer/index.js (limited to 'node_modules/strip-outer/index.js') diff --git a/node_modules/strip-outer/index.js b/node_modules/strip-outer/index.js new file mode 100644 index 0000000..497186a --- /dev/null +++ b/node_modules/strip-outer/index.js @@ -0,0 +1,11 @@ +'use strict'; +var escapeStringRegexp = require('escape-string-regexp'); + +module.exports = function (str, sub) { + if (typeof str !== 'string' || typeof sub !== 'string') { + throw new TypeError(); + } + + sub = escapeStringRegexp(sub); + return str.replace(new RegExp('^' + sub + '|' + sub + '$', 'g'), ''); +}; -- cgit