infinity-forge
Version:
28 lines • 1.33 kB
JavaScript
;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = hasGrantedAllScopesGoogle;
/**
* Checks if the user granted all the specified scope or scopes
* @returns True if all the scopes are granted
*/
function hasGrantedAllScopesGoogle(tokenResponse, firstScope) {
var _a, _b, _c;
var restScopes = [];
for (var _i = 2; _i < arguments.length; _i++) {
restScopes[_i - 2] = arguments[_i];
}
if (!(window === null || window === void 0 ? void 0 : window.google))
return false;
return (((_c = (_b = (_a = window === null || window === void 0 ? void 0 : window.google) === null || _a === void 0 ? void 0 : _a.accounts) === null || _b === void 0 ? void 0 : _b.oauth2) === null || _c === void 0 ? void 0 : _c.hasGrantedAllScopes.apply(_c, __spreadArray([tokenResponse,
firstScope], restScopes, false))) || false);
}
//# sourceMappingURL=hasGrantedAllScopesGoogle.js.map