mirror of
https://github.com/protomaps/PMTiles.git
synced 2026-02-04 10:51:07 +00:00
pmtiles_path can have {name} multiple times [#97]
This commit is contained in:
@@ -16,6 +16,13 @@ test("pmtiles path with slash", (assertion) => {
|
||||
assertion.equal(result, "folder/foo/bar/file.pmtiles");
|
||||
});
|
||||
|
||||
test("pmtiles path with multiple names", (assertion) => {
|
||||
let result = pmtiles_path("slug","folder/{name}/{name}.pmtiles");
|
||||
assertion.equal(result, "folder/slug/slug.pmtiles");
|
||||
result = pmtiles_path("foo/bar","folder/{name}/{name}.pmtiles");
|
||||
assertion.equal(result, "folder/foo/bar/foo/bar.pmtiles");
|
||||
});
|
||||
|
||||
test("parse tile default", (assertion) => {
|
||||
let {ok, name, tile, ext} = tile_path("abcd");
|
||||
assertion.equal(ok, false);
|
||||
|
||||
@@ -29,7 +29,7 @@ class KeyNotFoundError extends Error {
|
||||
|
||||
export const pmtiles_path = (name: string, setting?: string): string => {
|
||||
if (setting) {
|
||||
return setting.replace("{name}", name);
|
||||
return setting.replaceAll("{name}", name);
|
||||
}
|
||||
return name + ".pmtiles";
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user