graphile-build-pg
Version:
Build a GraphQL schema by reflection over a PostgreSQL schema. Easy to customize since it's built with plugins on graphile-build
15 lines (14 loc) • 497 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = parseIdentifier;
function parseIdentifier(typeIdentifier) {
const match = typeIdentifier.match(/^(?:([a-zA-Z0-9_]+)|"([^"]*)")\.(?:([a-zA-Z0-9_]+)|"([^"]*)")$/);
if (!match) throw new Error(`Type identifier '${typeIdentifier}' is of the incorrect form.`);
return {
namespaceName: match[1] || match[2],
entityName: match[3] || match[4]
};
}
//# sourceMappingURL=parseIdentifier.js.map