lib/transform.js
function(line, index, lines) {
        var newLine;
        if (insideString('|>', line)) return line;
        // line does not have a one liner pipeline
        if (!line.match(/(\=|return)(.*?)(\|\>)/)) return line;
        // if next line has a pipe operator
        if (lines[index] && lines[index + 1].match(/^\s*\|\>/)) return line;

        // http://rubular.com/r/wiBJtf12Vn
        // (^.+?)     $1 value to pipe
        // \s*        optional spaces
        // (\|\>)     $2 |> pipe operator
        // (.*?)$     $3 tail minus first pipe ($2)
        //
        var parts = line.match(/(^.+?)\s*(\|\>)(.*?)$/);
        var head = parts[1]
        var tail = parts[2].concat(parts[3]);

        // process head depending on if it's immuttable or not
        if (head.match('Immutable')) {
            head = head.replace('Immutable', '_.chain(Immutable');
        }
        else if (head.match(/^\s*return/)) {
            head = head.replace('return ', 'return _.chain(');
        }
        else if (head.match(/\s=\s/)) {
            head = head.replace('= ', '= _.chain(');
        }

        tail = tail.replace(/(\s*\|\>\s*)/g, function($0, $1) {
            return ').pipesCall(';
        })

        return head + tail + ').value();'
    }
function(line, index, lines) {
        var newLine;
        if (insideString('|>', line)) return line;
        // line does not have a one liner pipeline
        if (!line.match(/(\=|return)(.*?)(\|\>)/)) return line;
        // if next line has a pipe operator
        if (lines[index] && lines[index + 1].match(/^\s*\|\>/)) return line;

        // http://rubular.com/r/wiBJtf12Vn
        // (^.+?)     $1 value to pipe
        // \s*        optional spaces
        // (\|\>)     $2 |> pipe operator
        // (.*?)$     $3 tail minus first pipe ($2)
        //
        var parts = line.match(/(^.+?)\s*(\|\>)(.*?)$/);
        var head = parts[1]
        var tail = parts[2].concat(parts[3]);

        // process head depending on if it's immuttable or not
        if (head.match('Immutable')) {
            head = head.replace('Immutable', '_.chain(Immutable');
        }
        else if (head.match(/^\s*return/)) {
            head = head.replace('return ', 'return _.chain(');
        }
        else if (head.match(/\s=\s/)) {
            head = head.replace('= ', '= _.chain(');
        }

        tail = tail.replace(/(\s*\|\>\s*)/g, function($0, $1) {
            return ').pipesCall(';
        })

        return head + tail + ').value();'
    }
function ( line , index , lines ) { var newLine ; if ( insideString ( '|>' , line ) ) return line ; // line does not have a one liner pipeline if ( ! line . match ( / (\=|return)(.*?)(\|\>) / ) ) return line ; // if next line has a pipe operator if ( lines [ index ] && lines [ index + 1 ] . match ( / ^\s*\|\> / ) ) return line ; // http://rubular.com/r/wiBJtf12Vn // (^.+?)     $1 value to pipe // \s*        optional spaces // (\|\>)     $2 |> pipe operator // (.*?)$     $3 tail minus first pipe ($2) // var parts = line . match ( / (^.+?)\s*(\|\>)(.*?)$ / ) ; var head = parts [ 1 ] var tail = parts [ 2 ] . concat ( parts [ 3 ] ) ; // process head depending on if it's immuttable or not if ( head . match ( 'Immutable' ) ) { head = head . replace ( 'Immutable' , '_.chain(Immutable' ) ; } else if ( head . match ( / ^\s*return / ) ) { head = head . replace ( 'return ' , 'return _.chain(' ) ; } else if ( head . match ( / \s=\s / ) ) { head = head . replace ( '= ' , '= _.chain(' ) ; } tail = tail . replace ( / (\s*\|\>\s*) / g , function ( $0 , $1 ) { return ').pipesCall(' ; } ) return head + tail + ').value();' }
One liner piping returns String a -> String b
One liner piping returns String a - > String b