-
Notifications
You must be signed in to change notification settings - Fork 0
transform
awekrx edited this page May 29, 2026
·
1 revision
import { transform } from '@dev-suite/decorators/transform'
property
Transform property value on assignment/access.
- Manual normalization in setters
- Repeated mapper calls in business code
class UserProfile {
private _name = '';
set name(next: string) {
this._name = next.trim();
}
}import { transform } from '@dev-suite/decorators/transform';
class UserProfile {
@transform(({ value }) => String(value).trim())
name = '';
}- Centralizes cross-cutting behavior.
- Method/class/property code stays focused on domain logic.
class CurrencyState {
private _code = 'USD';
set code(next: string) {
this._code = next.toUpperCase();
}
}import { transform } from '@dev-suite/decorators/transform';
class CurrencyState {
@transform(({ value }) => String(value).toUpperCase())
code = 'USD';
}- Second scenario reuses same policy without duplication.
- Behavior is more consistent and easier to audit.