# This file is generated by author/assets.pl. Do not edit manually. package Amon2::Setup::Asset::MicroDispatcherJS; use strict; use warnings; sub tags { <<',,,'; ,,, } sub files { return { 'js/micro_dispatcher.js' => '// micro_dispatcher.js - (C) tokuhirom, MIT License. (function() { var namedParam = /:([\\w\\d]+)/g; var splatParam = /\\*([\\w\\d]+)/g; var escapeRegExp = /[\\-\\[\\]{}()+?.,\\\\\\^$|#\\s]/g; // http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/ var toString = Object.prototype.toString; function isRegExp(obj) { return toString.call(obj)==\'[object RegExp]\'; } function Dispatcher() { this.routes = []; } Dispatcher.prototype = { register: function(route, callback) { if (!isRegExp(route)) { route = this._compileRoute(route); } this.routes.push([route, callback]); }, dispatch: function (path) { var routes = this.routes; for (var i=0, l=routes.length; i