chore(deps): removed ts-pattern (#565)
* fix(deps): update dependency ts-pattern to v5 * chore(deps): removed ts-pattern --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Corentin Thomasset <corentin.thomasset74@gmail.com>
This commit is contained in:
		
							parent
							
								
									2bcb77a9f9
								
							
						
					
					
						commit
						0f1f6590c5
					
				| @ -73,7 +73,6 @@ | |||||||
|     "qrcode": "^1.5.1", |     "qrcode": "^1.5.1", | ||||||
|     "randombytes": "^2.1.0", |     "randombytes": "^2.1.0", | ||||||
|     "sql-formatter": "^12.0.0", |     "sql-formatter": "^12.0.0", | ||||||
|     "ts-pattern": "^4.2.2", |  | ||||||
|     "ua-parser-js": "^1.0.35", |     "ua-parser-js": "^1.0.35", | ||||||
|     "unicode-emoji-json": "^0.4.0", |     "unicode-emoji-json": "^0.4.0", | ||||||
|     "unplugin-auto-import": "^0.16.4", |     "unplugin-auto-import": "^0.16.4", | ||||||
|  | |||||||
							
								
								
									
										7
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										7
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							| @ -125,9 +125,6 @@ dependencies: | |||||||
|   sql-formatter: |   sql-formatter: | ||||||
|     specifier: ^12.0.0 |     specifier: ^12.0.0 | ||||||
|     version: 12.0.0 |     version: 12.0.0 | ||||||
|   ts-pattern: |  | ||||||
|     specifier: ^4.2.2 |  | ||||||
|     version: 4.2.2 |  | ||||||
|   ua-parser-js: |   ua-parser-js: | ||||||
|     specifier: ^1.0.35 |     specifier: ^1.0.35 | ||||||
|     version: 1.0.35 |     version: 1.0.35 | ||||||
| @ -8122,10 +8119,6 @@ packages: | |||||||
|       typescript: 4.9.3 |       typescript: 4.9.3 | ||||||
|     dev: true |     dev: true | ||||||
| 
 | 
 | ||||||
|   /ts-pattern@4.2.2: |  | ||||||
|     resolution: {integrity: sha512-qzJMo2pbkUJWusRH5o8xR+xogn6RmvViyUgwBFTtRENLse470clCGjHDf6haWGZ1AOmk8XkEohUoBW8Uut6Scg==} |  | ||||||
|     dev: false |  | ||||||
| 
 |  | ||||||
|   /tsconfig-paths@3.14.2: |   /tsconfig-paths@3.14.2: | ||||||
|     resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} |     resolution: {integrity: sha512-o/9iXgCYc5L/JxCHPe3Hvh8Q/2xm5Z+p18PESBU6Ff33695QnCHBEjcytY2q19ua7Mbl/DavtBOLq+oG0RCL+g==} | ||||||
|     dependencies: |     dependencies: | ||||||
|  | |||||||
| @ -1,6 +1,5 @@ | |||||||
| import jwtDecode, { type JwtHeader, type JwtPayload } from 'jwt-decode'; | import jwtDecode, { type JwtHeader, type JwtPayload } from 'jwt-decode'; | ||||||
| import _ from 'lodash'; | import _ from 'lodash'; | ||||||
| import { match } from 'ts-pattern'; |  | ||||||
| import { ALGORITHM_DESCRIPTIONS, CLAIM_DESCRIPTIONS } from './jwt-parser.constants'; | import { ALGORITHM_DESCRIPTIONS, CLAIM_DESCRIPTIONS } from './jwt-parser.constants'; | ||||||
| 
 | 
 | ||||||
| export { decodeJwt }; | export { decodeJwt }; | ||||||
| @ -32,10 +31,15 @@ function parseClaims({ claim, value }: { claim: string; value: unknown }) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function getFriendlyValue({ claim, value }: { claim: string; value: unknown }) { | function getFriendlyValue({ claim, value }: { claim: string; value: unknown }) { | ||||||
|   return match(claim) |   if (['exp', 'nbf', 'iat'].includes(claim)) { | ||||||
|     .with('exp', 'nbf', 'iat', () => dateFormatter(value)) |     return dateFormatter(value); | ||||||
|     .with('alg', () => (_.isString(value) ? ALGORITHM_DESCRIPTIONS[value] : undefined)) |   } | ||||||
|     .otherwise(() => undefined); | 
 | ||||||
|  |   if (claim === 'alg' && _.isString(value)) { | ||||||
|  |     return ALGORITHM_DESCRIPTIONS[value]; | ||||||
|  |   } | ||||||
|  | 
 | ||||||
|  |   return undefined; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function dateFormatter(value: unknown) { | function dateFormatter(value: unknown) { | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user