jQuery Utilities & Helpers

These helpers work with arrays/objects, merge data, inspect types, and coordinate async tasks. They don’t touch the DOM but are useful in most jQuery projects.

Quick Reference

Method Description Example
$.each(arr|obj, fn)Iterate arrays/objects (side effects).$.each([1,2], (i,v)=>...)
$.map(arr|obj, fn)Transform items to a new array.$.map([1,2], v=>v*2)
$.grep(arr, fn)Filter array by predicate.$.grep([1,2,3], v=>v%2)
$.inArray(val, arr)Index of value (or -1).$.inArray('b',['a','b'])
$.extend([deep], target, ...src)Shallow/deep copy merge of objects.$.extend(true, {}, a, b)
$.merge(first, second)Merge arrays into first.$.merge([], a); $.merge(dest, b)
$.type(val)Normalized JS type string.$.type(new Date()) === 'date'
$.param(obj)Serialize object to query string.$.param({a:1, t:['x','y']})
$.isPlainObject(obj)True if created via {} or new Object.$.isPlainObject({a:1})
$.uniqueSort(arrayLike)Remove duplicates & sort DOM elements.$.uniqueSort($('.x,.y,.x').get())
$.when(p1, p2, ...)Wait for multiple deferreds.$.when(a,b).done(...)
$.noopNo-operation function placeholder..fail($.noop)
Note: Legacy helpers like $.trim, $.isFunction, and $.isArray are deprecated—prefer native String.prototype.trim, typeof v === 'function', and Array.isArray.

1) $.each() & $.map()


$.each([1,2,3], function(i, v){ ... });
$.map({ a:1, b:2 }, function(v, k){ return k+':'+v; });

2) $.grep()


$.grep([1,2,3,4], function(v){ return v%2===0; });

3) $.inArray()


$.inArray('b', ['a','b','c']); // 1

4) $.extend() (deep merge)


$.extend(true, {}, defaults, overrides);

5) $.merge()


var dest = $.merge([], [1,2]);
$.merge(dest, [3,4]);

6) $.type()


$.type(null); // "null"   $.type(new Date()); // "date"

7) $.param()


$.param({ name:'Sonu', tags:['js','jquery'] });

8) $.isPlainObject()


$.isPlainObject({ a:1 }); // true

9) $.uniqueSort()


$.uniqueSort( $('.x, .y, .x').get() );

10) $.when() & $.noop


$.when($.get('/a'), $.get('/b')).done(function(){ ... }).fail($.noop);
Tip: Use $.extend(true, {}, ...) to create deep copies without mutating your source objects.