code: function setOptions(options) {
    var self = this
    var current = self.options
    var ruleRepetition
    var key
  
    if (options == null) {
      options = {}
    } else if (typeof options === 'object') {
      options = xtend(options)
    } else {
      throw new Error('Invalid value `' + options + '` for setting `options`')
    }
  
    for (key in defaults) {
      validate[typeof defaults[key]](options, key, current[key], maps[key])
    }
  
    ruleRepetition = options.ruleRepetition
  
    if (ruleRepetition && ruleRepetition < 3) {
      raise(ruleRepetition, 'options.ruleRepetition')
    }
  
    self.encode = encodeFactory(String(options.entities))
    self.escape = escapeFactory(options)
  
    self.options = options
  
    return self
  }
docs: Set options.  Does not overwrite previously set options.