build/tincan.js
function TextDecoder(label, options) {
    // Web IDL conventions
    if (!(this instanceof TextDecoder))
      throw TypeError('Called as a function. Did you forget \'new\'?');
    label = label !== undefined ? String(label) : DEFAULT_ENCODING;
    options = ToDictionary(options);

    // A TextDecoder object has an associated encoding, decoder,
    // stream, ignore BOM flag (initially unset), BOM seen flag
    // (initially unset), error mode (initially replacement), and do
    // not flush flag (initially unset).

    /** @private */
    this._encoding = null;
    /** @private @type {?Decoder} */
    this._decoder = null;
    /** @private @type {boolean} */
    this._ignoreBOM = false;
    /** @private @type {boolean} */
    this._BOMseen = false;
    /** @private @type {string} */
    this._error_mode = 'replacement';
    /** @private @type {boolean} */
    this._do_not_flush = false;


    // 1. Let encoding be the result of getting an encoding from
    // label.
    var encoding = getEncoding(label);

    // 2. If encoding is failure or replacement, throw a RangeError.
    if (encoding === null || encoding.name === 'replacement')
      throw RangeError('Unknown encoding: ' + label);
    if (!decoders[encoding.name]) {
      throw Error('Decoder not present.' +
                  ' Did you forget to include encoding-indexes.js?');
    }

    // 3. Let dec be a new TextDecoder object.
    var dec = this;

    // 4. Set dec's encoding to encoding.
    dec._encoding = encoding;

    // 5. If options's fatal member is true, set dec's error mode to
    // fatal.
    if (Boolean(options['fatal']))
      dec._error_mode = 'fatal';

    // 6. If options's ignoreBOM member is true, set dec's ignore BOM
    // flag.
    if (Boolean(options['ignoreBOM']))
      dec._ignoreBOM = true;

    // For pre-ES5 runtimes:
    if (!Object.defineProperty) {
      this.encoding = dec._encoding.name.toLowerCase();
      this.fatal = dec._error_mode === 'fatal';
      this.ignoreBOM = dec._ignoreBOM;
    }

    // 7. Return dec.
    return dec;
  }
function TextDecoder(label, options) {
    // Web IDL conventions
    if (!(this instanceof TextDecoder))
      throw TypeError('Called as a function. Did you forget \'new\'?');
    label = label !== undefined ? String(label) : DEFAULT_ENCODING;
    options = ToDictionary(options);

    // A TextDecoder object has an associated encoding, decoder,
    // stream, ignore BOM flag (initially unset), BOM seen flag
    // (initially unset), error mode (initially replacement), and do
    // not flush flag (initially unset).

    /** @private */
    this._encoding = null;
    /** @private @type {?Decoder} */
    this._decoder = null;
    /** @private @type {boolean} */
    this._ignoreBOM = false;
    /** @private @type {boolean} */
    this._BOMseen = false;
    /** @private @type {string} */
    this._error_mode = 'replacement';
    /** @private @type {boolean} */
    this._do_not_flush = false;


    // 1. Let encoding be the result of getting an encoding from
    // label.
    var encoding = getEncoding(label);

    // 2. If encoding is failure or replacement, throw a RangeError.
    if (encoding === null || encoding.name === 'replacement')
      throw RangeError('Unknown encoding: ' + label);
    if (!decoders[encoding.name]) {
      throw Error('Decoder not present.' +
                  ' Did you forget to include encoding-indexes.js?');
    }

    // 3. Let dec be a new TextDecoder object.
    var dec = this;

    // 4. Set dec's encoding to encoding.
    dec._encoding = encoding;

    // 5. If options's fatal member is true, set dec's error mode to
    // fatal.
    if (Boolean(options['fatal']))
      dec._error_mode = 'fatal';

    // 6. If options's ignoreBOM member is true, set dec's ignore BOM
    // flag.
    if (Boolean(options['ignoreBOM']))
      dec._ignoreBOM = true;

    // For pre-ES5 runtimes:
    if (!Object.defineProperty) {
      this.encoding = dec._encoding.name.toLowerCase();
      this.fatal = dec._error_mode === 'fatal';
      this.ignoreBOM = dec._ignoreBOM;
    }

    // 7. Return dec.
    return dec;
  }
function TextDecoder ( label , options ) { // Web IDL conventions if ( ! ( this instanceof TextDecoder ) ) throw TypeError ( 'Called as a function. Did you forget \'new\'?' ) ; label = label !== undefined ? String ( label ) : DEFAULT_ENCODING ; options = ToDictionary ( options ) ; // A TextDecoder object has an associated encoding, decoder, // stream, ignore BOM flag (initially unset), BOM seen flag // (initially unset), error mode (initially replacement), and do // not flush flag (initially unset). /** @private */ this . _encoding = null ; /** @private @type {?Decoder} */ this . _decoder = null ; /** @private @type {boolean} */ this . _ignoreBOM = false ; /** @private @type {boolean} */ this . _BOMseen = false ; /** @private @type {string} */ this . _error_mode = 'replacement' ; /** @private @type {boolean} */ this . _do_not_flush = false ; // 1. Let encoding be the result of getting an encoding from // label. var encoding = getEncoding ( label ) ; // 2. If encoding is failure or replacement, throw a RangeError. if ( encoding === null || encoding . name === 'replacement' ) throw RangeError ( 'Unknown encoding: ' + label ) ; if ( ! decoders [ encoding . name ] ) { throw Error ( 'Decoder not present.' + ' Did you forget to include encoding-indexes.js?' ) ; } // 3. Let dec be a new TextDecoder object. var dec = this ; // 4. Set dec's encoding to encoding. dec . _encoding = encoding ; // 5. If options's fatal member is true, set dec's error mode to // fatal. if ( Boolean ( options [ 'fatal' ] ) ) dec . _error_mode = 'fatal' ; // 6. If options's ignoreBOM member is true, set dec's ignore BOM // flag. if ( Boolean ( options [ 'ignoreBOM' ] ) ) dec . _ignoreBOM = true ; // For pre-ES5 runtimes: if ( ! Object . defineProperty ) { this . encoding = dec . _encoding . name . toLowerCase ( ) ; this . fatal = dec . _error_mode === 'fatal' ; this . ignoreBOM = dec . _ignoreBOM ; } // 7. Return dec. return dec ; }
8.1 Interface TextDecoder 
@constructor
@param {string=} label The label of the encoding;
defaults to 'utf-8'.
@param {Object=} options
8 . 1 Interface TextDecoder