Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | 443176x 3x 443173x | /** Writes attribute values into plain objects built from driver rows. */
export class ValuesWriter {
/**
* Sets a value as an own property. A column called `__proto__` stays an own property, like it
* does with `Object.fromEntries`, instead of replacing the object's prototype.
*
* @param values - Target object.
* @param name - Property name.
* @param value - Property value.
*/
set(values: Record<string, unknown>, name: string, value: unknown): void {
if (name === '__proto__') {
Object.defineProperty(values, name, {
value,
enumerable: true,
writable: true,
configurable: true,
});
} else {
values[name] = value;
}
}
}
|