-
Notifications
You must be signed in to change notification settings - Fork 286
Open
Labels
Description
Hi all,
Firstly, I like to appreciate the author for this lib. Understand it is the most downloaded lib for this function and has been stable for years.
Maybe I missed out something obvious, can someone in the community tell me what happens here:
// tested on nodejs v14, v18
const sprintf = require('sprintf-js');
let num = 150460469257; // 0x2308249009
// simpliy convert number to hex string
const hexStr_native = num.toString(16);
const hexStr_sprintfjs = sprintf.sprintf("%x", num);
console.log(hexStr_native); // 2308249009 as expected
console.log(hexStr_sprintfjs); // expecting 2308249009, but get 8249009. Seems only max 4 bytes (32 bit) number allowed, larger than that will be trimmed. I am not aware this lib has this restriction.Thanks.
Cheers,
Paul
Reactions are currently unavailable