Giter VIP home page Giter VIP logo

user-agent's Introduction

User Agent 工具

Build Status Coverage Status

这是一个简单的 AMD 格式的 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 浏览器的识别
  • 维护工作(不发版本):feat: 支持 XX 浏览器的识别
  • 不兼容变更需要包含一段 BREAKING CHANGES 的说明,下次发版递增主版本号。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.