Associate data to pathname using pattern.
import { pathnameToMeta } from "@dmail/project-structure"
const metaDescription = {
"/*.js": {
extension: "js",
},
"/*.json": {
extension: "json",
},
"/file.js": {
foo: true,
},
}
pathnameToMeta({ pathname: "/file.js", metaDescription }) // { extension: "js", foo: true }
pathnameToMeta({ pathname: "/file.json", metaDescription }) // { extension: "json" }
You can test if a pathname matches a pattern at the following url: https://dmail.github.io/project-structure/interactive-example/interactive-example.html