Skip to content
Snippets Groups Projects
Commit 45246a3b authored by Aaron Bohy's avatar Aaron Bohy
Browse files

[FIX] web: utils: fix typos in patch and unpatch

The use of 'this' to call other utils adds a restriction on the
way utils are called from the outside:

  utils.patch(...); // works fine

  const patch = utils.patch;
  patch(...); // doesn't work
parent 1110ea43
No related branches found
No related tags found
No related merge requests found
......@@ -525,7 +525,7 @@ var utils = {
* @param {Object} patch
* @returns {Function}
*/
patch: function(C, patchName, patch) {
patch: function (C, patchName, patch) {
let metadata = patchMap.get(C.prototype);
if (!metadata) {
metadata = {
......@@ -562,7 +562,7 @@ var utils = {
});
}
return this.unpatch.bind(null, C, patchName);
return utils.unpatch.bind(null, C, patchName);
},
/**
* performs a half up rounding with a fixed amount of decimals, correcting for float loss of precision
......@@ -722,10 +722,10 @@ var utils = {
* @param {Class} C
* @param {string} patchName
*/
unpatch: function(C, patchName) {
unpatch: function (C, patchName) {
const proto = C.prototype;
let metadata = patchMap.get(proto);
if (!metdata) {
if (!metadata) {
return;
}
patchMap.delete(proto);
......@@ -738,7 +738,7 @@ var utils = {
// apply other patches
for (let name of metadata.current) {
if (name !== patchName) {
this.patch(C, name, metadata.patches[name]);
utils.patch(C, name, metadata.patches[name]);
}
}
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment