Node.js Util Module

❮ Vestavěné moduly


Příklad

Naformátujte řetězec pomocí argumentů "Linus" a "6":

var util = require('util');
var txt = 'Congratulate %s on his %dth birthday!';
var result = util.format(txt, 'Linus', 6);

console.log(result);

Definice a použití

Modul Util poskytuje přístup k některým funkcím utility.


Syntax

Syntaxe pro zahrnutí modulu Util do vaší aplikace:

var util = require('util');

Util vlastnosti a metody

Method Description
debuglog() Writes debug messages to the error object
deprecate() Marks the specified function as deprecated
format() Formats the specified string, using the specified arguments
inherits() Inherits methods from one function into another
inspect() Inspects the specified object and returns the object as a string

❮ Vestavěné moduly