@ts-core/oauth 3.1.5 → 3.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/go/GoUser.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.GoUser = void 0;
4
4
  const OAuthUser_1 = require("../OAuthUser");
5
+ const _ = require("lodash");
5
6
  class GoUser extends OAuthUser_1.OAuthUser {
6
7
  parse(item) {
7
8
  this.id = item.sub;
@@ -13,6 +14,17 @@ class GoUser extends OAuthUser_1.OAuthUser {
13
14
  this.familyName = item.family_name;
14
15
  }
15
16
  parsePerson(item) {
17
+ if (!_.isEmpty(item.genders)) {
18
+ this.isMale = _.first(item.genders).value === 'male';
19
+ }
20
+ if (!_.isEmpty(item.birthdays)) {
21
+ for (let value of item.birthdays) {
22
+ if (!_.isNil(value.date) && !_.isNil(value.date.year) && !_.isNil(value.date.month) && !_.isNil(value.date.day)) {
23
+ this.birthday = new Date(value.date.year, value.date.month - 1, value.date.day);
24
+ break;
25
+ }
26
+ }
27
+ }
16
28
  }
17
29
  }
18
30
  exports.GoUser = GoUser;
package/esm/go/GoUser.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { OAuthUser } from "../OAuthUser";
2
+ import * as _ from 'lodash';
2
3
  export class GoUser extends OAuthUser {
3
4
  parse(item) {
4
5
  this.id = item.sub;
@@ -10,5 +11,16 @@ export class GoUser extends OAuthUser {
10
11
  this.familyName = item.family_name;
11
12
  }
12
13
  parsePerson(item) {
14
+ if (!_.isEmpty(item.genders)) {
15
+ this.isMale = _.first(item.genders).value === 'male';
16
+ }
17
+ if (!_.isEmpty(item.birthdays)) {
18
+ for (let value of item.birthdays) {
19
+ if (!_.isNil(value.date) && !_.isNil(value.date.year) && !_.isNil(value.date.month) && !_.isNil(value.date.day)) {
20
+ this.birthday = new Date(value.date.year, value.date.month - 1, value.date.day);
21
+ break;
22
+ }
23
+ }
24
+ }
13
25
  }
14
26
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ts-core/oauth",
3
- "version": "3.1.5",
3
+ "version": "3.1.6",
4
4
  "description": "Classes and utils for oauth",
5
5
  "main": "./cjs/public-api.js",
6
6
  "module": "./esm/public-api.js",