1.0.1 • Published 11 months ago

@ts-stack/type-is v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@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

1.0.1

11 months ago

1.0.0

11 months ago