B2G/gecko/dom/mobilemessage/src/ril/MmsPduHelper.jsm
/**
   * @param data
   *        A wrapped object to store encoded raw data.
   *
   * @return An object of two string-typed attributes: address and type.
   */
@param data
A wrapped object to store encoded raw data.

@return An object of two string-typed attributes: address and type.
@param data A wrapped object to store encoded raw data . @return An object of two string - typed attributes : address and type .
function decode(data) {
    let str = EncodedStringValue.decode(data);
    let result;
    if (((result = str.match(this.REGEXP_DECODE_PLMN)) != null)
        || ((result = str.match(this.REGEXP_DECODE_IPV4)) != null)
        || ((result = str.match(this.REGEXP_DECODE_IPV6)) != null)
        || ((result = str.match(this.REGEXP_DECODE_CUSTOM)) != null)) {
      return {address: result[1], type: result[2]};
    }
    let type;
    if (str.match(this.REGEXP_NUM)) {
      type = "num";
    } else if (str.match(this.REGEXP_ALPHANUM)) {
      type = "alphanum";
    } else if (str.indexOf("@") > 0) {
      type = "email";
    } else {
      throw new WSP.CodeError("Address: invalid address");
    }
    return {address: str, type: type};
  }
function decode ( data ) { let str = EncodedStringValue . decode ( data ) ; let result ; if ( ( ( result = str . match ( this . REGEXP_DECODE_PLMN ) ) != null ) || ( ( result = str . match ( this . REGEXP_DECODE_IPV4 ) ) != null ) || ( ( result = str . match ( this . REGEXP_DECODE_IPV6 ) ) != null ) || ( ( result = str . match ( this . REGEXP_DECODE_CUSTOM ) ) != null ) ) { return { address : result [ 1 ] , type : result [ 2 ] } ; } let type ; if ( str . match ( this . REGEXP_NUM ) ) { type = "num" ; } else if ( str . match ( this . REGEXP_ALPHANUM ) ) { type = "alphanum" ; } else if ( str . indexOf ( "@" ) > 0 ) { type = "email" ; } else { throw new WSP . CodeError ( "Address: invalid address" ) ; } return { address : str , type : type } ; }
@param data
        A wrapped object to store encoded raw data.
@param data A wrapped object to store encoded raw data .
// E-mail should match the definition of `mailbox` as described in section // 3.4 of RFC2822, but excluding the obsolete definitions as indicated by // the "obs-" prefix. Here we match only a `@` character.