const util = require(
'util'
);
console.log(
"1 => "
, util.formatWithOptions(
{ colors:
true
},
'%%: %s'
,
'alfa'
,
'beta'
, -0));
console.log(
"2 => "
, util.formatWithOptions(
{ colors:
true
},
'%%'
,
'alfa'
,
'beta'
,
'gamma'
));
console.log(
"3 => "
, util.formatWithOptions(
{ colors:
true
},
'%s'
,
'alfa'
, 94321321321223372036854775807));
console.log(
"4 => "
, util.formatWithOptions(
{
showHidden:
false
, depth: 0,
colors:
true
},
'%s'
,
'alfa'
, Object.create(
null
,
{ [Symbol.toStringTag]: { value:
'beta'
} })));
console.log(
"5 => "
, util.formatWithOptions(
{ colors:
true
},
'%d'
,
'alfa'
,
94303685));
console.log(
"6 => "
, util.formatWithOptions(
{ showHidden:
false
, colors:
true
},
'%i'
,
'2020 year 2021, '
,
'He was 40, '
,
'10.33, '
,
'10, '
, 10));
console.log(
"7 => "
, util.formatWithOptions(
{ colors:
true
},
'%f'
,
'94321321321.564000 year 6546'
,
'alfa'
, 78987965465464));
console.log(
"8 => "
, util.formatWithOptions(
{ depth: 0, colors:
true
},
'%j'
,
'{ "name":"Chotu Mishra", "age":23, "city":"Kanpur" }'
,
'alfa'
, 78987965465464));
console.log(
"9 => "
, util.formatWithOptions(
{ colors:
true
},
'%o'
,
class Bar { },
'alfa'
, 78987965465464));
console.log(
"10 => "
, util.formatWithOptions(
{ depth: 0, colors:
true
},
'%o:%d'
,
class Foo { get [Symbol.toStringTag]()
{
return
'alfa'
; } },
'alfa'
,
78987965465464));