@saifraza/utils
v1.0.0
Published
Shared utility functions for ACS microfrontends
Readme
Shared Utilities Package
Common utility functions shared across all ACS microfrontends.
Installation
yarn add @saifraza/utilsExports
- Date helpers (
formatRelativeTime,formatDate,formatDateTime,formatCurrency,isExpiringSoon) - Common validations (Zod schemas for username, password, email, etc.)
- Logger utility
- Encryption utilities (Base64 encode/decode, password hashing)
Usage
import { formatRelativeTime, commonValidations, logger, encryption } from '@saifraza/utils';
// Date formatting
const timeAgo = formatRelativeTime('2024-01-01T12:00:00Z');
// Validation
const schema = z.object({
username: commonValidations.username,
password: commonValidations.strongPassword,
});
// Logging
logger.error('Something went wrong', error, { userId: 123 });
// Encryption
const encoded = encryption.encode('secret');
const hashed = await encryption.hashPassword('password123');Peer Dependencies
zod^4.0.0 (required for validation schemas)
