import { Transform } from 'class-transformer';

export function TransformNumber(): PropertyDecorator {
  return Transform(({ value }) => {
    if (!value) return undefined;

    if (typeof value === 'number') return value;

    return Number(value);
  });
}
