@webassemblyjs/helper-wasm-bytecode
Advanced tools
Comparing version 1.1.2-y.6 to 1.1.2-y.7
@@ -6,2 +6,5 @@ var illegalop = "illegal"; | ||
function invertMap(obj) { | ||
var keyModifierFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (k) { | ||
return k; | ||
}; | ||
var result = {}; | ||
@@ -11,3 +14,3 @@ var keys = Object.keys(obj); | ||
for (var i = 0, length = keys.length; i < length; i++) { | ||
result[obj[keys[i]]] = keys[i]; | ||
result[keyModifierFn(obj[keys[i]])] = keys[i]; | ||
} | ||
@@ -296,2 +299,9 @@ | ||
}; | ||
var symbolsByName = invertMap(symbolsByByte, function (obj) { | ||
if (typeof obj.object === "string") { | ||
return "".concat(obj.object, ".").concat(obj.name); | ||
} | ||
return obj.name; | ||
}); | ||
module.exports = { | ||
@@ -312,3 +322,4 @@ symbolsByByte: symbolsByByte, | ||
globalTypesByString: globalTypesByString, | ||
exportTypesByName: exportTypesByName | ||
exportTypesByName: exportTypesByName, | ||
symbolsByName: symbolsByName | ||
}; |
{ | ||
"name": "@webassemblyjs/helper-wasm-bytecode", | ||
"version": "1.1.2-y.6", | ||
"version": "1.1.2-y.7", | ||
"description": "WASM's Bytecode constants", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -6,7 +6,7 @@ const illegalop = "illegal"; | ||
function invertMap(obj) { | ||
function invertMap(obj, keyModifierFn = k => k) { | ||
const result = {}; | ||
const keys = Object.keys(obj); | ||
for (let i = 0, length = keys.length; i < length; i++) { | ||
result[obj[keys[i]]] = keys[i]; | ||
result[keyModifierFn(obj[keys[i]])] = keys[i]; | ||
} | ||
@@ -321,2 +321,10 @@ return result; | ||
const symbolsByName = invertMap(symbolsByByte, obj => { | ||
if (typeof obj.object === "string") { | ||
return `${obj.object}.${obj.name}`; | ||
} | ||
return obj.name; | ||
}); | ||
module.exports = { | ||
@@ -337,3 +345,4 @@ symbolsByByte, | ||
globalTypesByString, | ||
exportTypesByName | ||
exportTypesByName, | ||
symbolsByName | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20787
615