mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Remove Duplicates from Pokemon Pokedex entries
This commit is contained in:
@@ -40,6 +40,16 @@ module.exports = class Util {
|
||||
return arr;
|
||||
}
|
||||
|
||||
static removeDuplicates(arr) {
|
||||
if (arr.length === 0 || arr.length === 1) return arr;
|
||||
const newArr = [];
|
||||
for (let i = 0; i < arr.length; i++) {
|
||||
if (newArr.includes(arr[i])) continue;
|
||||
newArr.push(arr[i]);
|
||||
}
|
||||
return newArr;
|
||||
}
|
||||
|
||||
static firstUpperCase(text, split = ' ') {
|
||||
return text.split(split).map(word => `${word.charAt(0).toUpperCase()}${word.slice(1)}`).join(' ');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user