wpa_cli.js
function parse_scan_results(block) {
    var match;
    var results = [];
    var lines;
    
    lines = block.split('\n').map(function(item) { return item + "\n"; });
    lines.forEach(function(entry){
        var parsed = {};
        if ((match = entry.match(/([A-Fa-f0-9:]{17})\t/))) {
            parsed.bssid = match[1].toLowerCase();
        }

        if ((match = entry.match(/\t([\d]+)\t+/))) {
            parsed.frequency = parseInt(match[1], 10);
        }

        if ((match = entry.match(/([-][0-9]+)\t/))) {
            parsed.signalLevel = parseInt(match[1], 10);
        }

        if ((match = entry.match(/\t(\[.+\])\t/))) {
            parsed.flags = match[1];
        }

        if ((match = entry.match(/\t([^\t]{1,32}(?=\n))/))) {
            parsed.ssid = match[1];
        }

        if(!(Object.keys(parsed).length === 0 && parsed.constructor === Object)){
            results.push(parsed);
        }
    });

    return results;
}
function parse_scan_results(block) {
    var match;
    var results = [];
    var lines;
    
    lines = block.split('\n').map(function(item) { return item + "\n"; });
    lines.forEach(function(entry){
        var parsed = {};
        if ((match = entry.match(/([A-Fa-f0-9:]{17})\t/))) {
            parsed.bssid = match[1].toLowerCase();
        }

        if ((match = entry.match(/\t([\d]+)\t+/))) {
            parsed.frequency = parseInt(match[1], 10);
        }

        if ((match = entry.match(/([-][0-9]+)\t/))) {
            parsed.signalLevel = parseInt(match[1], 10);
        }

        if ((match = entry.match(/\t(\[.+\])\t/))) {
            parsed.flags = match[1];
        }

        if ((match = entry.match(/\t([^\t]{1,32}(?=\n))/))) {
            parsed.ssid = match[1];
        }

        if(!(Object.keys(parsed).length === 0 && parsed.constructor === Object)){
            results.push(parsed);
        }
    });

    return results;
}
function parse_scan_results ( block ) { var match ; var results = [ ] ; var lines ; lines = block . split ( '\n' ) . map ( function ( item ) { return item + "\n" ; } ) ; lines . forEach ( function ( entry ) { var parsed = { } ; if ( ( match = entry . match ( / ([A-Fa-f0-9:]{17})\t / ) ) ) { parsed . bssid = match [ 1 ] . toLowerCase ( ) ; } if ( ( match = entry . match ( / \t([\d]+)\t+ / ) ) ) { parsed . frequency = parseInt ( match [ 1 ] , 10 ) ; } if ( ( match = entry . match ( / ([-][0-9]+)\t / ) ) ) { parsed . signalLevel = parseInt ( match [ 1 ] , 10 ) ; } if ( ( match = entry . match ( / \t(\[.+\])\t / ) ) ) { parsed . flags = match [ 1 ] ; } if ( ( match = entry . match ( / \t([^\t]{1,32}(?=\n)) / ) ) ) { parsed . ssid = match [ 1 ] ; } if ( ! ( Object . keys ( parsed ) . length === 0 && parsed . constructor === Object ) ) { results . push ( parsed ) ; } } ) ; return results ; }
Parses the results of a scan_result request.

@private
@static
@category wpa_cli
@param {string} block The section of stdout for the interface.
@returns {object} The parsed scan results.
Parses the results of a scan_result request .