UNPKG

ikea-availability-checker

Version:

ikea product in-store availability checker and product search

24 lines (23 loc) 837 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.unique = exports.normalizeCountryCode = exports.normalizeProductId = exports.normalizeBuCode = void 0; const normalizeBuCode = function (buCode) { return String(buCode || "") .replace(/[^0-9]+/g, "") .trim(); }; exports.normalizeBuCode = normalizeBuCode; const normalizeProductId = function (productId) { return String(productId || "") .replace(/[^0-9]+/g, "") .trim(); }; exports.normalizeProductId = normalizeProductId; const normalizeCountryCode = function (countryCode) { return String(countryCode).trim().substring(0, 2).toLowerCase(); }; exports.normalizeCountryCode = normalizeCountryCode; const unique = function (cur, i, arr) { return arr.indexOf(cur, i + 1) === -1; }; exports.unique = unique;