Packages

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

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Util
  2. Object
  3. Any
  4. AnyRef
  5. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def callbackify[T](original: Function): Function2[Any, T, Any]
  6. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()
  7. 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.

    Example:
    1. util.debuglog(section)

  8. 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.

    Example:
    1. util.deprecate(function, message)

  9. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. 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.

    Example:
    1. util.format(format[, ...])

  13. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  14. def hasOwnProperty(v: String): Boolean
    Definition Classes
    Object
  15. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  16. 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.

    Example:
    1. util.inherits(constructor, superConstructor)

  17. 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

    Example:
    1. util.inspect(object[, options])

  18. val inspect: InspectObject
  19. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  20. def isPrototypeOf(v: Object): Boolean
    Definition Classes
    Object
  21. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  22. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  23. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  24. def promisify(original: Function): Function
  25. val promisify: PromisifyObject
  26. def propertyIsEnumerable(v: String): Boolean
    Definition Classes
    Object
  27. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  28. def toLocaleString(): String
    Definition Classes
    Object
  29. def toString(): String
    Definition Classes
    AnyRef → Any
  30. def valueOf(): Any
    Definition Classes
    Object
  31. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  32. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... ) @native()

Deprecated Value Members

  1. 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.

    Example:
    1. util._extend(target, source)

  2. 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.

    Example:
    1. util.debug(string)

  3. 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.

    Example:
    1. util.error([...])

  4. 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.

    Example:
    1. util.isArray(object)

  5. 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

    Example:
    1. util.isBoolean(object)

  6. 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.

    Example:
    1. util.isBuffer(object)

  7. 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

    Example:
    1. util.isDate(object)

  8. 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

    Example:
    1. util.isError(object)

  9. 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

    Example:
    1. util.isFunction(object)

  10. 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

    Example:
    1. util.isNull(object)

  11. 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

    Example:
    1. util.isNullOrUndefined(object)

  12. 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

    Example:
    1. util.isNumber(object)

  13. 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

    Example:
    1. util.isObject(object)

  14. 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

    Example:
    1. util.isPrimitive(object)

  15. 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

    Example:
    1. util.isRegExp(object)

  16. 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

    Example:
    1. util.isString(object)

  17. 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

    Example:
    1. util.isSymbol(object)

  18. 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

    Example:
    1. util.isUndefined(object)

  19. 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.

    Example:
    1. util.log(string)

  20. 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

    Example:
    1. util.print([...])

  21. 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)

    Example:
    1. util.pump(readableStream, Writable[, callback])

  22. 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.

    Example:
    1. util.puts([...])

Inherited from Object

Inherited from Any

Inherited from AnyRef

Inherited from Any

Ungrouped