Maybe fix filtering? I suck at this
This commit is contained in:
parent
9fcb753bfa
commit
13dc274a36
15
index.js
15
index.js
|
|
@ -31,7 +31,16 @@ const main = () => {
|
|||
}).then(async (response) => {
|
||||
// Responses are an array of objects. The first should always have eventlist: 'start', and last should have eventlist: 'complete'. Remove these, make an array of objects {key, val} based on the rest of the response objects.
|
||||
let entries = response.filter(r => r.eventlist !== 'start' && r.eventlist !== 'Complete').map(r => ({ key: r.key, val: r.val }));
|
||||
console.log(entries)
|
||||
for (let entry of entries) {
|
||||
let [type, ext] = entry.key.split('/').shift();
|
||||
if (cfTypes[type]) {
|
||||
respData.push({
|
||||
extension: ext,
|
||||
type: type,
|
||||
target: entry.val
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}).then(() => {
|
||||
sock.getList({
|
||||
|
|
@ -44,7 +53,7 @@ const main = () => {
|
|||
if (cfTypes[type]) {
|
||||
respData.push({
|
||||
extension: ext,
|
||||
type: "CFB",
|
||||
type: type,
|
||||
target: entry.val
|
||||
});
|
||||
}
|
||||
|
|
@ -56,7 +65,7 @@ const main = () => {
|
|||
}).then(async (response) => {
|
||||
let entries = response.filter(r => r.eventlist !== 'start' && r.eventlist !== 'Complete').map(r => ({ key: r.key, val: r.val }));
|
||||
for (let entry of entries) {
|
||||
let [type, ext] = entry.key.split('/');
|
||||
let [type, ext] = entry.key.split('/').shift();
|
||||
if (cfTypes[type]) {
|
||||
respData.push({
|
||||
extension: ext,
|
||||
|
|
|
|||
Loading…
Reference in a new issue