mirror of
https://github.com/henrywhitaker3/Speedtest-Tracker.git
synced 2025-12-25 06:49:15 +01:00
733 B
733 B
isValuesUnique(array, keyName)
Checking if values are unique
Custom Needs
Having an array of objects and checking if values are unqiue by object key
Since
1.3.0
Category
Array
Arguments
{Array} array - The array of objects
{String} keyName - Name of the object property from an array in which unique will be checking
Returns
{Boolean} Returns true if values are unique and false if not
Example
Unique emails
isValuesUnique([{email: 'api@test.com'}, {email: 'api@test.com'}], 'email');
// => false
Emails are not unique
isValuesUnique([{email: 'api@test.com'}, {email: 'api_1@test.com'}], 'email');
// => true