@tdb/util
Version:
Shared helpers and utilities.
20 lines • 795 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = (function (basePath) {
var formatPath = function (path) { return basePath + "/" + path.replace(/^\//, ''); };
function img(path, path2x, width, height) {
return path2x
? [formatPath(path), formatPath(path2x), width, height]
: [formatPath(path), width, height];
}
function png(path, width, height) {
path = path.replace(/\.png$/, '');
return img(path + ".png", path + "@2x.png", width, height);
}
function svg(path, width, height) {
path = path.endsWith('.svg') ? path : path + ".svg";
return img(path, null, width, height);
}
return { img: img, png: png, svg: svg };
});
//# sourceMappingURL=index.js.map