UNPKG

pebblebed

Version:

Simplified interactions with Google Datastore for NodeJS

14 lines (11 loc) 371 B
import { SchemaDefinition } from "../types/PebblebedTypes"; export default function getIdPropertyFromSchema(schema: SchemaDefinition<any>) { for (const property in schema) { if (schema.hasOwnProperty(property)) { if (schema[property].role != null && schema[property].role === "id") { return property; } } } return null; }