Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

jwt-decode

Package Overview
Dependencies
Maintainers
44
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jwt-decode - npm Package Compare versions

Comparing version 4.0.0-beta.2 to 4.0.0-beta.3

build/cjs/index.d.ts

33

package.json
{
"name": "jwt-decode",
"version": "4.0.0-beta.2",
"version": "4.0.0-beta.3",
"description": "Decode JWT tokens, mostly useful for browser applications.",
"type": "module",
"main": "build/cjs/jwt-decode.cjs",
"module": "build/esm/jwt-decode.js",
"types": "build/cjs/jwt-decode.d.cts",
"main": "build/cjs/index.js",
"module": "build/esm/index.js",
"types": "build/cjs/index.d.ts",
"exports": {
".": {
"import": {
"default": "./build/esm/jwt-decode.js",
"types": "./build/esm/jwt-decode.d.ts"
"default": "./build/esm/index.js",
"types": "./build/esm/index.d.ts"
},
"require": {
"default": "./build/cjs/jwt-decode.cjs",
"types": "./build/cjs/jwt-decode.d.cts"
"default": "./build/cjs/index.js",
"types": "./build/cjs/index.d.ts"
}

@@ -32,7 +32,4 @@ }

"scripts": {
"dev": "rollup --sourcemap --config --configPlugin typescript",
"build": "rimraf build && rollup --sourcemap --config --configPlugin typescript --environment NODE_ENV:production && npm run generate-types",
"generate-types": "npm run generate-types:es && npm run generate-types:cjs",
"generate-types:es": "tsup --entry.jwt-decode lib/index.ts --out-dir build/esm --dts-only --format esm",
"generate-types:cjs": "tsup --entry.jwt-decode lib/index.ts --out-dir build/cjs --dts-only --format cjs",
"prebuild": "rimraf build",
"build": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json && echo '{\"type\": \"commonjs\"}'> build/cjs/package.json",
"test": "npm run test:node && npm run test:browser",

@@ -49,14 +46,8 @@ "test:node": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest --coverage",

"devDependencies": {
"@rollup/plugin-terser": "^0.4.3",
"@rollup/plugin-typescript": "^11.1.2",
"jest": "^29.6.1",
"jest-environment-jsdom": "^29.6.1",
"jest": "^29.6.2",
"jest-environment-jsdom": "^29.6.2",
"jest-junit": "^16.0.0",
"rimraf": "^5.0.1",
"rollup": "^3.26.3",
"rollup-plugin-livereload": "^2.0.5",
"rollup-plugin-serve": "^2.0.2",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"tsup": "^7.1.0",
"typescript": "^5.1.6"

@@ -63,0 +54,0 @@ },

@@ -95,22 +95,11 @@ ![Browser library that helps decoding JWT tokens which are Base64Url encoded](https://cdn.auth0.com/website/sdks/banners/jwt-decode-banner.png)

Copy the file `jwt-decode.js` from the root of the `build/` folder to your project somewhere, then include it like so:
Copy the file `jwt-decode.js` from the root of the `build/esm` folder to your project somewhere, then import `jwtDecode` from it inside a script tag that's marked with `type="module"`:
```html
<script src="jwt-decode.js"></script>
```
<script type="module">
import { jwtDecode } from "/path/to/jwt-decode.js";
Once this script has loaded, the `jwt_decode` function will be exposed as a global:
```javascript
const token = "eyJhsw5c";
const decoded = jwt_decode(token);
```
Alternatively, if you are using the [Asynchronous Module Definition (AMD) API](https://github.com/amdjs/amdjs-api/blob/master/AMD.md), you can load the same function as follows:
```javascript
define(["jwt_decode"], (jwtDecode) => {
const token = "eyJhsw5c";
const decoded = jwtDecode(token);
});
</script>
```

@@ -117,0 +106,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc