Wondering what’s next for npm?Check out our public roadmap! »

    @tdmalone/simple-body-parser

    0.0.1 • Public • Published

    Simple Body Parser

    Parses input in either application/json or application/x-www-form-urlencoded content-types, returning it as an object.

    Usage

    Install with Yarn:

    yarn add @tdmalone/simple-body-parser
    

    Or with npm:

    npm install @tdmalone/simple-body-parser
    

    Then, pass strings and get an object back:

    const parse = require( '@tdmalone/simple-body-parser' );
    
    const body = '{"some":"data"}';
    const data = parse( body, 'application/json' );
    
    console.log( data );
    

    Ideally, you'd use this while parsing input from some source where the content-type is provided as a header.

    Tests

    Coming soon via Jest. Runnable with yarn test.

    License

    MIT.

    Install

    npm i @tdmalone/simple-body-parser

    DownloadsWeekly Downloads

    8

    Version

    0.0.1

    License

    MIT

    Unpacked Size

    6.51 kB

    Total Files

    8

    Last publish

    Collaborators

    • avatar