Skip to content

Commit

Permalink
@uppy/companion: remove isobject from dependencies (#3948)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed Aug 4, 2022
1 parent 9a213b5 commit 3fed45a
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
1 change: 0 additions & 1 deletion packages/@uppy/companion/package.json
Expand Up @@ -47,7 +47,6 @@
"grant": "4.7.0",
"helmet": "^4.6.0",
"ipaddr.js": "^2.0.1",
"isobject": "3.0.1",
"jsonwebtoken": "8.5.1",
"lodash.merge": "^4.6.2",
"mime-types": "2.1.25",
Expand Down
9 changes: 4 additions & 5 deletions packages/@uppy/companion/src/server/Uploader.js
@@ -1,7 +1,6 @@
// eslint-disable-next-line max-classes-per-file
const tus = require('tus-js-client')
const { randomUUID } = require('node:crypto')
const isObject = require('isobject')
const validator = require('validator')
const request = require('request')
const { pipeline: pipelineCb } = require('node:stream')
Expand Down Expand Up @@ -78,17 +77,17 @@ function validateOptions (options) {
}

// validate fieldname
if (options.fieldname && typeof options.fieldname !== 'string') {
if (options.fieldname != null && typeof options.fieldname !== 'string') {
throw new ValidationError('fieldname must be a string')
}

// validate metadata
if (options.metadata != null) {
if (!isObject(options.metadata)) throw new ValidationError('metadata must be an object')
if (options.metadata != null && typeof options.metadata !== 'object') {
throw new ValidationError('metadata must be an object')
}

// validate headers
if (options.headers && !isObject(options.headers)) {
if (options.headers != null && typeof options.headers !== 'object') {
throw new ValidationError('headers must be an object')
}

Expand Down
3 changes: 1 addition & 2 deletions packages/@uppy/companion/src/server/header-blacklist.js
@@ -1,4 +1,3 @@
const isObject = require('isobject')
const logger = require('./logger')

/**
Expand Down Expand Up @@ -50,7 +49,7 @@ const isForbiddenHeader = (header) => {
}

module.exports = (headers) => {
if (!isObject(headers)) {
if (headers == null || typeof headers !== 'object' || Array.isArray(headers)) {
return {}
}

Expand Down
15 changes: 7 additions & 8 deletions yarn.lock
Expand Up @@ -10180,7 +10180,6 @@ __metadata:
helmet: ^4.6.0
into-stream: ^6.0.0
ipaddr.js: ^2.0.1
isobject: 3.0.1
jest: ^27.0.6
jsonwebtoken: 8.5.1
lodash.merge: ^4.6.2
Expand Down Expand Up @@ -24609,13 +24608,6 @@ hexo-filter-github-emojis@arturi/hexo-filter-github-emojis:
languageName: node
linkType: hard

"isobject@npm:3.0.1, isobject@npm:^3.0.0, isobject@npm:^3.0.1":
version: 3.0.1
resolution: "isobject@npm:3.0.1"
checksum: db85c4c970ce30693676487cca0e61da2ca34e8d4967c2e1309143ff910c207133a969f9e4ddb2dc6aba670aabce4e0e307146c310350b298e74a31f7d464703
languageName: node
linkType: hard

"isobject@npm:^2.0.0":
version: 2.1.0
resolution: "isobject@npm:2.1.0"
Expand All @@ -24625,6 +24617,13 @@ hexo-filter-github-emojis@arturi/hexo-filter-github-emojis:
languageName: node
linkType: hard

"isobject@npm:^3.0.0, isobject@npm:^3.0.1":
version: 3.0.1
resolution: "isobject@npm:3.0.1"
checksum: db85c4c970ce30693676487cca0e61da2ca34e8d4967c2e1309143ff910c207133a969f9e4ddb2dc6aba670aabce4e0e307146c310350b298e74a31f7d464703
languageName: node
linkType: hard

"isobject@npm:^4.0.0":
version: 4.0.0
resolution: "isobject@npm:4.0.0"
Expand Down

0 comments on commit 3fed45a

Please sign in to comment.