MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / humanReadableVersionToPacked

Function humanReadableVersionToPacked

src/minimum_runtime_check.js:11–17  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

9(function() {
10 // "30.0.0" -> 300000
11 function humanReadableVersionToPacked(str) {
12 str = str.split('-')[0]; // Remove any trailing part from e.g. "12.53.3-alpha"
13 var vers = str.split('.').slice(0, 3);
14 while(vers.length < 3) vers.push('00');
15 vers = vers.map((n, i, arr) => n.padStart(2, '0'));
16 return vers.join('');
17 }
18 // 300000 -> "30.0.0"
19 var packedVersionToHumanReadable = n => [n / 10000 | 0, (n / 100 | 0) % 100, n % 100].join('.');
20

Callers 1

Calls 4

splitMethod · 0.80
sliceMethod · 0.80
pushMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected