@dizmo/functions-agent
v1.0.1
Published
navigator.userAgent checker
Downloads
6
Readme
@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