-
Notifications
You must be signed in to change notification settings - Fork 0
/
paintingBank.js
30 lines (22 loc) · 910 Bytes
/
paintingBank.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const data = [
{ id: 1, year: 1890, title: "The picador", caption: "A picador on a horse before an audience." },
{ id: 2, year: 1893, title: "House in the field", caption: "A narrow two-story building in a sparse landscape" },
{ id: 3, year: 1893, title: "Plaster male torso", caption: "Male monochrome classical torso" },
{ id: 4, year: 1895, title: "Academical study", caption: "Figure with staff in profile" },
{ id: 5, year: 1895, title: "Bust of young man", caption: "Young man in portrait" },
];
const list = () => {
return [...data];
};
const find = (id) => {
const post = data.find(post => post.id === +id);
return { ...post };
};
module.exports = { list: list, find: find }
// const list = () => {
// return [...data];
// };
// const find = (id) => {
// const painting = data.find(painting => painting.id === parseInt(id);
// return painting;
// };