This package has been deprecated

Author message:

This package has been renamed to structured-headers

structured-header

0.1.0 • Public • Published

Structured Header parser for Javascript

This library is a parser for the structured header specification. Currently it's still a draft, so this package is also in alpha until the specification stabilizes as a RFC.

Installation

Using npm:

npm install structured-header

Using Yarn:

yarn add structured-header

API

The library exposes 3 functions, and they're used as such:

var header = require('structured-header');
 
header.parseDictionary('foo=1.23, en="Applepie", da=*w4ZibGV0w6ZydGUK*');
// Returns { foo: 1.23, en: 'Applepie', da: new Buffer('...') };
 
header.parseList('foo, bar, baz_45');
// Returns ['foo', 'bar', 'baz_45'];
 
header.parseParameterizedList('abc_123;a=1;b=2; c, def_456, ghi;q="19";r=foo');
 
// Returns [
//   [ 'abc_123', { a: 1, b: 2, c: null } ],
//   [ 'def_456', {} ],
//   [ 'ghi', { q: '19', r: 'foo' } ]
// ]
 

Browser support

There is a minified version of this library in the dist/ directory. This minified file will expose a global variable called 'structuredHeader' which contains the rest of the api.

Dependents (0)

Package Sidebar

Install

npm i structured-header

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

14.8 kB

Total Files

13

Last publish

Collaborators

  • evrt