Skip to main content

pick

Creates a clone of a given object schema with only the specified properties. Similar to TypeScript's Pick.

Example​

import { pick, object, string, number } from "@sodd/core";

const userSchema = object({
name: string(),
age: number(),
location: string(),
});

const userWithOnlyName = pick(userSchema, ["name"]);