From 88cb9df18a1d2a7b24f8cfeaa6f5f5b87d2c027f Mon Sep 17 00:00:00 2001 From: dviryamin Date: Mon, 10 Feb 2020 17:55:58 +0200 Subject: [PATCH] Replace tilde-indexOf with includes (#647) * Replace tilde-indexOf with includes * remove package lock --- verify.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/verify.js b/verify.js index 1df99f8..8687eb5 100644 --- a/verify.js +++ b/verify.js @@ -111,9 +111,9 @@ module.exports = function (jwtString, secretOrPublicKey, options, callback) { } if (!options.algorithms) { - options.algorithms = ~secretOrPublicKey.toString().indexOf('BEGIN CERTIFICATE') || - ~secretOrPublicKey.toString().indexOf('BEGIN PUBLIC KEY') ? PUB_KEY_ALGS : - ~secretOrPublicKey.toString().indexOf('BEGIN RSA PUBLIC KEY') ? RSA_KEY_ALGS : HS_ALGS; + options.algorithms = secretOrPublicKey.toString().includes('BEGIN CERTIFICATE') || + secretOrPublicKey.toString().includes('BEGIN PUBLIC KEY') ? PUB_KEY_ALGS : + secretOrPublicKey.toString().includes('BEGIN RSA PUBLIC KEY') ? RSA_KEY_ALGS : HS_ALGS; }