Type
The Type
object of the TypeManager
class is designed to check and determine various data types in JavaScript. It provides methods for checking primitive types, objects, arrays, DOM nodes, and other data structures.
import { Type, LoggerBrowser } from '@bitrix24/b24jssdk'
const $logger = LoggerBrowser.build('Test', import.meta.env?.DEV === true)
const testString: any = undefined
$logger.info('isStringFilled:', Type.isStringFilled(testString), testString)
// isStringFilled: false undefined ////
Methods
getTag
getTag(value: any): string
Returns a string representation of the object's type using the Object.prototype.toString
method.
isString
isString(value: any): boolean
Checks if the value is a string.
isStringFilled
isStringFilled(value: any): boolean
Returns true
if the value is a non-empty string.
isFunction
isFunction(value: any): boolean
Checks if the value is a function.
isObject
isObject(value: any): boolean
Checks if the value is an object or a function.
isObjectLike
isObjectLike(value: any): boolean
Checks if the value is object-like (not null
and of type object
).
isPlainObject
isPlainObject(value: any): boolean
Checks if the value is a plain object (created via {}
or new Object()
).
isJsonRpcRequest
isJsonRpcRequest(value: any): boolean
Checks if the value is a JSON-RPC request.
isJsonRpcResponse
isJsonRpcResponse(value: any): boolean
Checks if the value is a JSON-RPC response.
isBoolean
isBoolean(value: any): boolean
Checks if the value is a boolean.
isNumber
isNumber(value: any): boolean
Checks if the value is a number.
isInteger
isInteger(value: any): boolean
Checks if the value is an integer.
isFloat
isFloat(value: any): boolean
Checks if the value is a floating-point number.
isNil
isNil(value: any): boolean
Checks if the value is null
or undefined
.
isArray
isArray(value: any): boolean
Checks if the value is an array.
isArrayFilled
isArrayFilled(value: any): boolean
Returns true
if the value is an array and contains at least one element.
isArrayLike
isArrayLike(value: any): boolean
Checks if the value is array-like (has a length
property).
isDate
isDate(value: any): boolean
Checks if the value is a Date
object.
isDomNode
isDomNode(value: any): boolean
Checks if the value is a DOM node.
isElementNode
isElementNode(value: any): boolean
Checks if the value is a DOM element.
isTextNode
isTextNode(value: any): boolean
Checks if the value is a DOM text node.
isMap
isMap(value: any): boolean
Checks if the value is a Map
object.
isSet
isSet(value: any): boolean
Checks if the value is a Set
object.
isWeakMap
isWeakMap(value: any): boolean
Checks if the value is a WeakMap
object.
isWeakSet
isWeakSet(value: any): boolean
Checks if the value is a WeakSet
object.
isPrototype
isPrototype(value: any): boolean
Checks if the value is a prototype.
isRegExp
isRegExp(value: any): boolean
Checks if the value is a regular expression.
isNull
isNull(value: any): boolean
Checks if the value is null
.
isUndefined
isUndefined(value: any): boolean
Checks if the value is undefined
.
isArrayBuffer
isArrayBuffer(value: any): boolean
Checks if the value is an ArrayBuffer
object.
isTypedArray
isTypedArray(value: any): boolean
Checks if the value is a typed array.
isBlob
isBlob(value: any): boolean
Checks if the value is a Blob
object.
isFile
isFile(value: any): boolean
Checks if the value is a File
object.
isFormData
isFormData(value: any): boolean
Checks if the value is a FormData
object.
clone
clone(
obj: any,
bCopyObj: boolean = true
): any
Clones an object, creating a deep copy if bCopyObj
is true
.