-
Notifications
You must be signed in to change notification settings - Fork 0
lowercase
awekrx edited this page May 29, 2026
·
1 revision
import { lowercase } from '@dev-suite/decorators/lowercase'
parameter
Normalize string parameter to lowercase.
-
value.toLowerCase()in each method - Custom normalization helpers
class UserService {
findByEmail(email: string) {
return this.repo.findByEmail(email.toLowerCase());
}
}import { lowercase } from '@dev-suite/decorators/lowercase';
class UserService {
findByEmail(@lowercase() email: string) {
return this.repo.findByEmail(email);
}
}- Centralizes cross-cutting behavior.
- Method/class/property code stays focused on domain logic.
class TagService {
add(tag: string) {
return this.store.add(tag.toLowerCase());
}
}import { lowercase } from '@dev-suite/decorators/lowercase';
class TagService {
add(@lowercase() tag: string) {
return this.store.add(tag);
}
}- Second scenario reuses same policy without duplication.
- Behavior is more consistent and easier to audit.