UNPKG

@sprucelabs/schema

Version:

Static and dynamic binding plus runtime validation and transformation to ensure your app is sound. 🤓

13 lines (12 loc) • 421 B
import SpruceError from '../errors/SpruceError.js'; export default function getFields(schema) { var _a; const names = Object.keys((_a = schema === null || schema === void 0 ? void 0 : schema.fields) !== null && _a !== void 0 ? _a : {}); if (names.length === 0) { throw new SpruceError({ code: 'INVALID_PARAMETERS', parameters: ['schema'], }); } return names; }