diff --git a/lib/routes-parser/path-builder.js b/lib/routes-parser/path-builder.js index 42f06f8..524fb1f 100644 --- a/lib/routes-parser/path-builder.js +++ b/lib/routes-parser/path-builder.js @@ -2,6 +2,6 @@ export default (baseRoute = '', route = '') => { return ( `/${baseRoute}/${route}` .replace(new RegExp('\/+', 'g'), '/') - .replace(new RegExp('\/+$', 'g'), '') + .replace(new RegExp('^.*?|\/$', 'g'), '') ); }; diff --git a/package.json b/package.json index 2253da3..ea347aa 100644 --- a/package.json +++ b/package.json @@ -1,11 +1,17 @@ { "name": "react-router-sitemap", - "version": "1.0.5", + "version": "1.0.6", "description": "Module to generate a sitemap for react-router configuration", "repository": { "type": "git", "url": "https://github.com/kuflash/react-router-sitemap.git" }, + "keywords": [ + "react", + "react-router", + "sitemap", + "es2015" + ], "main": "index.es5.js", "jsnext:main ": "index.js", "scripts": { diff --git a/test/spec/router-parser/path-builder.spec.js b/test/spec/router-parser/path-builder.spec.js index f38b8f5..ee7929c 100644 --- a/test/spec/router-parser/path-builder.spec.js +++ b/test/spec/router-parser/path-builder.spec.js @@ -26,4 +26,15 @@ describe('build path', () => { }); + it('return one slash', () => { + + const baseRoute = '/'; + const route = '/'; + const etalon = '/'; + + expect(build(baseRoute)).toEqual(etalon); + expect(build(baseRoute, route)).toEqual(etalon); + + }); + });