Nibbling Perfect Macaroni

    @lv00/dot-parser
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.7 • Public • Published

    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' }
    }

    Install

    npm i @lv00/dot-parser

    DownloadsWeekly Downloads

    10

    Version

    1.0.7

    License

    ISC

    Unpacked Size

    5 kB

    Total Files

    6

    Last publish

    Collaborators

    • lv00