UNPKG

tesseract.js

Version:
16 lines (12 loc) 413 B
'use strict'; 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; };