@composer-js/core
Advanced tools
Comparing version 1.2.3 to 1.3.0
@@ -19,2 +19,21 @@ "use strict"; | ||
/** | ||
* Returns the unique identifier of the specified type associated with the given user. | ||
* | ||
* @parm user The user to retrieve the external id from. | ||
* @param type The type of external provider to retrieve. | ||
* @returns The unique id of the external provider for the given type if found, otherwise `undefined`. | ||
*/ | ||
static getExternalId(user, type) { | ||
let result = undefined; | ||
if (user && Array.isArray(user.externalIds)) { | ||
for (const externalId of user.externalIds) { | ||
const parts = externalId.split(":"); | ||
if (parts.length === 2 && parts[0] === type) { | ||
result = parts[1]; | ||
} | ||
} | ||
} | ||
return result; | ||
} | ||
/** | ||
* Returns `true` if the given user object has a role with the specified name, otherwise returns `false`. | ||
@@ -21,0 +40,0 @@ * |
@@ -14,2 +14,10 @@ /** | ||
/** | ||
* Returns the unique identifier of the specified type associated with the given user. | ||
* | ||
* @parm user The user to retrieve the external id from. | ||
* @param type The type of external provider to retrieve. | ||
* @returns The unique id of the external provider for the given type if found, otherwise `undefined`. | ||
*/ | ||
static getExternalId(user: any, type: string): string | undefined; | ||
/** | ||
* Returns `true` if the given user object has a role with the specified name, otherwise returns `false`. | ||
@@ -16,0 +24,0 @@ * |
{ | ||
"name": "@composer-js/core", | ||
"version": "1.2.3", | ||
"version": "1.3.0", | ||
"description": "A collection of common utilities and core functionality for composerjs applications.", | ||
@@ -5,0 +5,0 @@ "author": "AcceleratXR, Inc. <info@acceleratxr.com>", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97941
1564