-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CodeReview #26
base: master
Are you sure you want to change the base?
CodeReview #26
Changes from 1 commit
498bfd7
962161d
1c91a70
291d95b
c7fe2e1
0617c06
6a2593c
7fb26ba
2f8e7e3
f9a3262
fe63a16
48f0a08
a174687
b30c08c
e7bb4c5
c5949c6
47ab0b2
78ac729
f205589
07c0547
86f4f1f
9c789a6
e642d17
2c9daa1
42e52c8
f9d00f7
07bad53
8a6b091
7ef740c
6e05300
a89951f
334b35e
6052a27
1d807e5
1592498
aebe0a9
fbae050
87baa1f
fe1a5ec
fc6fa1e
01f9050
a5b72ff
c9fa370
55a1575
dd80434
e672262
ac91867
922fa86
11e69a4
7a4c438
7584b91
9ca3575
80d5077
49b1d81
6006e8c
b90af45
69853f2
f86a598
421f762
dd42167
32386a5
aa16a69
33239d3
cbdd1c6
084860d
ef45d43
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
import pokemon from './data/pokemon/pokemon.js'; | ||
//console.log(pokemon); | ||
// console.log(pokemon); | ||
|
||
const data = { | ||
saveNumber: (searchNumber) => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Muy bien los nombres de las funciones en ingles |
||
let forNumber = ""; | ||
let forNumber = ''; | ||
if (searchNumber <= 151) { | ||
forNumber = pokemon.find(nombre => nombre.id === searchNumber) | ||
}else{ | ||
} else { | ||
alert('Ingresa un número del 1 al 151'); | ||
} | ||
// console.log(forNumber); | ||
return forNumber | ||
return forNumber; | ||
}, | ||
showType: (pokemon, whatType) => { | ||
const typeFilter = pokemon.filter(item => { | ||
|
@@ -20,53 +20,52 @@ const data = { | |
}, | ||
showWeaknesses: (pokemon, whatWeaknesses) => { | ||
const weaknessesFilter = pokemon.filter(item => { | ||
return item.weaknesses.includes(whatWeaknesses) | ||
}) | ||
return weaknessesFilter | ||
return item.weaknesses.includes(whatWeaknesses); | ||
}); | ||
return weaknessesFilter; | ||
}, | ||
orderNumber: (pokemon, saveOrder) => { | ||
// console.log(pokemon.sort()); | ||
console.log(saveOrder); | ||
let orderFilter = ""; | ||
// console.log(saveOrder); | ||
let orderFilter = ''; | ||
switch (saveOrder) { | ||
case '1-151': | ||
orderFilter = pokemon.sort((a, b) => { | ||
return a.id - b.id; | ||
}) | ||
}); | ||
break; | ||
case '151-1': | ||
orderFilter = pokemon.sort((a, b) => { | ||
return b.id - a.id; | ||
}); | ||
break; | ||
case '151-1': | ||
orderFilter = pokemon.sort((a,b) => { | ||
return b.id - a.id; | ||
}); | ||
break; | ||
case 'a-z': | ||
case 'a-z': | ||
orderFilter = pokemon.sort((a, b) => { | ||
if (a.name > b.name) { | ||
return 1; | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Se entiende porque se hace esto evitando el ordenado default unicode? |
||
if (a.name < b.name) { | ||
return -1; | ||
} | ||
}); | ||
break; | ||
case 'z-a': | ||
if (a.name < b.name) { | ||
return -1; | ||
} | ||
}); | ||
break; | ||
case 'z-a': | ||
orderFilter = pokemon.sort((a, b) => { | ||
if (a.name > b.name) { | ||
return -1; | ||
} | ||
if (a.name < b.name) { | ||
return 1; | ||
} | ||
}); | ||
break; | ||
if (a.name > b.name) { | ||
return -1; | ||
} | ||
if (a.name < b.name) { | ||
return 1; | ||
} | ||
}); | ||
break; | ||
default: | ||
alert('Elige otra opción') | ||
alert('Elige otra opción'); | ||
break; | ||
} | ||
return orderFilter; | ||
}, | ||
} | ||
}, | ||
}; | ||
export default data; | ||
// export const filterData = () => { | ||
// return 'filterData'; | ||
// return 'filterData'; | ||
// }; |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No es necesario crear un objeto, se pueden exportar las funciones e forma independiente