structured-headers
Advanced tools
Comparing version 0.1.0 to 0.2.0
ChangeLog | ||
========= | ||
0.2.0 (2019-04-27) | ||
------------------ | ||
* Fully up to date with [draft-ietf-httpbis-header-structure-10][3]. | ||
* True and False are now encoded as `?1` and `?0`. | ||
* Added serializing support. | ||
* Integers with more than 15 digits now error as per the new draft. | ||
* Updated all dependencies. | ||
0.1.0 (2018-12-06) | ||
@@ -33,1 +43,2 @@ ------------------ | ||
[2]: https://tools.ietf.org/html/draft-ietf-httpbis-header-structure-09 | ||
[3]: https://tools.ietf.org/html/draft-ietf-httpbis-header-structure-10 |
{ | ||
"name": "structured-headers", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Implementation of draft-ietf-httpbis-header-structure, structured headers for HTTP.", | ||
@@ -26,12 +26,18 @@ "main": "index.js", | ||
"devDependencies": { | ||
"@types/node": "^10.12.12", | ||
"base32-encode": "^1.1.0", | ||
"@types/node": "^11.13.7", | ||
"base32-encode": "^1.1.1", | ||
"chai": "^4.2.0", | ||
"mocha": "^5.2.0", | ||
"nyc": "^13.1.0", | ||
"tslint": "^5.11.0", | ||
"typescript": "^3.2.1", | ||
"webpack": "^4.27.1", | ||
"webpack-cli": "^3.1.2" | ||
"mocha": "^6.1.4", | ||
"nyc": "^14.0.0", | ||
"ts-node": "^8.1.0", | ||
"tslint": "^5.16.0", | ||
"typescript": "^3.4.5", | ||
"webpack": "^4.30.0", | ||
"webpack-cli": "^3.3.1" | ||
}, | ||
"nyc": { | ||
"extension": [ | ||
".ts" | ||
] | ||
} | ||
} |
@@ -1,15 +0,5 @@ | ||
type Item = string | number | Buffer | boolean; | ||
import { Dictionary, Item, List, ListList, ParameterizedIdentifier, ParameterizedList } from './types'; | ||
type Dictionary = { | ||
[s: string]: Item | ||
}; | ||
export default class Parser { | ||
type List = Item[]; | ||
type ListList = List[]; | ||
type ParameterizedIdentifier = [string, Dictionary]; | ||
type ParameterizedList = ParameterizedIdentifier[]; | ||
class Parser { | ||
input: string; | ||
@@ -251,2 +241,5 @@ position: number; | ||
} else { | ||
if (match[0].length > 16 || match[0][0] === '-' && match[0].length > 15) { | ||
throw Error('Integers must not have more than 15 digits'); | ||
} | ||
return parseInt(match[0], 10); | ||
@@ -343,10 +336,10 @@ } | ||
switch (c) { | ||
case 'T' : | ||
case '0' : | ||
result = false; | ||
break; | ||
case '1' : | ||
result = true; | ||
break; | ||
case 'F' : | ||
result = false; | ||
break; | ||
default: | ||
throw new Error('A "?" must be followed by "T" or "F"'); | ||
throw new Error('A "?" must be followed by "0" or "1"'); | ||
} | ||
@@ -353,0 +346,0 @@ |
@@ -57,4 +57,4 @@ const expect = require('chai').expect; | ||
const skipped = [ | ||
'too long integer', | ||
'negative too long integer', | ||
'long integer', | ||
'long negative integer', | ||
]; | ||
@@ -61,0 +61,0 @@ |
@@ -1,2 +0,2 @@ | ||
const parse = require('../index').parseDictionary; | ||
const parse = require('../dist').parseDictionary; | ||
const expect = require('chai').expect; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
const parse = require('../index').parseItem; | ||
const parse = require('../dist').parseItem; | ||
const expect = require('chai').expect; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
const parse = require('../index').parseListList; | ||
const parse = require('../dist').parseListList; | ||
const expect = require('chai').expect; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
const parse = require('../index').parseList; | ||
const parse = require('../dist').parseList; | ||
const expect = require('chai').expect; | ||
@@ -3,0 +3,0 @@ |
@@ -1,2 +0,2 @@ | ||
const parse = require('../index').parseParamList; | ||
const parse = require('../dist').parseParamList; | ||
const expect = require('chai').expect; | ||
@@ -3,0 +3,0 @@ |
module.exports = [ | ||
{ | ||
entry: './index', | ||
entry: './dist/index', | ||
output: { | ||
@@ -5,0 +5,0 @@ path: __dirname + '/browser', |
Sorry, the diff of this file is not supported yet
31449
25
893
10