Node.js Util- module

❮ Ingeboude modules


Voorbeeld

Formateer 'n string deur die argumente "Linus" en "6" te gebruik:

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

console.log(result);

Definisie en gebruik

Die Util-module bied toegang tot sommige nutsfunksies.


Sintaksis

Die sintaksis om die Util-module in jou toepassing in te sluit:

var util = require('util');

Gebruik eienskappe en metodes

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

❮ Ingeboude modules