Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 204x 412x 412x 428x 428x 16x 16x 412x 204x 25212x 25212x 25004x 208x | /** Splits a list of strings by commas within the strings */
const splitComma = (strings: string[]): string[] => {
Iif (!strings) {
return null;
}
for (let i = 0; i < strings.length; i++) {
const comma = strings[i].indexOf(',');
if (comma !== -1) {
const splits = strings[i].split(/,/);
strings.splice(i, 1, ...splits);
}
}
return strings;
};
/**
* Returns an array of the comma split parameters from the given URL search params
* @param lowerCaseKey - lower case search parameter value
* @param params - URLSearchParams
* @returns Array of comma split items matching, or null
*/
const getSplitParam = (
lowerCaseKey: string,
params = new URLSearchParams(window.location.search)
): string[] => {
const sourceKey = [...params.keys()].find(it => it.toLowerCase() === lowerCaseKey);
if (!sourceKey) {
return;
}
return splitComma(params.getAll(sourceKey));
};
export { splitComma, getSplitParam };
|