util.isBuffer()

util.isBuffer(object) Stability: 0 - Deprecated: Use Buffer.isBuffer() instead. Returns true if the given "object" is a Buffer. Otherwise, returns false. const util = require('util'); util.isBuffer({ length: 0 }) // false util.isBuffer([]) // false util.isBuffer(new Buffer('hello world')) // true

util.isDate()

util.isDate(object) Stability: 0 - Deprecated Returns true if the given "object" is a Date. Otherwise, returns false. const util = require('util'); util.isDate(new Date()) // true util.isDate(Date()) // false (without 'new' returns a String) util.isDate({}) // false

util.isBoolean()

util.isBoolean(object) Stability: 0 - Deprecated Returns true if the given "object" is a Boolean. Otherwise, returns false. const util = require('util'); util.isBoolean(1) // false util.isBoolean(0) // false util.isBoolean(false) // true

util.inherits()

util.inherits(constructor, superConstructor) 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. const util = require('util'); const EventEmitter = require('events'); function MyStream() { EventEmitter.call(this); } util.inherits(MyStream, EventEmitter); MyStream.prototype.write =

util.inspect()

util.inspect(object[, options]) Return a string representation of object, which is useful for debugging. An optional options object may be passed that alters certain aspects of the formatted string: showHidden - if true then the object's non-enumerable and symbol properties will be shown too. Defaults to false. depth - tells inspect how many times to recurse while formatting the object. This is useful for inspecting large complicated objects. Defaults to 2. To make it recurse indefinitely

util.isArray()

util.isArray(object) Stability: 0 - Deprecated Internal alias for Array.isArray. Returns true if the given "object" is an Array. Otherwise, returns false. const util = require('util'); util.isArray([]) // true util.isArray(new Array) // true util.isArray({}) // false

util.debuglog()

util.debuglog(section) section <String> The section of the program to be debugged Returns: <Function> The logging function 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. For example: var debuglog = util.debuglog('foo'); var bar

util.deprecate()

util.deprecate(function, string) Marks that a method should not be used any more. const util = require('util'); exports.puts = util.deprecate(() => { for (var i = 0, len = arguments.length; i < len; ++i) { process.stdout.write(arguments[i] + '\n'); } }, 'util.puts: Use console.log instead'); It returns a modified function which warns once by default. If --no-deprecation is set then this function is a NO-OP. Configurable at run-time through the process.noDeprecation boolean (onl

util.format()

util.format(format[, ...]) Returns a formatted string using the first argument as a printf-like format. The first argument is a string that contains zero or more placeholders. Each placeholder is replaced with the converted value from its corresponding argument. Supported placeholders are: %s - String. %d - Number (both integer and float). %j - JSON. Replaced with the string '[Circular]' if the argument contains circular references. %% - single percent sign ('%'). This does not consume an

util.error()

util.error([...]) Stability: 0 - Deprecated: Use console.error() instead. Deprecated predecessor of console.error.