UNPKG

wasteful-scope

Version:

OAuth2 scope utilities for the wasteful scope parsing, comparing, merging, etc

33 lines (25 loc) 873 B
'use strict'; module.exports.create = function (groups, vocab) { throw new Error('not implemented'); var wordify = require('../wordify').create(vocab).wordify , scopeutils = require('../index').create(groups) , meta = scopeutils.parse(['stake.leadership:name,photo:phone:texting']) , obj = { scope: meta.scopes } , msgs ; console.log(meta); if (obj.invalids) { throw new Error("Could not parse the given scope"); } console.log(JSON.stringify(obj, null, ' ')); msgs = wordify(obj); console.log(msgs); console.log('\n\n'); obj = { scope: scopeutils.parse([ 'stake.adults:name,photo,phone,email::texting,emailing' // all non-minors in a ward , 'stake.leadership:name,photo,phone,email::texting,emailing' ]).scopes }; console.log(JSON.stringify(obj, null, ' ')); msgs = wordify(obj); console.log(msgs); };