node-unique-array
Install
$ npm install node-unique-array --save
Then in code you can do:
var nodeUnique = ;
Basic Example 1
var nodeUnique = var unique_array = ; //******* add Method ********* //we can add object to addMethod unique_array; //we can add ArrayOfObjects to addMethod unique_array; // we can also add no.of ArrayOfObjects to addMethod unique_array; console; //======out put==== name: 'vishnu' id: 100 name: 'raj' id: 101 name: 'kumar' id: 111 //******* remove Method ********* console; //======out put==== name: 'raj' id: 101 name: 'kumar' id: 111 //******* get Method ********* // get() method return unique array objects console; //======out put==== name: 'raj' id: 101 name: 'kumar' id: 111 //******* contains Method ********* console // returns true //we can check arrayOfObjects contains Or not//===>it returns true when all the objects in input array should contain in unique_array//===>if one Object not contains in unique_array then it returns false console;// returns true console;// returns false //******* size Method ********* //it returns length of the unique_arrayconsole;//======out put======// 2 //******* clear Method ********* //it clear the unique_array array and makes empty console//======out put======// []
Basic Example 2
we can also pass input array while creating new instance
var nodeUnique = var unique_array = name:'vishnu'id:100 name:'vishnu'id:100 ; console; //======out put====== name:'vishnu'id:100