@nevware21/ts-utils Documentation
Comprehensive TypeScript/JavaScript Utility Library
Overview
This documentation site provides comprehensive guides and reference materials for @nevware21/ts-utils, a collection of general JavaScript functions written in TypeScript. These utilities help reduce code duplication, improve minification, and provide consistent functionality across different JavaScript environments.
If you find this library useful, please consider sponsoring @nevware21 to support ongoing development and maintenance.
Documentation Resources
Getting Started
- Usage Guide - Comprehensive guide with examples for using the library’s features
- Installation and Setup - How to install and configure the library in your projects
Reference
- API Documentation - Complete API reference generated from source code via TypeDoc
- Function Categories - Categorized list of all functions with documentation links
Advanced Topics
- Advanced Deep Copy Functionality - Using custom handlers with deep copy operations
- Security Helpers - Preventing prototype pollution during object copy and merge operations
- Performance and Minification Benefits - Understanding how the library optimizes for performance
- Timeout Overrides - Using Timeout overrides for custom scheduling behavior
- Bundle Size Optimization - Detailed byte-level measurements and strategies for reducing bundle size
Library Features
- TypeScript-first design with full type definitions
- Comprehensive test coverage across Node.js, browsers, and web workers
- Optimized for tree-shaking and minification
- Zero dependencies
- Cross-environment compatibility (Browser, Node.js, Web Workers)
- Extensive type checking utilities
- ESNext-aware inspection helpers for async iterables and integer range validation (for example isAsyncIterable() and isIntegerInRange())
- Modern ECMAScript features with backward compatibility
- Polyfill support for older environments
Polyfill Information
Some polyfills are provided for simple backward compatibility to enable the utility functions in older environments. None of them are installed by the main module and most are not exported, it only uses them internally where the native function is missing. If you need them, you can:
- Host the pre-packaged “polyfill” bundle (
bundle/es5/ts-polyfills-utils.min.js, or the non-minifiedbundle/es5/ts-polyfills-utils.js) and load it with a script tag (it installs the polyfills even when the page has an AMD loader) - Import it for its side effects from your own bundle, eg.
import "@nevware21/ts-utils/bundle/es5/ts-polyfills-utils.js";(the package marks the polyfills bundles as having side effects, so a bundler keeps the import) - Or provide your own alternative implementations
The polyfills bundle only installs the functions which are missing (it doesn’t replace an existing native function), see the polyfill initializer for the full list.
Frequently Asked Questions
When should I use ts-utils instead of native methods?
You should consider using ts-utils when:
- You need consistent cross-environment behavior
- You want better minification for repeated operations
- You need backward compatibility with older browsers
- You’re working with a large codebase and want consistent utility functions
Does using ts-utils increase my bundle size?
No, ts-utils is designed with tree-shaking in mind. You only pay for what you import, and the minified versions of these functions are typically smaller than their native counterparts when used repeatedly.
How do I contribute to ts-utils?
See our Contributing Guide for information on how to contribute.
Support and Community
- GitHub Issues - Report bugs or request new features
- GitHub Discussions - Discuss usage and ideas
- Stack Overflow - Ask questions with the tag
nevware21-ts-utils