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

    let td11 = $('.one-parcel .td11').contents()
    let orderNumber = td11[1].data
    let product = td11[3].data

    let td22 = $('.one-parcel .td22').contents()
    let trackingNumber = td22[1].data
    let country = utils.removeChineseChars(td22[3].data).trim()

    let td33 = $('.one-parcel .td33').contents()
    let dates = []

    for(let i = 1; i < td33.length; ++i) {
        let date = td33[i].children[1].data
        dates.push(moment.tz(date, "YYYY-MM-DD HH:mm:ss", zone).format())
    }

    let td44 = $('.one-parcel .td44').contents()
    let states = []

    for(let i = 0; i < td44.length; ++i) {
        let s = td44[i].children[0].data
        states.push(s.replace('，', ', ').replace('En tr?nsito', 'En transito'))
    }

    let finalStates = []

    for(let i = 0; i < dates.length; ++i) {
        finalStates.push({
            state: states[i],
            date: dates[i]
        })
    }

    return new PanasiaInfo({
        orderNumber: orderNumber,
        product: product,
        id: id,
        country: country,
        states: finalStates.sort((a, b) => {
            let dateA = moment(a.date),
                dateB = moment(b.date)

            return dateA < dateB
        })
    })
}
function createPanasiaEntity(html, id) {
    let $ = parser.load(html)

    let td11 = $('.one-parcel .td11').contents()
    let orderNumber = td11[1].data
    let product = td11[3].data

    let td22 = $('.one-parcel .td22').contents()
    let trackingNumber = td22[1].data
    let country = utils.removeChineseChars(td22[3].data).trim()

    let td33 = $('.one-parcel .td33').contents()
    let dates = []

    for(let i = 1; i < td33.length; ++i) {
        let date = td33[i].children[1].data
        dates.push(moment.tz(date, "YYYY-MM-DD HH:mm:ss", zone).format())
    }

    let td44 = $('.one-parcel .td44').contents()
    let states = []

    for(let i = 0; i < td44.length; ++i) {
        let s = td44[i].children[0].data
        states.push(s.replace('，', ', ').replace('En tr?nsito', 'En transito'))
    }

    let finalStates = []

    for(let i = 0; i < dates.length; ++i) {
        finalStates.push({
            state: states[i],
            date: dates[i]
        })
    }

    return new PanasiaInfo({
        orderNumber: orderNumber,
        product: product,
        id: id,
        country: country,
        states: finalStates.sort((a, b) => {
            let dateA = moment(a.date),
                dateB = moment(b.date)

            return dateA < dateB
        })
    })
}
function createPanasiaEntity ( html , id ) { let $ = parser . load ( html ) let td11 = $ ( '.one-parcel .td11' ) . contents ( ) let orderNumber = td11 [ 1 ] . data let product = td11 [ 3 ] . data let td22 = $ ( '.one-parcel .td22' ) . contents ( ) let trackingNumber = td22 [ 1 ] . data let country = utils . removeChineseChars ( td22 [ 3 ] . data ) . trim ( ) let td33 = $ ( '.one-parcel .td33' ) . contents ( ) let dates = [ ] for ( let i = 1 ; i < td33 . length ; ++ i ) { let date = td33 [ i ] . children [ 1 ] . data dates . push ( moment . tz ( date , "YYYY-MM-DD HH:mm:ss" , zone ) . format ( ) ) } let td44 = $ ( '.one-parcel .td44' ) . contents ( ) let states = [ ] for ( let i = 0 ; i < td44 . length ; ++ i ) { let s = td44 [ i ] . children [ 0 ] . data states . push ( s . replace ( '，',  '  '). r e place(' E n tr?nsito',  ' n transito')) } let finalStates = [ ] for ( let i = 0 ; i < dates . length ; ++ i ) { finalStates . push ( { state : states [ i ] , date : dates [ i ] } ) } return new PanasiaInfo ( { orderNumber : orderNumber , product : product , id : id , country : country , states : finalStates . sort ( ( a , b ) => { let dateA = moment ( a . date ) , dateB = moment ( b . date ) return dateA < dateB } ) } ) }
Create panasia entity from html
@param html
@param id
Create panasia entity from html