The new functions are:
As you might guess from the names these are intended to remove duplicate elements from lists.
A simple code snippet illustrates the difference between the two:
mylist = 'cat,dog,monkey,DOG,Dog,cat'; response = jList.listRemoveDuplicates(mylist); console.log (response); response = jList.listRemoveDuplicatesNoCase(mylist); console.log (response);
In line 3 we perform case-sensitive matching when looking for duplicates. As a result, we don’t consider ‘dog’ to be the equivalent of ‘DOG’ or ‘Dog’ so the result displayed in line 4 will be ‘cat,dog,monkey,DOG,Dog’ – only the duplicate ‘cat’ has been removed.
In line 4 we perform case-insensitive matching when looking for duplicates. As a result, the output from line 7 will be ‘cat,dog,monkey’ as ‘dog’, ‘DOG’ and ‘dog’ are all considered equivalent in this case.
Notice also that in both functions the order of the list elements is unchanged. This illustrates that it’s the second and subsequent occurrences of an element that are considered to be the duplicates and removed, the first occurrence remains in its original place within the list.
The new version of jList, including updated documentation, is available for download from GitHub.