2.2.1 • Published 2 years ago

router-path v2.2.1

Weekly downloads
27
License
ISC
Repository
-
Last release
2 years ago

Utility function that replaces the params from a route template with the values of an object to create a valid route path. Designed for, but not limited to, React-router.

It supports both colons (:) and brackets ([]) as param delimiters.

Example with colons:

createPath('/foo/:bar', { bar: 'test' });

returns

'/foo/test'

Example with brackets:

createPath('user/[id]/[slug]', { id: 1, slug: 'john-do' });

returns

'user/1/john-do'

2.2.1

2 years ago

2.2.0

2 years ago

2.1.4

5 years ago

2.1.3

5 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.1

6 years ago

2.0.0

6 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago