UNPKG

@buka/class-transformer-extra

Version:

class-transformer-extra contains methods that's aren't included in the class-transform package.

7 lines (6 loc) 283 B
import { Transform } from 'class-transformer'; export function Replace(searchValue, replaceValue, options) { return Transform(function ReplaceTransform({ value }) { return (typeof value === 'string' ? value.replace(searchValue, replaceValue) : value); }, options); }