winston0410/camouflage

View on GitHub
benchmarks/handleComma/regexReplace.ts

Summary

Maintainability
A
0 mins
Test Coverage
const handleCommaByRegexReplace = (parentSelector: string, childSelectors: string): string => {
    if (!childSelectors.includes(',')) {
        return childSelectors
    }
    return childSelectors.replace(/(^\B|^\b|,)/gi, `$1${parentSelector} `)
}

module.exports = handleCommaByRegexReplace