Skip to content
This repository has been archived by the owner on Jun 7, 2018. It is now read-only.

router5/helpers

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

helpers

Helpers for comparing and checking routes.

API

route can be a route name (string) or state object containing a name property

  • startsWithSegment(route, segment)
  • endsWithSegment(route, segment)
  • includesSegment(route, segment)

redirect function

This package also contains a redirect function for onActivate handlers.

  • redirect(fromRouteName, toRouteName, toRouteParams), where toRouteParams can an object or a function of the attempted route params.

All functions are available in their curried form (kinda)

  • startsWithSegment(route)(segment)
  • endsWithSegment(route)(segment)
  • includesSegment(route)(segment)
  • redirect(fromRouteName)(toRouteName, toRouteParams)
import * as helpers from 'router5.helpers';

startsWithSegment('users', 'users');      // => true
startsWithSegment('users.list', 'users'); // => true

startsWithSegment('users.list')('users'); // => true

About

Helpers for comparing and checking routes [MOVED]

Resources

License

Stars

Watchers

Forks

Packages

No packages published