header-field

Properly format a header field into a lowercased hyphenated string.


Keywords
capital, capitalize, field, header, http, hyphen, hyphenated
License
MIT
Install
npm install header-field@1.0.5

Documentation


Header-Field
API Stability TypeScript Styled with prettier Build status Test Coverage NPM Version Downloads Browser Bundle Size

Transform header fields into a properly formatted string, with lowercase characters and hyphens.

Installation

Npm

npm install header-field

Example

import { normalize } from "header-field";

normalize("content-type"); //-> "content-type"
normalize("content-Length"); //-> "content-length"
normalize("Content-Disposition"); //-> "content-disposition"

// Special case: referrer -> referer.
normalize("Referrer"); //-> "referer"

Contributions

  • Use npm test to build and run tests.

Please feel free to create a PR!