DotParser
Parse dotted string into object
Install
npm install --save @lv00/dot-parser
Usage
import parse from '../lib/index.js'
const data = `battery.charge: 100
battery.charge.low: 20
battery.runtime: 995
battery.type: PbAc
device.mfr: EATON
device.model: Ellipse PRO 650
device.serial: P354M05BE0
device.type: ups
driver.name: usbhid-ups`
console.log(parse(data))
// Terminal Output
{
battery: {
charge: { _value: ' 100 ', low: ' 20' },
runtime: ' 995',
type: ' PbAc'
},
device: {
mfr: ' EATON',
model: ' Ellipse PRO 650 ',
serial: ' P354M05BE0',
type: ' ups'
},
driver: { name: ' usbhid-ups' }
}