@ts-stack/type-is

1.0.1 • Public • Published

@ts-stack/type-is

Infer the content-type of a headers.

Install

npm install @ts-stack/type-is

Usage

import http from 'http';
import { typeIs } from '@ts-stack/type-is';

http.createServer(function (req, res) {
  const istext = typeIs(req.headers, ['text/*'])
  res.end('you ' + (istext ? 'sent' : 'did not send') + ' me text')
})

License

MIT

Dependencies (2)

Dev Dependencies (13)

Package Sidebar

Install

npm i @ts-stack/type-is

Weekly Downloads

206

Version

1.0.1

License

MIT

Unpacked Size

56.6 kB

Total Files

21

Last publish

Collaborators

  • ktretiak