UNPKG

country-linkify

Version:

Simple service to redirect links based on the client's country.

14 lines (13 loc) 455 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getSearchQuery = void 0; const getSearchQuery = (id, source) => { if (source == "aliexpress") { return id.replace(/[^a-zA-Z ]/g, "").replace(/ /g, "-"); } if (source == "decathlon" || source == "ribble") { return encodeURIComponent(encodeURIComponent(id)); } return encodeURIComponent(id); }; exports.getSearchQuery = getSearchQuery;