maia-util
Version:
Utility math and music functions supporting various applications by Music Artificial Intelligence Algorithms, Inc.
17 lines (15 loc) • 386 B
JavaScript
export default function get_unique(arr){
// Tom Collins 24/11/2014.
// In
// arr Array mandatory
// Out Array
// This function returns unique elements from the input array. It will not
// handle nested arrays properly (see unique_rows).
var a = [];
for (let i=0, l=arr.length; i<l; i++){
if (a.indexOf(arr[i]) === -1){
a.push(arr[i]);
}
}
return a;
}