Skip to content

Uttamdevsharma/utilitex

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Utilitex

A lightweight and simple utility library, inspired by Lodash, to provide helpful and practical functions for everyday JavaScript development.

Installation

Install the package with npm:

npm install utilitex

Usage

const { chunk } = require('utilitex');

const array = [1, 2, 3, 4, 5, 6, 7];

// Split the array into chunks of size 2
const chunkedArray = chunk(array, 2);
console.log(chunkedArray);
// => [[1, 2], [3, 4], [5, 6], [7]]

API

chunk(array, size)

  • array (Array): The array to process.
  • size (number): The length of each chunk.

Returns a new array containing the chunked arrays.

add(a, b)

  • a (number): The first number.
  • b (number): The second number.

Returns the sum of the two numbers.

multiply(a, b)

  • a (number): The first number.
  • b (number): The second number.

Returns the product of the two numbers.

formatSmartNumber(num)

  • num (number): The number to format.

Returns a formatted string representing the number in a smart, human-readable way (e.g., 1.2K, 5M, 1B).

Testing

To run the tests for this project, use the following command:

npm test

Author

Uttam kumar devsharma

License

ISC

About

A lightweight JavaScript utility library with practical, everyday functions, inspired by Lodash.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published