1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-23 22:36:32 +02:00

Doc: Added sponsors and automatically build sponsor list on README

This commit is contained in:
Laurent Cozic
2021-07-26 18:21:19 +01:00
parent 8920db5537
commit 361802273d
11 changed files with 96 additions and 23 deletions

16
packages/lib/array.ts Normal file
View File

@@ -0,0 +1,16 @@
export function shuffle<T>(array: T[]): T[] {
array = array.slice();
for (let i = array.length - 1; i > 0; i--) {
const j = Math.floor(Math.random() * (i + 1));
const temp = array[i];
array[i] = array[j];
array[j] = temp;
}
return array;
}
export function unique<T>(array: T[]): T[] {
return array.filter(function(elem, index, self) {
return index === self.indexOf(elem);
});
}