From bb0fb5ff793a829fb8be22ed848574590362c598 Mon Sep 17 00:00:00 2001 From: titanism <101466223+titanism@users.noreply.github.com> Date: Mon, 11 Sep 2023 19:07:41 -0500 Subject: [PATCH] chore: bump deps --- package.json | 34 +++++++++++++++++----------------- src/index.js | 10 +++++----- test/basic.js | 9 ++++----- test/express.js | 6 ++---- test/koa.js | 6 ++---- 5 files changed, 30 insertions(+), 35 deletions(-) diff --git a/package.json b/package.json index f97569f..581f6e6 100644 --- a/package.json +++ b/package.json @@ -29,35 +29,35 @@ "debug": "^4.3.4", "fast-safe-stringify": "^2.1.1", "http-headers": "^3.0.2", - "is-array-buffer": "^3.0.1", + "is-array-buffer": "^3.0.2", "is-buffer": "^2.0.5", "is-stream": "2.0.1", "is-uuid": "^1.0.2", "ms": "^2.1.3", "no-case": "2.3.2", - "qs": "^6.11.0", + "qs": "^6.11.2", "rfdc": "^1.3.0", - "sensitive-fields": "^1.0.0", + "sensitive-fields": "^1.0.1", "url-parse": "^1.5.10" }, "devDependencies": { - "@babel/cli": "^7.20.7", - "@babel/core": "^7.20.12", - "@babel/preset-env": "^7.20.2", - "@commitlint/cli": "^17.4.2", - "@commitlint/config-conventional": "^17.4.2", + "@babel/cli": "^7.22.15", + "@babel/core": "^7.22.17", + "@babel/preset-env": "^7.22.15", + "@commitlint/cli": "^17.7.1", + "@commitlint/config-conventional": "^17.7.0", "@koa/multer": "^3.0.2", "@koa/router": "^12.0.0", "@ladjs/multer": "2.0.0-rc.5", - "ava": "5.1.0", - "axe": "^11.2.1", + "ava": "5.3.1", + "axe": "^12.2.2", "babelify": "^10.0.0", "browserify": "^17.0.0", - "cabin": "^11.1.5", + "cabin": "^13.2.4", "cross-env": "^7.0.3", - "eslint": "^8.31.0", + "eslint": "^8.49.0", "eslint-config-xo-lass": "^2.0.1", - "eslint-plugin-compat": "^4.0.2", + "eslint-plugin-compat": "^4.2.0", "eslint-plugin-node": "^11.1.0", "express": "^4.18.2", "express-request-id": "1.4.1", @@ -65,20 +65,20 @@ "get-port": "5.1.1", "husky": "^8.0.3", "jsdom": "15.2.1", - "koa": "^2.14.1", + "koa": "^2.14.2", "koa-connect": "^2.1.0", - "lint-staged": "^13.1.0", + "lint-staged": "^14.0.1", "multer": "1.4.5-lts.1", "nyc": "^15.1.0", "remark-cli": "^11.0.0", "remark-preset-github": "^4.0.4", "request-received": "^0.0.3", "response-time": "^2.3.2", - "rimraf": "^4.0.4", + "rimraf": "^5.0.1", "signale": "^1.4.0", "supertest": "^6.3.3", "tinyify": "3.0.0", - "xo": "^0.53.1" + "xo": "^0.56.0" }, "engines": { "node": ">=14" diff --git a/src/index.js b/src/index.js index 8efccd9..00c9528 100644 --- a/src/index.js +++ b/src/index.js @@ -127,7 +127,7 @@ function isNull(val) { } function isUndefined(val) { - return typeof val === 'undefined'; + return val === undefined; } function isObject(val) { @@ -140,7 +140,7 @@ function isString(val) { // function isCreditCard(val) { - const digits = val.replace(/\D/g, ''); + const digits = val.replaceAll(/\D/g, ''); const types = creditCardType(digits); if (!Array.isArray(types) || types.length === 0) return false; let match = false; @@ -211,7 +211,7 @@ function maskString(key, val, props, options) { // if it was a credit card then replace all digits with asterisk if (options.maskCreditCards && isCreditCard(val)) - return val.replace(/[^\D\s]/g, '*'); + return val.replaceAll(/[^\D\s]/g, '*'); } if (notIncludedInProps) return val; @@ -221,8 +221,8 @@ function maskString(key, val, props, options) { if (options.isHeaders && key === 'authorization') return `${val.split(' ')[0]} ${val .slice(val.indexOf(' ') + 1) - .replace(/./g, '*')}`; - return val.replace(/./g, '*'); + .replaceAll(/./g, '*')}`; + return val.replaceAll(/./g, '*'); } function headersToLowerCase(headers) { diff --git a/test/basic.js b/test/basic.js index 2f2f878..f365f0d 100644 --- a/test/basic.js +++ b/test/basic.js @@ -1,7 +1,6 @@ const { Buffer } = require('node:buffer'); const { PassThrough } = require('node:stream'); const test = require('ava'); - const ObjectId = require('bson-objectid'); const parseRequest = require('..'); @@ -113,7 +112,7 @@ test('parses responseHeaders as a string w/o HTTP line', (t) => { 'Hello World' ].join('\r\n') }); - t.true(typeof obj.response.status_code === 'undefined'); + t.true(obj.response.status_code === undefined); t.true(typeof obj.response.headers.date === 'string'); }); @@ -245,7 +244,7 @@ test('does not parse body', (t) => { }, parseBody: false }); - t.true(typeof obj.request.body === 'undefined'); + t.true(obj.request.body === undefined); }); test('does not parse files', (t) => { @@ -270,8 +269,8 @@ test('does not parse files', (t) => { }, parseFiles: false }); - t.true(typeof obj.request.file === 'undefined'); - t.true(typeof obj.request.files === 'undefined'); + t.true(obj.request.file === undefined); + t.true(obj.request.files === undefined); }); test('hides authentication header', (t) => { diff --git a/test/express.js b/test/express.js index fce5001..cda33a1 100644 --- a/test/express.js +++ b/test/express.js @@ -1,5 +1,4 @@ const path = require('node:path'); - const test = require('ava'); const express = require('express'); const multer = require('@ladjs/multer'); @@ -10,7 +9,6 @@ const supertest = require('supertest'); const Cabin = require('cabin'); const { Signale } = require('signale'); const getPort = require('get-port'); - const parseRequest = require('..'); const disableBodyParsing = Symbol.for('parse-request.disableBodyParsing'); @@ -119,7 +117,7 @@ test('express with body parsing disabled', async (t) => { .attach('boop', path.join(fixtures, 'boop-2.txt')) .set('Cookie', ['foo=bar;beep=boop']); t.true(typeof res.body.request.timestamp === 'string'); - t.true(typeof res.body.request.body === 'undefined'); + t.true(res.body.request.body === undefined); }); test('express with file parsing disabled', async (t) => { @@ -139,5 +137,5 @@ test('express with file parsing disabled', async (t) => { .attach('boop', path.join(fixtures, 'boop-2.txt')) .set('Cookie', ['foo=bar;beep=boop']); t.true(typeof res.body.request.timestamp === 'string'); - t.true(typeof res.body.request.files === 'undefined'); + t.true(res.body.request.files === undefined); }); diff --git a/test/koa.js b/test/koa.js index 3a9073e..06130fd 100644 --- a/test/koa.js +++ b/test/koa.js @@ -1,5 +1,4 @@ const path = require('node:path'); - const test = require('ava'); const Koa = require('koa'); const multer = require('@koa/multer'); @@ -12,7 +11,6 @@ const supertest = require('supertest'); const Cabin = require('cabin'); const { Signale } = require('signale'); const getPort = require('get-port'); - const parseRequest = require('..'); const disableBodyParsing = Symbol.for('parse-request.disableBodyParsing'); @@ -126,7 +124,7 @@ test('koa with body parsing disabled', async (t) => { .attach('boop', path.join(fixtures, 'boop-2.txt')) .set('Cookie', ['foo=bar;beep=boop']); t.true(typeof res.body.request.timestamp === 'string'); - t.true(typeof res.body.request.body === 'undefined'); + t.true(res.body.request.body === undefined); }); test('koa with file parsing disabled', async (t) => { @@ -146,7 +144,7 @@ test('koa with file parsing disabled', async (t) => { .attach('boop', path.join(fixtures, 'boop-2.txt')) .set('Cookie', ['foo=bar;beep=boop']); t.true(typeof res.body.request.timestamp === 'string'); - t.true(typeof res.body.request.files === 'undefined'); + t.true(res.body.request.files === undefined); }); test('koa with query string parsing', async (t) => {