maheshjs
v1.0.6
Published
This package helps you in solving day to day various simple challenges and makes you write code faster
Maintainers
Readme
maheshjs
Introduction
maheshjs is a utility library that provides a set of functions for common operations such as string manipulation, random number generation, and mathematical calculations. This package is designed to simplify your coding tasks and improve productivity.
Current Functions
getString
- Description: Returns a string based on specified criteria.
- Usage:
getString(criteria) - Example:
getString('example')returns'example'.
getRandomInt
- Description: Generates a random integer between two specified values.
- Usage:
getRandomInt(min, max) - Example:
getRandomInt(1, 10)returns a random integer between 1 and 10.
getRandomFloat
- Description: Generates a random floating-point number between two specified values.
- Usage:
getRandomFloat(min, max) - Example:
getRandomFloat(1.0, 10.0)returns a random float between 1.0 and 10.0.
isEven
- Description: Checks if a number is even.
- Usage:
isEven(number) - Example:
isEven(4)returnstrue.
isOdd
- Description: Checks if a number is odd.
- Usage:
isOdd(number) - Example:
isOdd(5)returnstrue.
getAverageByNumbersArray
- Description: Calculates the average of an array of numbers.
- Usage:
getAverageByNumbersArray(numbersArray) - Example:
getAverageByNumbersArray([1, 2, 3, 4])returns2.5.
hasDateTimePassed
- Description: Checks if a given date and time has passed.
- Usage:
hasDateTimePassed(dateTime) - Example:
hasDateTimePassed(new Date('2025-01-01'))returnstrueif the date has passed.
Installation
To install the package, run the following command:
npm install maheshjs