Type checking functions for JavaScript values.
npm install @pwshub/bellajsimport {
isNumber,
isString,
isArray,
isObject,
isNil
} from '@pwshub/bellajs'Check if value is a number.
isNumber(42) // true
isNumber(3.14) // true
isNumber('42') // false
isNumber(null) // falseCheck if value is an integer.
isInteger(42) // true
isInteger(3.14) // false
isInteger(-5) // trueCheck if value is an array.
isArray([1, 2, 3]) // true
isArray([]) // true
isArray('array') // falseCheck if value is a string.
isString('hello') // true
isString('') // true
isString(42) // falseCheck if value is a boolean.
isBoolean(true) // true
isBoolean(false) // true
isBoolean(1) // falseCheck if value is null.
isNull(null) // true
isNull(undefined) // false
isNull(0) // falseCheck if value is undefined.
isUndefined(undefined) // true
isUndefined() // true
isUndefined(null) // falseCheck if value is null or undefined.
isNil(null) // true
isNil(undefined) // true
isNil(0) // false
isNil('') // falseCheck if value is a function.
isFunction(() => {}) // true
isFunction(function() {}) // true
isFunction(42) // falseCheck if value is a plain object (not array).
isObject({}) // true
isObject({ a: 1 }) // true
isObject([]) // false
isObject(null) // falseCheck if value is a valid date.
isDate(new Date()) // true
isDate('2026-01-01') // false
isDate(new Date('invalid')) // falseCheck if value is a valid email address.
isEmail('user@example.com') // true
isEmail('invalid') // false
isEmail(123) // falseCheck if value is empty (null, undefined, empty string, empty array, or empty object).
isEmpty('') // true
isEmpty([]) // true
isEmpty({}) // true
isEmpty(null) // true
isEmpty('hello') // false
isEmpty([1, 2]) // falseCheck if object has own property (not inherited).
const obj = { name: 'Alice', age: 30 }
hasProperty(obj, 'name') // true
hasProperty(obj, 'toString') // false (inherited)Check if a string is a valid URL with HTTP or HTTPS protocol.
isValidUrl('https://example.com') // true
isValidUrl('http://example.com/path') // true
isValidUrl('ftp://example.com') // false
isValidUrl('not-a-url') // false
isValidUrl('') // falseCheck if a URL string is absolute (starts with http://, https://, or //).
isAbsoluteUrl('https://example.com') // true
isAbsoluteUrl('http://example.com') // true
isAbsoluteUrl('//cdn.example.com/lib.js') // true
isAbsoluteUrl('/path/to/resource') // false
isAbsoluteUrl('relative/path') // false- Object utilities - clone, copies
- String utilities - Text manipulation