@dizmo/functions-agent
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

NPM version Build Status Coverage Status

@dizmo/functions-agent

Safely checks the navigator.userAgent by matching it against a provided regular expression; returns either a RegExpMatchArray in case of a successful match or null otherwise.

Usage

Installation

npm install @dizmo/functions-agent --save

Require

const { agent } = require('@dizmo/functions-agent');

Example(s)

import { agent } from '@dizmo/functions-agent';
if (agent(/chrome/i)) { .. }

Development

Clean

npm run clean

Build

npm run build

without linting and cleaning:

npm run -- build --no-lint --no-clean

with UMD bundling (incl. minimization):

npm run -- build --prepack

with UMD bundling (excl. minimization):

npm run -- build --prepack --no-minify

Lint

npm run lint

with auto-fixing:

npm run -- lint --fix

Test

npm run test

without linting, cleaning and (re-)building:

npm run -- test --no-lint --no-clean --no-build

Cover

npm run cover

without linting, cleaning and (re-)building:

npm run -- cover --no-lint --no-clean --no-build

Debugging

Connect @dizmo/functions-agent to another project:

[@dizmo/functions-agent] $ npm link # symlink global:@dizmo/functions-agent
[a-project] $ npm link a-module # symlink node-modules:@dizmo/functions-agent
[a-project] $ head webpack.config.js # ensure @dizmo/functions-agent in entry.main
entry: {
    main: [..., '@dizmo/functions-agent', './source/index.js']
}

Disconnect @dizmo/functions-agent from the project:

[a-project] $ npm unlink @dizmo/functions-agent # delete local symlink
[@dizmo/functions-agent] $ npm uninstall -g # delete global symlink

Documentation

npm run docs

Publication

npm publish

initially (if public):

npm publish --access=public

Copyright

© 2021 dizmo AG, Switzerland

Readme

Keywords

Package Sidebar

Install

npm i @dizmo/functions-agent

Weekly Downloads

4

Version

1.0.1

License

ISC

Unpacked Size

9.4 kB

Total Files

10

Last publish

Collaborators

  • dizmo-user
  • hsk81