Sha256: 259e878ac0e4ae45f26f3e5bb3fdb3e31492347de98fafd89107c60096a653b0

Contents?: true

Size: 733 Bytes

Versions: 7

Compression:

Stored size: 733 Bytes

Contents

this.gts = this.gts || {};

this.gts.url = (function () {
    function path(url) {
        var pieces = url.split("/");
        pieces.shift();
        pieces.shift();
        pieces.shift();
        return "/" + pieces.join("/");
    }

    function templatize(url, values) {
        var newUrl = path(url);

        for (var n in values) {
            newUrl = newUrl.replace(new RegExp(values[n], "g"), "#{" + n + "}");
        }

        return newUrl;
    }

    function currentRef(url) {
        var refPath = url.split(/(blame|blob|tree|history|raw|source|readme)\//)[2];
        return refPath && refPath.split(":")[0] || null;
    }

    return {
        templatize: templatize,
        currentRef: currentRef
    };
}());

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
dolt-0.13.0 vendor/ui/js/components/url.js
dolt-0.12.0 vendor/ui/js/components/url.js
dolt-0.11.0 vendor/ui/js/components/url.js
dolt-0.10.0 vendor/ui/js/components/url.js
dolt-0.9.0 vendor/ui/js/components/url.js
dolt-0.8.0 vendor/ui/js/components/url.js
dolt-0.7.1 vendor/ui/js/components/url.js