However, according to ECMAScript Language Specification, each String value is represented by 16-bit unsigned integer, Number uses the double-precision 64-bit format IEEE 754 values including the special "Not-a-Number" (NaN) values, positive infinity, and negative infinity.
Having this knowledge, the module calculates how much memory object will allocate.
npm install object-sizeof
var sizeof =// 2B per character, 6 chars total => 12Bconsole// 8B for Number => 8Bconsolevar param ='a': 1'b': 2'c':'d': 4// 4 one two-bytes char strings and 3 eighth-bytes numbers => 32Bconsole
// 2B per character, 6 chars total => 12Bconsole// 8B for Number => 8Bconsoleconst param ='a': 1'b': 2'c':'d': 4// 4 one two-bytes char strings and 3 eighth-bytes numbers => 32Bconsole
The MIT License (MIT)
Copyright (c) 2015, Andrei Karpushonak aka @miktam