Introducing Socket Firewall: Free, Proactive Protection for Your Software Supply Chain.Learn More
Socket
Book a DemoInstallSign in
Socket

@searchfe/user-agent

Package Overview
Dependencies
Maintainers
18
Versions
58
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@searchfe/user-agent

AMD package for user-agent detection.

latest
Source
npmnpm
Version
1.9.16
Version published
Weekly downloads
1.1K
-7.39%
Maintainers
18
Weekly downloads
 
Created
Source

User Agent 工具

Build Status Coverage Status

这是一个 User Agent 检测工具。

安装

apmjs install --save @searchfe/user-agent

例子

var ua = require('@searchfe/user-agent')
if (ua.isIOS()) {
    var version = ua.iOSVersion()
    console.log('main version': version[0])
    console.log('sub  version': version[1])
}

UMD 版本引入

Rollup

import path from 'path';

export default {
    //...
    plugins: [{
        resolveId(id) {
            if (id.startsWith('@searchfe/user-agent')) {
                return path.resolve(`${yourPath}/@searchfe/user-agent/index.umd.js`);
            }
            return null;
        }
    }],
    //...
}

Webpack

module.exports = {
    //...
    resolve: {
        alias: {
            "@searchfe/user-agent": "@searchfe/user-agent/index.umd.js"
        }
    }
};

贡献

本仓库使用 semantic release 自动发布 NPM,因此需要你的 commit 信息符合 Commitizen 规范。比如:

  • bugfix 例子(自动发 bugfix 版本):fix: 修复在 XX 情况下的 XX 问题
  • feature 例子(自动发 minor 版本):feat: 支持 XX 浏览器的识别
  • 维护工作(不发版本):chore: 支持 XX 浏览器的识别
  • 不兼容变更需要包含一段 BREAKING CHANGES 的说明,下次发版递增主版本号。

FAQs

Package last updated on 26 Sep 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts