The util
module is primarily designed to support the needs of Node.js' own internal APIs.
See also:
Static methods
staticcallbackify(original:Function, args:Rest<Dynamic>):(Null<Error>, Null<Dynamic>) ‑> Void
Takes an async
function (or a function that returns a Promise
) and returns a function following the
error-first callback style, i.e. taking an (err, value) => ...
callback as the last argument.
See also:
staticdebug(string:String):Void
Deprecated predecessor of Console.error
.
staticdebuglog(section:String):Rest<Dynamic> ‑> Void
The util.debuglog()
method is used to create a function that conditionally writes debug messages to stderr
based on the existence of the NODE_DEBUG
environment variable.
See also:
staticdeprecate<T>(fun:T, msg:String, ?code:String):T
The util.deprecate()
method wraps fn
(which may be a function or class) in such a way that it is marked
asdeprecated.
See also:
staticerror(args:Rest<Dynamic>):Void
Deprecated predecessor of console.error.
staticformat(format:String, args:Rest<Dynamic>):String
staticformat(args:Rest<Dynamic>):String
The util.format()
method returns a formatted string using the first argument as a printf
-like format string
which can contain zero or more format specifiers.
See also:
staticformatWithOptions(inspectOptions:InspectOptions, format:String, args:Rest<Dynamic>):String
staticformatWithOptions(inspectOptions:InspectOptions, args:Rest<Dynamic>):String
This function is identical to util.format()
, except in that it takes an inspectOptions
argument which
specifies options that are passed along to util.inspect()
.
See also:
staticgetSystemErrorName(err:Int):String
Returns the string name for a numeric error code that comes from a Node.js API.
See also:
staticinherits(constructor:Class<Dynamic>, superConstructor:Class<Dynamic>):Void
Inherit the prototype methods from one constructor
into another.
See also:
staticinspect(object:Dynamic, ?options:Null<InspectOptions>):String
staticinspect(object:Dynamic, ?showHidden:Bool, ?depth:Int, ?colors:Bool):String
The util.inspect()
method returns a string representation of object
that is intended for debugging.
See also:
staticisArray(object:Dynamic):Bool
Returns true if the given "object" is an Array. false otherwise.
staticisBoolean(object:Dynamic):Bool
Returns true if the given "object" is a Bool. false otherwise.
staticisBuffer(object:Dynamic):Bool
Returns true if the given "object" is a Buffer. false otherwise.
staticisDate(object:Dynamic):Bool
Returns true if the given "object" is a Date. false otherwise.
staticisDeepStrictEqual(val1:Dynamic, val2:Dynamic):Bool
staticisError(object:Dynamic):Bool
Returns true if the given "object" is an Error. false otherwise.
staticisFunction(object:Dynamic):Bool
Returns true if the given "object" is a Function. false otherwise.
staticisNull(object:Dynamic):Bool
Returns true if the given "object" is strictly null. false otherwise.
staticisNullOrUndefined(object:Dynamic):Bool
Returns true if the given "object" is null or undefined. false otherwise.
staticisNumber(object:Dynamic):Bool
Returns true if the given "object" is a Float. false otherwise.
staticisObject(object:Dynamic):Bool
Returns true if the given "object" is strictly an Object and not a Function. false otherwise.
staticisPrimitive(object:Dynamic):Bool
Returns true if the given "object" is a primitive type. false otherwise.
staticisRegExp(object:Dynamic):Bool
Returns true if the given "object" is a RegExp. false otherwise.
staticisString(object:Dynamic):Bool
Returns true if the given "object" is a String. false otherwise.
staticisSymbol(object:Dynamic):Bool
Returns true if the given "object" is a Symbol. false otherwise.
staticisUndefined(object:Dynamic):Bool
Returns true if the given "object" is undefined. false otherwise.
staticprint(args:Rest<Dynamic>):Void
Deprecated predecessor of console.log.
staticpromisify(original:Function):Rest<Dynamic> ‑> Promise<Dynamic>
Takes a function following the common error-first callback style, i.e. taking an (err, value) => ...
callback
as the last argument, and returns a version that returns promises.
See also: