summaryrefslogtreecommitdiff
path: root/node_modules/ua-parser/js/index.js
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-10 10:38:44 +0200
committerMinteck <contact@minteck.org>2022-08-10 10:38:44 +0200
commitc6dbf0450566c40efc4a26f4f0717452b6ef95cd (patch)
treeb4be2d508223820d0a77d5a3e35e82684da3b6ec /node_modules/ua-parser/js/index.js
downloadhornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.tar.gz
hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.tar.bz2
hornchat-c6dbf0450566c40efc4a26f4f0717452b6ef95cd.zip
Initial commitHEADmane
Diffstat (limited to 'node_modules/ua-parser/js/index.js')
-rw-r--r--node_modules/ua-parser/js/index.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/node_modules/ua-parser/js/index.js b/node_modules/ua-parser/js/index.js
new file mode 100644
index 0000000..e1890fe
--- /dev/null
+++ b/node_modules/ua-parser/js/index.js
@@ -0,0 +1,32 @@
+var path = require('path'),
+ fs = require('fs'),
+ yaml = require('yamlparser'),
+ Results = require('./lib/results').BackwardsCompatResults;
+
+var file = path.join(__dirname, '..', 'regexes.yaml'),
+ regexes = fs.readFileSync(file, 'utf8');
+
+regexes = yaml.eval(regexes);
+
+var parseUA = require('./lib/ua').makeParser(regexes.user_agent_parsers);
+exports.parseUA = parseUA;
+
+var parseOS = require('./lib/os').makeParser(regexes.os_parsers);
+exports.parseOS = parseOS;
+
+var parseDevice = require('./lib/device').makeParser(regexes.device_parsers);
+exports.parseDevice = parseDevice;
+
+exports.parse = parse;
+function parse(str) {
+ var ua = parseUA(str),
+ os = parseOS(str),
+ device = parseDevice(str);
+ return new Results(str, ua, os, device);
+}
+
+if (require.main === module) {
+ var output, input = process.argv[2];
+ if (!input) { process.exit(1); }
+ process.stdout.write(parseUA(input).toString());
+}