trait Util extends Object
These functions are in the module 'util'. Use require('util') to access them. The util module is primarily designed to support the needs of Node.js's internal APIs. Many of these utilities are useful for your own programs. If you find that these functions are lacking for your purposes, however, you are encouraged to write your own utilities. We are not interested in any future additions to the util module that are unnecessary for Node.js's internal functionality.
- Annotations
- @RawJSType() @native()
- See also
https://nodejs.org/api/util.html
- Alphabetic
- By Inheritance
- Util
- Object
- Any
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##(): Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def callbackify[T](original: Function): Function2[Any, T, Any]
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def debuglog(section: String): Function
This is used to create a function which conditionally writes to stderr based on the existence of a NODE_DEBUG environment variable.
This is used to create a function which conditionally writes to stderr based on the existence of a NODE_DEBUG environment variable. If the section name appears in that environment variable, then the returned function will be similar to console.error(). If not, then the returned function is a no-op.
util.debuglog(section)
Example: - def deprecate(function: Function, message: String, code: String = js.native): Any
Marks that a method should not be used any more.
Marks that a method should not be used any more.
util.deprecate(function, message)
Example: - final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def format(format: String, args: Any*): String
Returns a formatted string using the first argument as a printf-like format.
Returns a formatted string using the first argument as a printf-like format.
util.format(format[, ...])
Example: - def formatWithOptions(inspectOptions: InspectOptions, format: String, args: Any*): String
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getSystemErrorName(err: Int): String
- def hasOwnProperty(v: String): Boolean
- Definition Classes
- Object
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def inherits(constructor: Any, superConstructor: Any): Any
Inherit the prototype methods from one constructor into another.
Inherit the prototype methods from one constructor into another. The prototype of constructor will be set to a new object created from superConstructor.
As an additional convenience, superConstructor will be accessible through the constructor.super_ property.
util.inherits(constructor, superConstructor)
Example: - def inspect(object: Any, options: InspectOptions = js.native): String
The util.inspect() method returns a string representation of object that is primarily useful for debugging.
The util.inspect() method returns a string representation of object that is primarily useful for debugging. Additional options may be passed that alter certain aspects of the formatted string.
- options
the given inspect options
util.inspect(object[, options])
Example: - val inspect: InspectObject
- def isDeepStrictEqual(val1: Any, val2: Any): Boolean
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isPrototypeOf(v: Object): Boolean
- Definition Classes
- Object
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def promisify(original: Function): Function
- val promisify: PromisifyObject
- def propertyIsEnumerable(v: String): Boolean
- Definition Classes
- Object
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toLocaleString(): String
- Definition Classes
- Object
- def toString(): String
- Definition Classes
- AnyRef → Any
- val types: UtilTypes
- def valueOf(): Any
- Definition Classes
- Object
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
Deprecated Value Members
- def _extend[A <: Any, B <: Any, C <: Any](target: A, source: B): C
The util._extend() method was never intended to be used outside of internal Node.js modules.
The util._extend() method was never intended to be used outside of internal Node.js modules. The community found and used it anyway. It is deprecated and should not be used in new code. JavaScript comes with very similar built-in functionality through Object.assign().
- Annotations
- @deprecated
- Deprecated
(Since version 6.0.0) Use Object.assign() instead.
util._extend(target, source)
Example: - def debug(string: String): Any
Deprecated predecessor of console.error.
Deprecated predecessor of console.error.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Use console.debug() instead.
util.debug(string)
Example: - def error(varargs: Any*): Any
Deprecated predecessor of console.error.
Deprecated predecessor of console.error.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Use console.error() instead.
util.error([...])
Example: - def isArray(object: Any): Boolean
Returns true if the given "object" is an Array.
Returns true if the given "object" is an Array. Otherwise, returns false.
NOTEInternal alias for Array.isArray.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Internal alias for Array.isArray.
util.isArray(object)
Example: - def isBoolean(object: Any): Boolean
Returns true if the given "object" is a Boolean.
Returns true if the given "object" is a Boolean. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Alternative not specified
util.isBoolean(object)
Example: - def isBuffer(object: Any): Boolean
Returns true if the given "object" is a Buffer.
Returns true if the given "object" is a Buffer. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Use Buffer.isBuffer() instead.
util.isBuffer(object)
Example: - def isDate(object: Any): Boolean
Returns true if the given "object" is a Date.
Returns true if the given "object" is a Date. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Alternative not specified
util.isDate(object)
Example: - def isError(object: Any): Boolean
Returns true if the given "object" is an Error.
Returns true if the given "object" is an Error. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Alternative not specified
util.isError(object)
Example: - def isFunction(object: Any): Boolean
Returns true if the given "object" is a Function.
Returns true if the given "object" is a Function. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Alternative not specified
util.isFunction(object)
Example: - def isNull(object: Any): Boolean
Returns true if the given "object" is strictly null.
Returns true if the given "object" is strictly null. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Alternative not specified
util.isNull(object)
Example: - def isNullOrUndefined(object: Any): Boolean
Returns true if the given "object" is null or undefined.
Returns true if the given "object" is null or undefined. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Alternative not specified
util.isNullOrUndefined(object)
Example: - def isNumber(object: Any): Boolean
Returns true if the given "object" is a Number.
Returns true if the given "object" is a Number. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Alternative not specified
util.isNumber(object)
Example: - def isObject(object: Any): Boolean
Returns true if the given "object" is strictly an Object and not a Function.
Returns true if the given "object" is strictly an Object and not a Function. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Alternative not specified
util.isObject(object)
Example: - def isPrimitive(object: Any): Boolean
Returns true if the given "object" is a primitive type.
Returns true if the given "object" is a primitive type. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Alternative not specified
util.isPrimitive(object)
Example: - def isRegExp(object: Any): Boolean
Returns true if the given "object" is a RegExp.
Returns true if the given "object" is a RegExp. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Alternative not specified
util.isRegExp(object)
Example: - def isString(object: Any): Boolean
Returns true if the given "object" is a String.
Returns true if the given "object" is a String. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Alternative not specified
util.isString(object)
Example: - def isSymbol(object: Any): Boolean
Returns true if the given "object" is a Symbol.
Returns true if the given "object" is a Symbol. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Alternative not specified
util.isSymbol(object)
Example: - def isUndefined(object: Any): Boolean
Returns true if the given "object" is undefined.
Returns true if the given "object" is undefined. Otherwise, returns false.
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Alternative not specified
util.isUndefined(object)
Example: - def log(message: String): Unit
Output with timestamp on stdout.
Output with timestamp on stdout.
- Annotations
- @deprecated
- Deprecated
(Since version 6.0.0) Use a third party module instead.
util.log(string)
Example: - def print(args: Array[Any]): Unit
Deprecated predecessor of console.log.
Deprecated predecessor of console.log.
- Annotations
- @deprecated
- Deprecated
(Since version 0.11.3) Use console.log() instead
util.print([...])
Example: - def pump(readableStream: IReadable, Writable: IWritable, callback: Function): Unit
Deprecated predecessor of stream.pipe().
Deprecated predecessor of stream.pipe().
- Annotations
- @deprecated
- Deprecated
(Since version 4.0.0) Use ReadableStream.pipe(Writable)
util.pump(readableStream, Writable[, callback])
Example: - def puts(args: |[Array[String], String]*): Unit
Deprecated predecessor of console.log.
Deprecated predecessor of console.log.
- Annotations
- @deprecated
- Deprecated
(Since version 0.11.3) Use console.log() instead.
util.puts([...])
Example: