Array.prototype.unique >= 0.1.2
Purpose
Get all the unique values and return them as a new array
Syntax
							Array#uniqe
							(
								
									Stringpath
								
							);
							
						
						
						
							
								Parameters
- path
- Path to use to check for uniqueness
Return values
										Array
										
									
									A new array
Examples
Should return all the unique values
var arr = [1,2,1,3,6,2];
arr.unique();>>> [1, 2, 3, 6]Handle object references
It will only return the same object once, but it won't look into an object's content
var obj = {a: 1},
    arr = [1,1, obj, {a:1}, obj];
arr.unique();>>> [1, {a: 1}, {a: 1}]Use a path to determine uniqueness
You can use dot-notation paths, supported by Object.path
var arr = [
	{id: 'a'},
	{id: 'b'},
	{id: 'a'},
	{id: 'c'},
	{id: 'a'},
	{id: 'c'},
	{id: 'd'},
];
arr.unique('id');>>> [{id: 'a'}, {id: 'b'}, {id: 'c'}, {id: 'd'}]
Comments