co2m.js
v1.0.9
Published
___
Downloads
453
Maintainers
Readme
co2m.js
🚦 Build Status
The Common JS Library
✨Common JavaScript Utilities ✅
is a collection of reusable, well-tested, and easy-to-use utility functions designed to
simplify everyday JavaScript programming tasks. This library provides a set of commonly needed functionalities, ranging
from array manipulations and object operations to string processing and date handling. Whether you are working on a web
application, Node.js project, or any other JavaScript-based project, these utilities can help you write cleaner and more
efficient code by reducing the need to reinvent the wheel.
❇️❇️ Key features include:
Array Operations
- Functions for sorting, filtering, flattening, and manipulating arrays.Object Utilities
- Tools for deep cloning, merging, and comparing objects.String Manipulations
- Handy methods for formatting, trimming, splitting, and joining strings.Date Handling
- Utilities for parsing, formatting, and calculating date differences.Type Checking
- Functions to determine data types, including custom type checks.Math Utilities
- Methods for performing common mathematical operations like rounding, averaging, and finding the maximum/minimum values.Random Generation
- Utilities for generating secure random numbers, strings, and IDs.Numeric Manipulations
- Functions to handle numerical operations, including conversions, rounding, and precision handling.Boolean Operations
- Tools for simplifying logical expressions and boolean evaluationsThrowable Utilities
- Functions to create and manage custom errors, with tools for enhanced error handling and debugging.Miscellaneous
- Other helpful utilities such as debounce, throttle, and random ID generation.
This project is ideal for developers looking for a lightweight, dependency-free library to enhance their JavaScript coding experience. All utilities are optimized for performance and are designed to work seamlessly across different environments, including browsers and Node.js.
🚀 Installation
You can easily install the Common JavaScript Utilities library via npm. Simply run the following command in your project directory:
npm install co2m.js
Alternatively, if you're using Yarn, you can install it with:
yarn add co2m.js
Once installed, you can start using the utility functions in your JavaScript or TypeScript projects by importing the necessary modules:
// Importing specific utilities
import {ArrayUtils, StringUtils} from 'co2m.js';
// Using a utility function
const sortedArray = ArrayUtils.sortInt([5, 2, 9, 1]);
// ==> [1, 2, 5, 9]
const distinctArray = ArrayUtils.distinct<number>([12, 2, 12, 9]);
// ==> [12, 2, 9]
const formattedString = StringUtils.trim(' Hello World! ');
// ==> 'Hello World!'
const padString = StringUtils.leftPad("1", "0", 3);
// ==> '0001'
License
This project is licensed under the Apache License 2.0.
You are free to use, modify, and distribute this software in accordance with the terms of the license. For more details, please refer to the LICENSE file included in the repository.