Sha256: e9f9467b6903831d6c1145b236aec90e6d28a2fe9ac992d14e2b4a7397a4cde8

Contents?: true

Size: 719 Bytes

Versions: 12

Compression:

Stored size: 719 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)\//)[2];
        return refPath && refPath.split(":")[0] || null;
    }

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
dolt-0.7.0 vendor/ui/js/components/url.js
dolt-0.6.2 vendor/ui/js/components/url.js
dolt-0.6.1 vendor/ui/js/components/url.js
dolt-0.6.0 vendor/ui/js/components/url.js
dolt-0.5.1 vendor/ui/js/components/url.js
dolt-0.5.0 vendor/ui/js/components/url.js
dolt-0.4.3 vendor/ui/js/components/url.js
dolt-0.4.2 vendor/ui/js/components/url.js
dolt-0.4.1 vendor/ui/js/components/url.js
dolt-0.4.0 vendor/ui/js/components/url.js
dolt-0.3.1 vendor/ui/js/components/url.js
dolt-0.2.2 vendor/ui/js/components/url.js