tesseract.js
Version:
Pure Javascript Multilingual OCR
16 lines (12 loc) • 413 B
JavaScript
const isBrowser = require('./getEnvironment')('type') === 'browser';
const resolveURL = isBrowser ? s => (new URL(s, window.location.href)).href : s => s; // eslint-disable-line
module.exports = (options) => {
const opts = { ...options };
['corePath', 'workerPath', 'langPath'].forEach((key) => {
if (options[key]) {
opts[key] = resolveURL(opts[key]);
}
});
return opts;
};
;