This array_unique would work only for things that are unique according to .toString, so {a: 'val'} and {b: 'val'} would be considered as duplicates. example on jsbin
array_unique
.toString
{a: 'val'}
{b: 'val'}
You can fix it by using Map from ES6, though.
Essential functions in JavaScript in vanilla form (inspired by PHP)
I got you, fam: https://github.com/amitmerchant1990/essential-vanilla-javascript-functions/pull/2
Yup. The very first function listed, and it doesn’t work. Pass :D
Edit: In fact, no need for Map, just use ret_arr.indexOf()
ret_arr.indexOf()
This
array_uniquewould work only for things that are unique according to.toString, so{a: 'val'}and{b: 'val'}would be considered as duplicates. example on jsbinYou can fix it by using Map from ES6, though.
I got you, fam: https://github.com/amitmerchant1990/essential-vanilla-javascript-functions/pull/2
Yup. The very first function listed, and it doesn’t work. Pass :D
Edit: In fact, no need for Map, just use
ret_arr.indexOf()