typia
Version:
Superfast runtime validators with only one line
21 lines (19 loc) • 570 B
text/typescript
import { _notationKeyCollision } from "./_notationKeyCollision";
export const _notationAssign = (
output: Record<string, any>,
sources: Record<string, string>,
source: string,
value: any,
rename: (str: string) => string,
): void => {
const destination: string = rename(source);
if (Object.hasOwn(output, destination))
_notationKeyCollision(sources[destination]!, source, destination);
Object.defineProperty(output, destination, {
configurable: true,
enumerable: true,
value,
writable: true,
});
sources[destination] = source;
};