I need to push a hash into array only if it doesn't contain the hash that i want to add. For example i have an array of hashes :
var someArray = [
{field_1 : "someValue_1", field_2 : "someValue_2"},
{field_1 : "someValue_3", field_2 : "someValue_4"},
{field_1 : "someValue_5", field_2 : "someValue_6"}
]
The value
{field_1 : "someValue_1", field_2 : "someValue_2"}
should not be pushed into array as it is already there, but the value
{field_1 : "someValue_7", field_2 : "someValue_8"}
should, as the array does't contain such value.
Is there any way to do it using jQuery?
Now i'm just using $.each loop and check if the array contains some hash. If it does i trigger a flag. But i don't like this solution.
someArraysorted? (would simplify the search)