Quantcast
Channel: hyperstruct » JavaScript
Viewing all articles
Browse latest Browse all 10

You know you’ve been courting functional programming too long…

$
0
0

…when even your JavaScript code starts looking like this:


function applyTextProcessors(xmlFragment, textProcessors) {
    return textProcessors.length == 0 ?
        xmlFragment :
        applyTextProcessors(
            xml.mapTextNodes(
                xmlFragment, function(textNode) {
                    return text.mapMatch(textNode.toString(),
                                         textProcessors[0].regexp,
                                         textProcessors[0].action);
                }),
            textProcessors.slice(1));
}


Viewing all articles
Browse latest Browse all 10

Trending Articles