Skip to content

Commit

Permalink
Fix deprecated jQuery.isArray
Browse files Browse the repository at this point in the history
  • Loading branch information
strausr authored Apr 4, 2024
1 parent e34025e commit 9a18aa4
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions bundlewatch.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ const bundlewatchConfig = {
},
{
path: './dist/cloudinary-jquery.min.js',
maxSize: '23kb'
maxSize: '24kb'
},
{
path: './dist/cloudinary-jquery-file-upload.min.js',
maxSize: '24kb'
maxSize: '25kb'
}
],
defaultCompression: 'gzip',
Expand Down
6 changes: 3 additions & 3 deletions js/jquery.cloudinary.js
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ var slice = [].slice,
* @returns {boolean} true if item is empty
*/
isEmpty = function(item) {
return (item == null) || (jQuery.isArray(item) || Util.isString(item)) && item.length === 0 || (jQuery.isPlainObject(item) && jQuery.isEmptyObject(item));
return (item == null) || (Array.isArray(item) || Util.isString(item)) && item.length === 0 || (jQuery.isPlainObject(item) && jQuery.isEmptyObject(item));
};

/**
Expand Down Expand Up @@ -565,7 +565,7 @@ var slice = [].slice,
setData: setData,
width: width,
isString: isString,
isArray: jQuery.isArray,
isArray: Array.isArray,
isEmpty: isEmpty,

/**
Expand Down Expand Up @@ -4728,7 +4728,7 @@ var slice = [].slice,
return k + '=' + v;
}).join('|');
} else if (Util.isArray(value)) {
if (value.length > 0 && jQuery.isArray(value[0])) {
if (value.length > 0 && Array.isArray(value[0])) {
upload_params[key] = jQuery.map(value, function(array_value) {
return array_value.join(',');
}).join('|');
Expand Down
2 changes: 1 addition & 1 deletion src/jquery-file-upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ jQuery.fn.unsigned_cloudinary_upload = function(upload_preset, upload_params = {
return k + '=' + v;
}).join('|');
} else if (Util.isArray(value)) {
if (value.length > 0 && jQuery.isArray(value[0])) {
if (value.length > 0 && Array.isArray(value[0])) {
upload_params[key] = jQuery.map(value, function(array_value) {
return array_value.join(',');
}).join('|');
Expand Down
2 changes: 1 addition & 1 deletion src/util/jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export var identity = function(value) {
/**
* @class Util
*/
export var isArray = jQuery.isArray;
export var isArray = Array.isArray;

export var assign = jQuery.extend;

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: "7c7becb6f9ecf2defa663e70a6b3a0f5"},
{name: 'jquery.cloudinary.js', checkSum: "22e7276c8dec1760246a230fd9fa26c3"},
{name: 'jquery.cloudinary.js', checkSum: "171ee44fcb5e68e16362c71775a88afc"},
{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 9a18aa4

Please sign in to comment.