From 3ca7e97a9b412acd3599d59e71ef1356fa819c18 Mon Sep 17 00:00:00 2001 From: xixilive Date: Wed, 5 Sep 2018 09:08:29 +0800 Subject: [PATCH] fix: use minimal RegExp matching for better performance (#977) --- packages/commons/lib/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/commons/lib/utils.js b/packages/commons/lib/utils.js index 480b0c2471..c5b7d623d5 100644 --- a/packages/commons/lib/utils.js +++ b/packages/commons/lib/utils.js @@ -1,6 +1,6 @@ // Removes all leading and trailing slashes from a path exports.stripSlashes = function stripSlashes (name) { - return name.replace(/^(\/*)|(\/*)$/g, ''); + return name.replace(/^(\/+)|(\/+)$/g, ''); }; // A set of lodash-y utility functions that use ES6