@gukeshx100/common-js-functions
v1.0.0
Published
This is the package for my web development practice
Downloads
7
Readme
Number and String Utility Functions
A collection of TypeScript utility functions for performing various checks on numbers and strings.
Installation
You can install this package via npm:
npm install @gukesh/common-js-functions
import { isodd, iseven, isprime, ispalindrome, isanagram, isleapyear, ispositive, isnegative, iszero, iswhole, isdecimal, isdivisible } from 'your-package-name';
console.log(isodd(3)); // true
console.log(isodd(4)); // false
console.log(iseven(4)); // true
console.log(iseven(5)); // false
console.log(isprime(7)); // true
console.log(isprime(10)); // false
console.log(ispalindrome('racecar')); // true
console.log(ispalindrome('hello')); // false
console.log(isanagram('listen', 'silent')); // true
console.log(isanagram('hello', 'world')); // false
console.log(isleapyear(2024)); // true
console.log(isleapyear(2023)); // false
console.log(ispositive(5)); // true
console.log(ispositive(-5)); // false
console.log(isnegative(-5)); // true
console.log(isnegative(5)); // false
console.log(iszero(0)); // true
console.log(iszero(5)); // false
console.log(iswhole(5)); // true
console.log(iswhole(5.5)); // false
console.log(isdecimal(5.5)); // true
console.log(isdecimal(5)); // false
console.log(isdivisible(10, 2)); // true
console.log(isdivisible(10, 3)); // false