src/singpostTracker.js
function createSingpostEntity(id, html) {
    let $ = parser.load(html)

    let date = []
    $('span.tacking-date').each(function (i, elem) {
        date.push($(this).text().trim())
    })

    let status = []
    $('div.tacking-status').each(function (i, elem) {
        status.push($(this).text().trim())
    })

    let messages = []
    for(let i = 0; i < date.length; i++) {
        messages.push({
            date: moment.tz(date[i], "DD-MM-YYYY", zone).format(),
            state: status[i].replace(/ \(Country.+\)/ig, "").trim() // remove '(Country: PT)'
        })
    }

    return new SingpostInfo(id, messages)
}
function createSingpostEntity(id, html) {
    let $ = parser.load(html)

    let date = []
    $('span.tacking-date').each(function (i, elem) {
        date.push($(this).text().trim())
    })

    let status = []
    $('div.tacking-status').each(function (i, elem) {
        status.push($(this).text().trim())
    })

    let messages = []
    for(let i = 0; i < date.length; i++) {
        messages.push({
            date: moment.tz(date[i], "DD-MM-YYYY", zone).format(),
            state: status[i].replace(/ \(Country.+\)/ig, "").trim() // remove '(Country: PT)'
        })
    }

    return new SingpostInfo(id, messages)
}
function createSingpostEntity ( id , html ) { let $ = parser . load ( html ) let date = [ ] $ ( 'span.tacking-date' ) . each ( function ( i , elem ) { date . push ( $ ( this ) . text ( ) . trim ( ) ) } ) let status = [ ] $ ( 'div.tacking-status' ) . each ( function ( i , elem ) { status . push ( $ ( this ) . text ( ) . trim ( ) ) } ) let messages = [ ] for ( let i = 0 ; i < date . length ; i ++ ) { messages . push ( { date : moment . tz ( date [ i ] , "DD-MM-YYYY" , zone ) . format ( ) , state : status [ i ] . replace ( /  \(Country.+\) / ig , "" ) . trim ( ) // remove '(Country: PT)' } ) } return new SingpostInfo ( id , messages ) }
Create singpost entity from html
@param id
@param html
Create singpost entity from html