Export DEVICE_TYPE
yahyaKacem opened this issue · 2 comments
yahyaKacem commented
It would be greate to have the DEVICE_TYPE exported to be used it in mongoose schemas and other types, interfaces.
sanchezzzhak commented
you can get types from files
const DEVICE_TYPE = require('node-device-detector/parser/const/device-type');
const CLIENT_TYPE = require('node-device-detector/parser/const/client-type');
to get such a result, you need a'little magic
const {DEVICE_TYPE, CLIENT_TYPE, DeviceDetecor} = require('device-detector');
create file lib/device-detector.js
const DeviceDetector = require('node-device-detector');
const DEVICE_TYPE = require('node-device-detector/parser/const/device-type');
const CLIENT_TYPE = require('node-device-detector/parser/const/client-type');
module.export = {
DeviceDetector, DEVICE_TYPE, CLIENT_TYPE
};
register local package to dependencies
{
"name": "test-project",
"private": true,
"version": "0.0.0",
"scripts": {
},
"devDependencies": {
},
"dependencies": {
"node-device-detector": "*",
"device-detector": "lib/device-detector.js"
}
}
npm update
if you have other suggestions without breaking the export of the current design, show an example.
yahyaKacem commented
OK, thanks, I had to rewrite it anyways to add an undefined option, when data were not saved in db.