Skip to content

medishen/toolkit

Repository files navigation

@medishn/toolkit

npm version License: MIT PRs Welcome

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:


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!

About

a tool kit

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks