N/util Module

Use the N/util module to manually access methods that verify object and primitive types in a SuiteScript 2.x script. These methods can also be accessed using the global util object. For more information about the global util object, see SuiteScript 2.x Global Objects.

                                   

Use the N/util module to access methods that verify object and primitive types in a SuiteScript 2.0 script.

Each method (for example, util.isArray(obj)) returns a boolean value, based on evaluation of the obj parameter.

If you need to identify a type specific to SuiteScript 2.0, use the toString() global method.

In This Help Topic

N/util Module Members

Member Type

Name

Return Type / Value Type

Supported Script Types

Description

Method

util.each(iterable, callback)

Object or Array

Client and server scripts

Iterates over each member in an Object or Array.

util.extend(receiver, contributor)

Object

Client and server scripts

Copies the properties in a source object to a destination object.

util.isArray(obj)

boolean

Client and server scripts

Returns true if the obj parameter is a JavaScript Array object and false otherwise.

util.isAsyncFunction(obj)

boolean

Client and server scripts

Returns true if the obj parameter is JavaScript Async Function and false otherwise.

util.isBoolean(obj)

boolean

Client and server scripts

Returns true if the obj parameter is a JavaScript Boolean and false otherwise.

util.isDate(obj)

boolean

Client and server scripts

Returns true if the obj parameter is a JavaScript Date object and false otherwise.

util.isFunction(obj)

boolean

Client and server scripts

Returns true if the obj parameter is a JavaScript Function or Async Function and false otherwise.

util.isNumber(obj)

boolean

Client and server scripts

Returns true if the obj parameter is a JavaScript Number object or a value that evaluates to a Number object, and false otherwise.

util.isObject(obj)

boolean

Client and server scripts

Returns true if the obj parameter is a plain JavaScript object (new Object() or {} for example), and false otherwise.

util.isRegExp(obj)

boolean

Client and server scripts

Returns true if the obj parameter is a JavaScript RegExp object or a value that evaluates to a RegExp object, and false otherwise.

util.isString(obj)

boolean

Client and server scripts

Returns true if the obj parameter is a JavaScript String object or a value that evaluates to a String object, and false otherwise.

Related Topics

General Notices