JSFiddle - React, Tailwind, and code Playground
HTML
<center>Left is old, right is new.</center>
<br>
<section>
<table>
<thead>
<tr>
<th>Test</th>
<th width=75>Status</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
<div>
<b>Failed Tests: <span>0</span></b>
<hr>
</div>
</section>
CSS
section{
width:50%;
float:left;
}
body{
font-family:sans-serif
}
table{
border:solid 1px #000;
width:98%;
margin:1%;
}
th{
font-weight:bold;
}
td, th{
border:solid 1px #000;
padding:.5% 1%;
}
td{
font-family:monospaced;
}
div{
padding:1%;
border:solid 1px #000;
margin:1%;
}
.red{
color:red;
font-weight:bold;
}
code{
color:rgb(100,50,50);
background:#eee;
margin-left:16px;
padding:1px 2px;
border:solid rgba(159,0,0,.9) 1px;
}
JavaScript
/**
* Normalize the given path string,
* returning a regular expression.
*
* An empty array should be passed,
* which will contain the placeholder
* key names. For example "/user/:id" will
* then contain ["id"].
*
* @param {String|RegExp|Array} path
* @param {Array} keys
* @param {Boolean} sensitive
* @param {Boolean} strict
* @return {RegExp}
* @api private
*/
var pathRegexp = function(path, keys, sensitive, strict) {
if (path instanceof RegExp) return path;
if (Array.isArray(path)) path = '(' + path.join('|') + ')';
var peek = function(i){ return path[i+1]; },
reset = function(i){
startKey = false;
inKey = false;
curReg = "";
curKey = "";
format = "";
slash = "";
},
clean = function(str){
return str
.replace(/([\/.])/g, '\\$1')
.replace(/\*/g, '(.*)');
},
startKey = false,
inKey = false,
curReg = "",
curKey = "",
format = "",
slash = "",
prev = [],
newPath = "";
for(var i = 0, l = path.length + 1; i < l; i++){
var ch = path[i] || "";
if(!inKey && !startKey && ch === ":"){
startKey = true;
if(prev[0] === "."){
format = "\\.";
// -2 because the "." character will be escaped with a "\".
newPath = newPath.substring(0, newPath.length-2);
if(prev[1] == "/"){
slash = "\\/";
}
}
else if(prev[0] === "/"){
slash = "\\/";
}
}
else if( startKey && ch.match(/\w/) ){
curKey += ch;
}
else if( startKey && ch === "(" ){
startKey = false;
inKey = true;
curReg = ch;
}
else if( inKey || startKey ){
var appendChar = "";
...