Node.js Util Module
ဥပမာ
အငြင်းအခုံ "Linus" နှင့် "6" ကို အသုံးပြု၍ စာကြောင်းတစ်ခုကို ပုံစံဖော်ပါ-
var util = require('util');
var txt = 'Congratulate %s on his %dth
birthday!';
var result = util.format(txt, 'Linus', 6);
console.log(result);
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
Util module သည် အချို့သော utility function များကို အသုံးပြုခွင့် ပေးပါသည်။
အထားအသို
သင့်အပလီကေးရှင်းတွင် Util module ကိုထည့်သွင်းရန်အတွက် syntax သည်-
var util = require('util');
အသုံးဝင်ပုံများနှင့် နည်းလမ်းများ
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 |