JSFiddle - React, Tailwind, and code Playground

by aruss

HTML

<!-- no html -->

CSS

/* no css */

JavaScript

if (!String.prototype.toUrl) {
    String.prototype.toUrl = function (o) {

        var r = this.replace(/\{([^{}]*)\}/g, function (a, b) {
            var r = o[b];
            delete o[b];
            return typeof r === 'string' || typeof r === 'number' ? r : a;
        }),
            p = [];

        for (var k in o) {
            if (o[k] !== undefined && o[k] !== null) {
                var v = o[k];
                if (isNaN(v)) v = escape(v);
                p.push(k + '=' + v);
            }
        }

        return r + ((p.length > 0) ? '?' + p.join('&') : '');
    };
}

document.write('http://jsfiddle.net/{userId}/{fiddleId}/'.toUrl({
    userId: 'aruss',
    fiddleId: 'GuLpu'
}));
document.write('<br/>'); 

document.write('/blog/{postId}/comments'.toUrl({
    postId: 'awesome-post',
    take: 10,
    skip: 20
}))