npm.io
1.2.0 • Published 1 year ago

useragents-me-api

Licence
MIT
Version
1.2.0
Deps
2
Size
9 kB
Vulns
0
Weekly
0
Stars
16

Useragents.me Node.js APIs wrapper

Coverage Status Maintainability npm Donate

NPM

Simple Node.js wrapper for useragents.me.

Install

npm i useragents-me-api

Example

const { useragentsme } = require('useragents-me-api');

async function main() {
  try {
    // Get most common mobile user agents
    const mobileUserAgents = await useragentsme(); // Default arg is 'mobile'
    console.log(mobileUserAgents); // [{"ua": "Mozilla/5.0...", "pct": 44.123...}, ...]
    // Get most common desktop user agents
    const desktopUserAgents = await useragentsme('desktop');
    console.log(desktopUserAgents); // [{"ua": "Mozilla/5.0...", "pct": 40.123...}, ...]
  } catch (error) {
    console.log(error);
  }
}
Run tests

npm test

Run lint

npm run lint

Author

Keywords