lib/utils.js
function extractLiteralFromInstalled(stats, element) {
    if (element.length === 0) return stats;
    let value = "";
    if (validLiteral(element[0])) {
        value = element[0].value;
        // let array = value.split('$');
        // if (array.length == 0) {
        //     stats.setPackageName(value);
        // } else {
        //     stats.setPackageName(array[0]);
        //     stats.setPackageVersion(array[1]);
        // }
        stats.setPackageName(value);
    }
    if (validLiteral(element[1])) {
        value = element[1].value;
        stats.setFileName(value);
    }
    if (validLiteral(element[2])) {
        value = element[2].value;
        stats.setVersion(value);
    }
    return stats;
}
function extractLiteralFromInstalled(stats, element) {
    if (element.length === 0) return stats;
    let value = "";
    if (validLiteral(element[0])) {
        value = element[0].value;
        // let array = value.split('$');
        // if (array.length == 0) {
        //     stats.setPackageName(value);
        // } else {
        //     stats.setPackageName(array[0]);
        //     stats.setPackageVersion(array[1]);
        // }
        stats.setPackageName(value);
    }
    if (validLiteral(element[1])) {
        value = element[1].value;
        stats.setFileName(value);
    }
    if (validLiteral(element[2])) {
        value = element[2].value;
        stats.setVersion(value);
    }
    return stats;
}
function extractLiteralFromInstalled ( stats , element ) { if ( element . length === 0 ) return stats ; let value = "" ; if ( validLiteral ( element [ 0 ] ) ) { value = element [ 0 ] . value ; // let array = value.split('$'); // if (array.length == 0) { //     stats.setPackageName(value); // } else { //     stats.setPackageName(array[0]); //     stats.setPackageVersion(array[1]); // } stats . setPackageName ( value ) ; } if ( validLiteral ( element [ 1 ] ) ) { value = element [ 1 ] . value ; stats . setFileName ( value ) ; } if ( validLiteral ( element [ 2 ] ) ) { value = element [ 2 ] . value ; stats . setVersion ( value ) ; } return stats ; }
Extract packageName, version and fileName from given literal if type = "installed".
Extract packageName version and fileName from given literal if type = installed .