accept-parser
Accept parser
Last updated 5 years ago by haiman .
ISC · Original npm · Tarball · package.json
$ cnpm install accept-parser 
SYNC missed versions from official npm registry.
var ap = require('accept-parser');

ACCEPT

ap.parse('text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8');
/*
[
	{ item: 'text/html', q: 1000 },
	{ item: 'application/xhtml+xml', q: 1000 },
	{ item: 'application/xml', q: 900 },
	{ item: '*/*', q: 800 }
]
*/

ACCEPT-LANGUAGE

ap.parse('zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3')
/*
[
	{ item: 'zh-CN', q: 1000 },
	{ item: 'zh', q: 800 },
	{ item: 'en-US', q: 500 },
	{ item: 'en', q: 300 }
]
 */

ACCEPT-ENCODING

ap.parse('gzip, deflate')
/*
[
	{ item: 'gzip', q: 1000 },
	{ item: ' deflate', q: 1000 }
]
*/

Current Tags

  • 1.0.1                                ...           latest (5 years ago)

2 Versions

  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |