Skip to content

Commit a0de57a

Browse files
committed
[#975] Updated update-syntax-highlighting.js
1 parent 6c6b54e commit a0de57a

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

server/scripts/update-syntax-highlighting.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
const fs = require('fs');
22
const process = require('process');
3-
const request = require('request');
3+
const axios = require('axios');
44

5-
request('https://p5js.org/reference/data.json', (err, res) => {
6-
if (!err) {
7-
const result = res.toJSON();
8-
const data = JSON.parse(result.body);
5+
axios
6+
.get('https://p5js.org/reference/data.json')
7+
.then((response) => {
8+
const { data } = response;
99

1010
const arr = data.classitems;
1111
const p5VariableKeywords = {};
@@ -50,7 +50,7 @@ request('https://p5js.org/reference/data.json', (err, res) => {
5050
}
5151
}
5252
);
53-
} else {
54-
console.log("Error!! Couldn't fetch the data.json file");
55-
}
56-
});
53+
})
54+
.catch((err) => {
55+
throw err;
56+
});

0 commit comments

Comments
 (0)