sulyera
v1.0.1
Published
beraser
Downloads
2
Readme
Utility Belt
A simple JavaScript package providing a collection of utility functions for common tasks.
Installation
Install the package using npm:
npm install utility-belt
Usage
const UtilityBelt = require('utility-belt');
// Example usage
console.log(UtilityBelt.reverseString('hello')); // Output: 'olleh'
console.log(UtilityBelt.capitalizeWords('hello world')); // Output: 'Hello World'
console.log(UtilityBelt.isEven(5)); // Output: false
console.log(UtilityBelt.isOdd(5)); // Output: true
console.log(UtilityBelt.getRandomInt(1, 100)); // Output: random integer between 1 and 100
API
reverseString(str)
Reverses a given string.
str
: The input string.
capitalizeWords(str)
Capitalizes the first letter of each word in a given string.
str
: The input string.
isEven(number)
Checks if a given number is even.
number
: The input number.
isOdd(number)
Checks if a given number is odd.
number
: The input number.
getRandomInt(min, max)
Generates a random integer within the specified range.
min
: The minimum value of the range (inclusive).max
: The maximum value of the range (inclusive).
License
This project is licensed under the MIT License - see the LICENSE file for details.