Interesting approach for array_unique (even taking into account that objects and arrays in the array might have different pointers, but have the same content. There's just one minor issue: x in y will also return true for the constructor attribute, so better use y.hasOwnProperty(x). If your array contains 'constructor' as a string, your function will filter it out.
Interesting approach for array_unique (even taking into account that objects and arrays in the array might have different pointers, but have the same content. There's just one minor issue:
x in y
will also return true for the constructor attribute, so better usey.hasOwnProperty(x)
. If your array contains'constructor'
as a string, your function will filter it out.Yeah. We can implement it that way as well. If you want you can send over a pull request on github.com/amitmerchant1990/essent...
There you go.