ai
Version:
AI SDK by Vercel - build apps like ChatGPT, Claude, Gemini, and more with a single interface for any model using the Vercel AI Gateway or go direct to OpenAI, Anthropic, Google, or any other model provider.
17 lines (16 loc) • 385 B
text/typescript
/**
* Writes an enumerable own property without invoking inherited setters such as
* `Object.prototype.__proto__`. Keeps the target object's prototype unchanged.
*/
export function setOwn<T>(
object: Record<string, T>,
key: string,
value: T,
): void {
Object.defineProperty(object, key, {
value,
enumerable: true,
configurable: true,
writable: true,
});
}