import { Transform } from 'class-transformer';

export const BooleanTransform = (defaultValue?: boolean) =>
    Transform(({ value }) => {
        if (value === undefined) return defaultValue;
        return value === 'true' || value === true;
    });
