B2G/gecko/dom/mobilemessage/src/ril/WspPduHelper.jsm
/**
   * @param data
   *        A wrapped object containing raw PDU data.
   *
   * @return A decoded object containing `name` and `value` properties or null
   *         in case of a failed parsing. The `name` property must be a string,
   *         but the `value` property can be many different types depending on
   *         `name`.
   */
@param data
A wrapped object containing raw PDU data.

@return A decoded object containing `name` and `value` properties or null
in case of a failed parsing.
@param data A wrapped object containing raw PDU data . @return A decoded object containing ` name ` and ` value ` properties or null in case of a failed parsing .
function decode(data) {
    let name = TokenText.decode(data);
    let begin = data.offset, value;
    try {
      value = TextString.decode(data);
    } catch (e) {
      data.offset = begin;
      value = skipValue(data);
      debug("Skip malformed application header: "
            + JSON.stringify({name: name, value: value}));
      return null;
    }
    return {
      name: name.toLowerCase(),
      value: value,
    };
  }
function decode ( data ) { let name = TokenText . decode ( data ) ; let begin = data . offset , value ; try { value = TextString . decode ( data ) ; } catch ( e ) { data . offset = begin ; value = skipValue ( data ) ; debug ( "Skip malformed application header: " + JSON . stringify ( { name : name , value : value } ) ) ; return null ; } return { name : name . toLowerCase ( ) , value : value , } ; }
@param data
        A wrapped object containing raw PDU data.
@param data A wrapped object containing raw PDU data .