mirror of
https://github.com/faisalman/ua-parser-js.git
synced 2025-09-27 16:08:47 +03:00
Backport - Add new feature: parse user-agent in CLI using npx ua-parser-js "[INSERT-UA-HERE]"
and print the result in JSON format
(cherry picked from commit 150d3c6b4af498ca754099ab34e9426a02c82ab7)
This commit is contained in:
parent
cede70136b
commit
dfa62b6e7a
@ -153,6 +153,7 @@
|
||||
"dist",
|
||||
"src"
|
||||
],
|
||||
"bin": "./script/cli.js",
|
||||
"scripts": {
|
||||
"build": "uglifyjs src/ua-parser.js -o dist/ua-parser.min.js --comments '/^ UA/' && uglifyjs src/ua-parser.js -o dist/ua-parser.pack.js --comments '/^ UA/' --compress --mangle",
|
||||
"test": "jshint src/ua-parser.js && mocha -R nyan test/test.js",
|
||||
|
4
script/cli.js
Executable file
4
script/cli.js
Executable file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
const UAParser = require('ua-parser-js');
|
||||
console.log(JSON.stringify(process.argv.slice(2).map(ua => UAParser(ua)), null, 4));
|
Loading…
x
Reference in New Issue
Block a user