@scalar/api-client
Version:
the open source API testing client
21 lines (20 loc) • 487 B
JavaScript
const i = (e) => e.replace(/~1/g, "/").replace(/~0/g, "~"), c = (e) => {
const t = e.trim();
if (t.startsWith("/"))
return t;
if (t.startsWith("#")) {
const s = t.slice(1);
return s.startsWith("/") ? s : null;
}
const r = t.indexOf("#");
if (r === -1)
return null;
const n = t.slice(r + 1);
return n.startsWith("/") ? n : null;
}, o = (e) => {
const t = c(e);
return t ? t.split("/").slice(1).map(i) : null;
};
export {
o as parseJsonPointerPath
};