oauth/scopes.js
function coerce(scopes) {
  if (scopes instanceof ScopeSet) {
    return scopes;
  }
  // If we receive a string, assume it's a single scope.
  // We deliberately do not attempt to split the string on whitespace here,
  // because we want to force callers to explicitly choose between
  // exports.fromString() or exports.fromURLEncodedString depending on
  // what encoding they expect to have received the string in.
  if (typeof scopes === 'string') {
    return new ScopeSet([scopes]);
  }
  return new ScopeSet(scopes);
}
function coerce(scopes) {
  if (scopes instanceof ScopeSet) {
    return scopes;
  }
  // If we receive a string, assume it's a single scope.
  // We deliberately do not attempt to split the string on whitespace here,
  // because we want to force callers to explicitly choose between
  // exports.fromString() or exports.fromURLEncodedString depending on
  // what encoding they expect to have received the string in.
  if (typeof scopes === 'string') {
    return new ScopeSet([scopes]);
  }
  return new ScopeSet(scopes);
}
function coerce ( scopes ) { if ( scopes instanceof ScopeSet ) { return scopes ; } // If we receive a string, assume it's a single scope. // We deliberately do not attempt to split the string on whitespace here, // because we want to force callers to explicitly choose between // exports.fromString() or exports.fromURLEncodedString depending on // what encoding they expect to have received the string in. if ( typeof scopes === 'string' ) { return new ScopeSet ( [ scopes ] ) ; } return new ScopeSet ( scopes ) ; }
A little helper function for coercing different
kinds of input data into a `ScopeSet` instance.
A little helper function for coercing different kinds of input data into a ScopeSet instance .