UNPKG

tesseract.js

Version:
13 lines (11 loc) 398 B
const isBrowser = require('./getEnvironment')('type') === 'browser'; const resolveURL = isBrowser ? require('resolve-url') : s => s; // eslint-disable-line module.exports = (options) => { const opts = { ...options }; ['corePath', 'workerPath', 'langPath'].forEach((key) => { if (typeof options[key] !== 'undefined') { opts[key] = resolveURL(opts[key]); } }); return opts; };