From 65f8b4537a85cb77fe0caccb87671f5c333a38c5 Mon Sep 17 00:00:00 2001 From: Paul Gascou-Vaillancourt Date: Sat, 10 Mar 2018 14:43:54 -0500 Subject: [PATCH] feat: Add support for Regexp for ignorePaths option Fixes #38 --- lib/routes.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/routes.js b/lib/routes.js index 5707f3c25..3eaad4f69 100644 --- a/lib/routes.js +++ b/lib/routes.js @@ -24,7 +24,11 @@ const generateRoutes = ({ const localizedRoutes = [] // Extract routes that should not be localized baseRoutes.forEach(route => { - if (ignorePaths.indexOf(route.path) !== -1) { + const isIgnoredPath = (-1 !== ignorePaths.findIndex(pattern => { + const regexp = new RegExp(pattern) + return route.path.match(pattern) + })) + if (isIgnoredPath) { newRoutes.push(route) } else { localizedRoutes.push(route)