1.0.4 ⢠Published 5 months ago
@medishn/toolkit v1.0.4
@medishn/toolkit
Features
Core Utilities
- Object Inspection - Safely navigate nested structures with
inspect()
- Deep Merging - Type-safe object merging with
merge()
- Data Transformation - Chainable
map()
,filter()
,reduce()
operations
Type Safety
- 40+ Type Guards - Runtime validation with
isString
,isObject
,isPromise
, etc. - Advanced Types -
Maybe<T>
,Dictionary<T>
,Nullable<T>
, and other essential helpers - HTTP Status Codes - Full
HttpStatus
enum with RFC-compliant values
Logging
- Colorful console output š
- Context-aware logging
- Multiple log levels (
error
,warn
,info
,debug
,verbose
)
Error Handling
- Standardized HTTP exceptions
- RFC 7807 Problem Details format
- Custom error creation utilities
Installation š¦
npm install @medishn/toolkit
# or
yarn add @medishn/toolkit
Quick Start š
import { inspect, Logger, HttpStatus } from '@medishn/toolkit';
// Object Inspection
const userData = inspect(rawData).to('profile').get('email');
// Logging
const logger = new Logger({ context: 'Auth' });
logger.info('User logged in', { userId: 123 });
// Error Handling
throw new NotFoundException({
detail: 'Resource not found',
status: HttpStatus.NOT_FOUND,
});
// Type Safety
if (isDate(someValue)) {
console.log('Timestamp:', someValue.toISOString());
}
Documentation š
Explore our comprehensive guides:
- Object Inspection & Manipulation
- Logging Best Practices
- Error Handling Guide
- Http Exception Handling Guide
- Merge Object And Arrau Guide
- Type Guard Utilities Guide
- Type Utilities Reference
- Full API Documentation
Contributing š¤
We welcome contributions! Please see our:
Support & Feedback š¬
Found a bug? Have a feature request?
Open an Issue
Get quick help: bitsgenix@gmail.com
ā Love this package? Leave a star on GitHub to show your support!