npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rowser

v0.6.0

Published

An experimental generator-based browser/os/bot detector with proxied API

Downloads

16

Readme

rowser

An experimental generator-based browser/os/bot detector with proxied API

Build Status Build status codecov Coverage Status CodeFactor npm version npm David Known Vulnerabilities FOSSA Status

Table of contents

  1. Installation
  2. API
  3. Usage
  4. Possible flags
  5. License

Installation

npm install rowser --save
yarn add rowser --save

Back to top

API

detect(ua: string = window.navigator.userAgent) => Object

Method detect runs detection process

summary: Object

Property summary saves result of the last detection

Back to top

Usage

By default, rowser gets window.navigator.userAgent as its ua parameter. So in browser environment you can simply do:

rowser.detect();

Also you can use custom useragent string:

const someMobilaUA = 'Mozilla/5.0 (iPhone; CPU iPhone OS 7_0_4 like Mac OS X) AppleWebKit/537.51.1 (KHTML, like Gecko) Mobile/11B554a';

rowser.detect(someMobilaUA);

After that, rowser.detect(ua) returns PlainObject as result:

rowser.detect(someMobilaUA);
// =>
//  {
//    device: "iPhone",
//    engine: "WebKit",
//    engineversion: "537.51",
//    ios: true,
//    name: "Safari",
//    osname: "iOS",
//    osversion: "7.0.4",
//    safari: true,
//    version: "",
//    webkit: true
//  }

NOTE: if you call rowser.detect('') you will get an empty object:

rowser.detect('');
// => {}

After detection rowser saves result in its property called summary:

rowser.summary
// =>
//  {
//    device: "iPhone",
//    engine: "WebKit",
//    engineversion: "537.51",
//    ios: true,
//    name: "Safari",
//    osname: "iOS",
//    osversion: "7.0.4",
//    safari: true,
//    version: "",
//    webkit: true
//  }

NOTE: When detection is done rowser's proxied API will allow you to get result's directly:

rowser.device
// => 'iPhone'

rowser.ios
// => true

rowser.osversion
// => '7.0.4'

Additionally for boolean props, you can add is-prefixes to props names:

rowser.isWebkit
// => true

rowser.iswebkit
// => true

rowser.isWeBkIt
// => true

rowser.isWEBKIT
// => true

rowser.isSafari
// => true

rowser.issafari
// => true

rowser.isSaFArI
// => true

rowser.isSAFARI
// => true

NOTE: is-prefixed props are case insensetive

Back to top

Possible flags

Browsers

Browser | Summary flag --------------------------- | ------------ Android Browser | androidbrowser BlackBerry Browser | blackberrybrowser, bbbrowser Chromium | chromium Google Chrome | chrome Google Search App | gsa, googlesearchapp Dolphin Browser | dolphin Dorothy Browser | dorothy Epiphany | epiphany Mozilla Firefox | firefox Mozilla Firefox Focus | firefox, firefoxfocus Microsoft Internet Explorer | msie K-Meleon | kmeleon Maxthon | maxthon Microsoft Edge | msedge OmniWeb | omniweb Opera | opera Opera Coast | opera, operacoast Opera Mini | opera, operamini Opera Mobile | opera, operamobile Opera Neon | opera, operaneon Pale Moon | palemoon PhantomJS | phantomjs Puffin | puffin QupZilla | qupzilla Rambler Browser | ramblerbrowser, nichrome Apple Safari | safari Sailfish Browser | sailfishbrowser Samsung Internet | samsungbrowser, samsunginternet SeaMonkey | seamonkey Amazon Silk | silk Skyfire | skyfire Sleipnir | sleipnir SlimerJS | slimerjs Tesla Car Browser | teslacarbrowser, qtcarbrowser Tizen Browser | tizenbrowser UC Browser | ucbrowser Vivaldi | vivaldi webOS Browser | webosbrowser Yandex Browser | yandexbrowser

Rendering engines

Rendering engine | Summary flag ----------------- | ------------ Blink | blink EdgeHTML | edgehtml Gecko | gecko Goanna | goanna Presto | presto Trident | trident WebKit | webkit

Operating systems

Operating system | Summary flag ----------------- | ------------ Android | android (SOON) Android TV | androidtv (SOON) Bada | bada BlackBerry OS | blackberry Chrome OS | chromeos (SOON) Firefox OS | firefoxos, fxos iOS | ios Linux | linux macOS | macos NetCast | netcast Sailfish | sailfish Tizen | tizen webOS | webos Windows | windows Windows Phone | windowsphone

Bots

Bots/Crawlers/Spiders | Summary flag ---------------------- | ------------ Alexa Crawlers | alexacrawler Baidu Spiders | baiduspider Bing Crawlers | bingbot DuckDuckBot | duckduckbot Exabot | exabot Facebook Bot | facebookbot Google Crawlers | googlebot LinkedIn Bot | linkedinbot Majestic-12 Crawler | mj12bot Pinterest Bot | pinterestbot SlackBot | slackbot Sogou Spiders | sogouspider StackRambler | stackrambler TelegramBot | telegrambot Twitter Bot | twitterbot WhatsApp Bot | whatsappbot Yahoo! Slurp | yahooslurp Yandex Crawlers | yandexbot

Back to top

License

MIT © Alex Orekhov

FOSSA Status

Back to top