node package manager
Stop writing boring code. Discover, share, and reuse within your team. Create a free org »

reru

reru

Stupidly simple regular expression pushState router.

build status dependency status dev dependency status

browser support

Example

var reru = require('reru');
 
reru(/.*/, function () {
  content.innerHTML = '';
});
 
reru('^/$', function () {
  var p = document.createElement('p');
  p.appendChild(document.createTextNode('Welcome'));
  content.appendChild(p);
});
 
reru('^/(\\d{4})$', function (year) {
  var p = document.createElement('p');
  p.appendChild(document.createTextNode('Archive for' + year));
  content.appendChild(p);
});

License

MIT