Help Improve my Simple Open Source JavaScript Router
Kabue Charles

Kabue Charles @mckabue

About: Poet; Entrepreneur; Philosopher; Genius Lateral Thinker; Software Architect; Created Library.co.ke

Location:
Kenya
Joined:
Sep 27, 2017

Help Improve my Simple Open Source JavaScript Router

Publish Date: Jul 23 '18
9 3

i would love your opinion on this simple and dynamic JavaScript router that i use for my Single Page Application. I find it easy, simple, light and effective.

/*
 * USAGE
 * https://jsfiddle.net/mckabue/knwvsy3t/18/
 * 
 * var $router = ROUTER(['/home/{tag}?gh={gh}']);
 * var $match = $router.match('/home/a tag?gh=dfe');
 * console.log($match); //{tag: "a tag", gh: "dfe"}
 * 
 */
Enter fullscreen mode Exit fullscreen mode

https://jsfiddle.net/mckabue/knwvsy3t/18/

Comments 3 total

  • Niklas
    NiklasJul 25, 2018

    You could write it in typescript, abstract things in classes and improve readability 😊

    • Kabue Charles
      Kabue CharlesJul 26, 2018

      Thanks... Will definitely do that

      • Niklas
        NiklasJul 26, 2018

        Typescript is f*ing awesome 😁

Add comment