1.0.1 • Published 3 years ago
pathrie v1.0.1
PATHRIE
A basic utility to find a url path from a set of paths. A trie based search allows you to find string value for a path key. Instal it using npm
npm i pathrieUse setDictionary to initialize your key value pairs. For now only strings are allowed for both of them and path should be starting with a slash: /path/to/hell. Use getValue to execute your query. If not found it returns an empty string.
setDictionary({
'/workspace': 'workspaces-tools',
'/app/workspaces-tools': 'workspaces-tools',
'/insights': 'insights'
})
getValue('/insights/article/JF89spSJF_dj421')You can also add a custom callback function once the search is successful.
getValue('/path/to/find', (value: string) => {
console.log('Hey there...')
return value
})