npm

Need private packages and team management tools?Check out npm Orgs. »

fetch-headers

2.0.0 • Public • Published

Fetch headers polyfill

https://developer.mozilla.org/en-US/docs/Web/API/Headers

Packed with latest and newest method from the spec: iterator, entries, keys, values, and support of for...of

const Headers = require('fetch-headers')
 
header = new Headers([
  ['accept', 'application/json']
  ['accept', 'text/plain']
])

Notes

This use

  • WeakMap for private properties
  • Symbol.iterator and Generators* for iteration
  • vanilla ecmascript 6
  • no transpiler
  • no coffeescript or typescript

Up to date node version can just use this as is. (tested in v6.5.0)
Browsers should run this through closer-compiler, babel, Babili, browserify, webpack or equivalent.
Browsers need to include a polyfill for WeakMap if necessary.

Optional for those who want es5 version and don't have the time or effort to compile can use the prebuilt version

var Headers = require('fetch-headers/headers-es5.min.js')

install

npm i fetch-headers

Downloadsweekly downloads

8,576

version

2.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability