mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Create json script update
This commit is contained in:
parent
49704776a1
commit
a8d4a35eb8
1 changed files with 8 additions and 1 deletions
|
@ -6,6 +6,8 @@ const file = params[2]
|
||||||
const data = fs.readFileSync(file,'utf8').split('\n')
|
const data = fs.readFileSync(file,'utf8').split('\n')
|
||||||
console.log(data)
|
console.log(data)
|
||||||
|
|
||||||
|
console.log("TODO: remove 'Q: ' and 'A: '")
|
||||||
|
|
||||||
let currVal = {}
|
let currVal = {}
|
||||||
const res = data.reduce((acc, val) => {
|
const res = data.reduce((acc, val) => {
|
||||||
const formattedVal = val.replace(/\r/g, '').trim()
|
const formattedVal = val.replace(/\r/g, '').trim()
|
||||||
|
@ -21,7 +23,12 @@ const res = data.reduce((acc, val) => {
|
||||||
currVal.A = formattedVal
|
currVal.A = formattedVal
|
||||||
return [
|
return [
|
||||||
...acc,
|
...acc,
|
||||||
currVal
|
{
|
||||||
|
...currVal,
|
||||||
|
data: {
|
||||||
|
type: 'simple'
|
||||||
|
}
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue