deepl-client
Version:
A client to interact with the DeepL API.
17 lines (16 loc) • 623 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDomain = void 0;
/**
* Returns the right domain corresponding to the user's key type.
* @property params used to check if you have a valid authentication key.
* @returns the free or paid host url.
*/
function getDomain(params) {
if (params.auth_key && params.auth_key.length < 36)
throw new Error("Invalid API key \"" + params.auth_key + "\".");
return params.auth_key && params.auth_key.match(/:fx/g)
? 'https://api-free.deepl.com/v2'
: 'https://api.deepl.com/v2';
}
exports.getDomain = getDomain;