Skip to content

Commit

Permalink
Replace js/jquery.cloudinary.js arrow functions with regular functions (
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir Maoz authored Sep 27, 2020
1 parent 11c7336 commit cce8554
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions js/jquery.cloudinary.js
Original file line number Diff line number Diff line change
Expand Up @@ -1490,12 +1490,16 @@ var slice = [].slice,
// operators
operatorsPattern = "((" + operators + ")(?=[ _]))";
operatorsReplaceRE = new RegExp(operatorsPattern, "g");
expression = expression.replace(operatorsReplaceRE, match => Expression.OPERATORS[match]);
expression = expression.replace(operatorsReplaceRE, function (match) {
return Expression.OPERATORS[match];
});

// predefined variables
predefinedVarsPattern = "(" + Object.keys(Expression.PREDEFINED_VARS).join("|") + ")";
predefinedVarsReplaceRE = new RegExp(predefinedVarsPattern, "g");
expression = expression.replace(predefinedVarsReplaceRE, (match, p1, offset) => (expression[offset - 1] === '$' ? match : Expression.PREDEFINED_VARS[match]));
expression = expression.replace(predefinedVarsReplaceRE, function(match, p1, offset){
return (expression[offset - 1] === '$' ? match : Expression.PREDEFINED_VARS[match]);
});

return expression.replace(/[ _]+/g, '_');
};
Expand Down
2 changes: 1 addition & 1 deletion test/spec/env/js-folder-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jasmine.getEnv().addReporter(new SpecReporter({
// List of files to test
const files = [
{name: 'canvas-to-blob.min.js', checkSum: "33ecbe6885ad339c3a5af0cfa063810d"},
{name: 'jquery.cloudinary.js', checkSum: "6510379e5fa1fb3e8b17db441b922b9b"},
{name: 'jquery.cloudinary.js', checkSum: "27886431ad43cf97ca3edd2ed3f4e379"},
{name: 'jquery.fileupload.js', checkSum: "4bfd85460689a29e314ddfad50c184e0"},
{name: 'jquery.fileupload-image.js', checkSum: "7c40367b00f74b0c7c43bff009dde942"},
{name: 'jquery.fileupload-process.js', checkSum: "840f65232eaf1619ea0aff1ab4f5e444"},
Expand Down

0 comments on commit cce8554

Please sign in to comment.