Skip to content

Commit

Permalink
chore: bump deps
Browse files Browse the repository at this point in the history
  • Loading branch information
titanism committed Sep 12, 2023
1 parent 5633b48 commit bb0fb5f
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 35 deletions.
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,56 +29,56 @@
"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",
"fixpack": "^4.0.0",
"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"
Expand Down
10 changes: 5 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function isNull(val) {
}

function isUndefined(val) {
return typeof val === 'undefined';
return val === undefined;
}

function isObject(val) {
Expand All @@ -140,7 +140,7 @@ function isString(val) {

// <https://github.com/braintree/credit-card-type/issues/90>
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;
Expand Down Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
9 changes: 4 additions & 5 deletions test/basic.js
Original file line number Diff line number Diff line change
@@ -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('..');

Expand Down Expand Up @@ -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');
});

Expand Down Expand Up @@ -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) => {
Expand All @@ -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) => {
Expand Down
6 changes: 2 additions & 4 deletions test/express.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('node:path');

const test = require('ava');
const express = require('express');
const multer = require('@ladjs/multer');
Expand All @@ -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');
Expand Down Expand Up @@ -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) => {
Expand All @@ -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);
});
6 changes: 2 additions & 4 deletions test/koa.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('node:path');

const test = require('ava');
const Koa = require('koa');
const multer = require('@koa/multer');
Expand All @@ -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');
Expand Down Expand Up @@ -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) => {
Expand All @@ -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) => {
Expand Down

0 comments on commit bb0fb5f

Please sign in to comment.