Node.js Kullanım Modülü
Örnek
"Linus" ve "6" bağımsız değişkenlerini kullanarak bir dize biçimlendirin:
var util = require('util');
var txt = 'Congratulate %s on his %dth
birthday!';
var result = util.format(txt, 'Linus', 6);
console.log(result);
Tanım ve Kullanım
Util modülü, bazı yardımcı program işlevlerine erişim sağlar.
Sözdizimi
Util modülünü uygulamanıza dahil etmek için kullanılan sözdizimi:
var util = require('util');
Kullanım Özellikleri ve Yöntemleri
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 |