Constconst nullProtoObj = Object.create(null);
nullProtoObj.key = 'value';
NullProtoObjectSchema.parse(nullProtoObj); // ✓ Valid
const regularObj = { key: 'value' };
NullProtoObjectSchema.parse(regularObj); // ✗ Throws validation error
const emptyObj = {};
NullProtoObjectSchema.parse(emptyObj); // ✗ Throws validation error
import { createAssertion, use } from 'bupkis';
import { DictionarySchema } from 'bupkis/schema';
const dictAssertion = createAssertion(
  [DictionarySchema, 'to be a dictionary of numbers'],
  DictionarySchema.pipe(z.record(z.number())),
);
const { expect } = use([dictAssertion]);
expect(Object.create(null, { pants: { value: 42, enumerable: true } }),
A Zod schema that validates plain objects with null prototypes.
This schema validates objects that have been created with
Object.create(null)or otherwise have their prototype set tonull. Such objects are "plain" objects without any inherited properties or methods fromObject.prototype, making them useful as pure data containers or dictionaries.