-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanip.js
More file actions
53 lines (48 loc) · 1.27 KB
/
Copy pathmanip.js
File metadata and controls
53 lines (48 loc) · 1.27 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
const sfetchy = async (callback) => {
await fetch('./cine_data.json', {
headers: {
'Content-Type': 'application/json',
Accept: 'application/json',
},
})
.then((response) => {
return response.json();
})
.then((data) => {
console.log(data);
callback(data);
// data.forEach((el) => {
// console.log(el);
// });
})
.catch((error) => {
error = 'lol error';
console.log(error);
});
};
let film = "Beaches of Agnes / Plages d'Agnes";
let str = film.split('/')[0];
console.log(str);
let dir = 'Apichatpong Weerasethakul, thailand, Frankrijk, Duitsland, Italië 2004';
let stra = dir.split(',')[0];
let stro = dir.slice(-4);
let director = stra.replace(/ /g, ' ');
console.log(stra);
console.log(stro);
console.log(director);
sfetchy((data) => {
let cleanData = data.map((item) => {
const container = {};
let title = item.title.split('/')[0];
console.log(title);
container['title'] = title;
return container;
});
console.log(cleanData);
});
// sfetchy((data) => {
// data.forEach((el) => {
// console.log(el);
// });
// });
// { title: "They Live", time: "19:00", date: "20230831", piano: null, location: "ledoux", director: "⁄ kleur ⁄ 94' ⁄ OND: NL" }