Node.js Util- module
Voorbeeld
Maak een string op met de argumenten "Linus" en "6":
var util = require('util');
var txt = 'Congratulate %s on his %dth
birthday!';
var result = util.format(txt, 'Linus', 6);
console.log(result);
Definitie en gebruik
De Util-module biedt toegang tot enkele hulpprogramma-functies.
Syntaxis
De syntaxis voor het opnemen van de Util-module in uw toepassing:
var util = require('util');
Eigenschappen en methoden gebruiken
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 |