All files / owid-grapher/clientUtils string.ts

56.25% Statements 9/16
100% Branches 0/0
0% Functions 0/3
56.25% Lines 9/16

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 171x 1x 1x 1x   1x 1x 1x 1x 1x              
const URL_REGEX =
    /[-a-zA-Z0-9@:%_\+.~#?&//=]{2,256}\.[a-z]{2,4}\b(\/[-a-zA-Z0-9@:%_\+.~#?&//=]*)?/gi
 
export const findUrlsInText = (str: string): string[] =>
    str.match(URL_REGEX) || []
 
const snakeToCamel = (str: string): string =>
    str.replace(/(\_\w)/g, (char) => char[1].toUpperCase())
 
export const camelCaseProperties = (obj: any): any => {
    const newObj: any = {}
    for (const key in obj) {
        newObj[snakeToCamel(key)] = obj[key]
    }
    return newObj
}