2017-11-11 22:35:41 +01:00
|
|
|
'use strict'
|
|
|
|
|
|
|
|
// todo: what is p.number vs p.line?
|
|
|
|
// todo: what is p.icoX?
|
|
|
|
// todo: what is p.oprX?
|
2017-11-12 01:23:34 +01:00
|
|
|
const parseLine = (profile, p) => {
|
2017-11-11 23:56:09 +01:00
|
|
|
if (!p) return null // todo: handle this upstream
|
|
|
|
const res = {type: 'line', name: p.line || p.name}
|
2017-11-11 22:35:41 +01:00
|
|
|
|
2017-11-11 23:56:09 +01:00
|
|
|
if (p.cls) res.class = p.cls
|
2017-11-11 22:35:41 +01:00
|
|
|
if (p.prodCtx) {
|
2017-11-11 23:56:09 +01:00
|
|
|
res.productCode = +p.prodCtx.catCode
|
|
|
|
res.productName = p.prodCtx.catOutS
|
2017-11-11 22:35:41 +01:00
|
|
|
}
|
2017-11-11 23:56:09 +01:00
|
|
|
|
2017-11-12 21:23:29 +01:00
|
|
|
// todo: parse mode, remove from profiles
|
|
|
|
|
2017-11-11 23:56:09 +01:00
|
|
|
return res
|
2017-11-11 22:35:41 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = parseLine
|