Skip to content

dtweedle/fetch-headers

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 and Object.keys 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')

(It has been transpiled with closure compiler)

About

fetch headers polyfill

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%