ts-utils

Comprehensive TypeScript/JavaScript utility library with cross-environment support (Node.js, browser, web worker) providing helper functions, polyfills (ES5-ES2023), type checking utilities, and optimized implementations for better minification and code readability.

View on GitHub

@nevware21/ts-utils Documentation

Comprehensive TypeScript/JavaScript Utility Library

GitHub Workflow Status (main) codecov npm version downloads downloads Sponsor

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

Reference

Advanced Topics

Library Features

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:

  1. Host the pre-packaged “polyfill” bundle (bundle/es5/ts-polyfills-utils.min.js, or the non-minified bundle/es5/ts-polyfills-utils.js) and load it with a script tag (it installs the polyfills even when the page has an AMD loader)
  2. 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)
  3. 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:

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