1.0.1 • Published 1 year ago

@ts-stack/type-is v1.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year 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

1 year ago

1.0.0

1 year ago