Skip to content

koayjs/koay-ua

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

koay-ua

npm package


Table of contents


Installation

npm install --save koay-ua

# or

cnpm install --save koay-ua

Usage

const Koa = require('koa');
const ua = require('koay-ua');

const app = new Koa();

ua.middleware(app);
app.use((ctx) => {
  ctx.userAgent = ctx.parseUserAgent();
});

// or
app.use((ctx) => {
  ctx.userAgent = ua(ctx.headers['user-agent']);
});

Releases

No releases published

Packages

No packages published