Skip to content

nivekalara237/co2mjs

Repository files navigation

co2m.js


🚦 Build Status

co2m.js workflow

co2m.js workflow

co2m.js workflow


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:

  1. Array Operations - Functions for sorting, filtering, flattening, and manipulating arrays.
  2. Object Utilities - Tools for deep cloning, merging, and comparing objects.
  3. String Manipulations - Handy methods for formatting, trimming, splitting, and joining strings.
  4. Date Handling - Utilities for parsing, formatting, and calculating date differences.
  5. Type Checking - Functions to determine data types, including custom type checks.
  6. Math Utilities - Methods for performing common mathematical operations like rounding, averaging, and finding the maximum/minimum values.
  7. Random Generation - Utilities for generating secure random numbers, strings, and IDs.
  8. Numeric Manipulations - Functions to handle numerical operations, including conversions, rounding, and precision handling.
  9. Boolean Operations - Tools for simplifying logical expressions and boolean evaluations
  10. Throwable Utilities - Functions to create and manage custom errors, with tools for enhanced error handling and debugging.
  11. 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.