Pure Javascript OCR for more than 100 Languages 📖🎉🖥
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
const isElectron = require('is-electron');
|
|
|
|
|
|
|
|
module.exports = (key) => {
|
|
|
|
const env = {};
|
|
|
|
|
|
|
|
if (isElectron()) {
|
|
|
|
env.type = 'electron';
|
|
|
|
} else if (typeof window === 'object') {
|
|
|
|
env.type = 'browser';
|
|
|
|
} else if (typeof importScripts === 'function') {
|
|
|
|
env.type = 'webworker';
|
|
|
|
} else if (typeof process === 'object' && typeof require === 'function') {
|
|
|
|
env.type = 'node';
|
|
|
|
}
|
|
|
|
|
|
|
|
if (typeof key === 'undefined') {
|
|
|
|
return env;
|
|
|
|
}
|
|
|
|
|
|
|
|
return env[key];
|
|
|
|
};
|