Frontend vs backend
When to use operators, prototypes, or core functions.Frontend
Prefer operators or core functions/classes (tree-shakeable).
typescript
import { format, maskCpf, split } from '@koalarx/utils/operators';
format(new Date('2023-10-01'), 'dd/MM/yyyy').split('/');
maskCpf(user.cpf).toString();
split(csvLine, ',').clearEmptyValues();
Avoid import '@koalarx/utils/prototypes' in the browser bundle.
Backend
Prototypes in main give global DX:
typescript
import '@koalarx/utils/prototypes';
cpf.maskCpf();
valor.maskCoin();
Each realm (process, worker, SSR, tests) needs the import on its entry.