Skip to content

Latest commit

 

History

History
20 lines (16 loc) · 342 Bytes

README.md

File metadata and controls

20 lines (16 loc) · 342 Bytes

generatePath

easily create urls from string

Example

import generatePath from './generatePath'
const urls = {
home: '/',
blog : '/blog/:title/:year/:month'
}
generatePath(urls.blog,{
  title: 'some-cool-title',
  year: new Date().getFullYear(),
  month: new Date().getMonth() + 1
})

// output: /blog/some-cool-title/2021/10