index.js
function addScope (scope) {
  if (!scope) {
    return
  }
  var oldScope = new Set(this.scope.split(' '))
  var newScope
  // Convert the incoming new scopes to a Set
  if (typeof scope === 'string') {
    newScope = new Set(scope.split(' '))
  } else if (Array.isArray(scope)) {
    newScope = new Set(scope)
  } else {
    throw new RangeError('Trying to add an invalid scope object')
  }
  oldScope.forEach(function (item) {
    newScope.add(item)
  })
  // Convert back to string
  this.scope = Array.from(newScope).join(' ')
}
function addScope (scope) {
  if (!scope) {
    return
  }
  var oldScope = new Set(this.scope.split(' '))
  var newScope
  // Convert the incoming new scopes to a Set
  if (typeof scope === 'string') {
    newScope = new Set(scope.split(' '))
  } else if (Array.isArray(scope)) {
    newScope = new Set(scope)
  } else {
    throw new RangeError('Trying to add an invalid scope object')
  }
  oldScope.forEach(function (item) {
    newScope.add(item)
  })
  // Convert back to string
  this.scope = Array.from(newScope).join(' ')
}
function addScope ( scope ) { if ( ! scope ) { return } var oldScope = new Set ( this . scope . split ( ' ' ) ) var newScope // Convert the incoming new scopes to a Set if ( typeof scope === 'string' ) { newScope = new Set ( scope . split ( ' ' ) ) } else if ( Array . isArray ( scope ) ) { newScope = new Set ( scope ) } else { throw new RangeError ( 'Trying to add an invalid scope object' ) } oldScope . forEach ( function ( item ) { newScope . add ( item ) } ) // Convert back to string this . scope = Array . from ( newScope ) . join ( ' ' ) }
Adds the passed in list of scopes to the current one via a Set union
operation.
@param scope {Array|String} Either an array or a space-separated
string list of scopes.
@method addScope
Adds the passed in list of scopes to the current one via a Set union operation .