Skip to content

Commit 51cd442

Browse files
authored
refactor(dependency): replace is-plain-obj with is-plain-object (#1031)
1 parent 1b3817d commit 51cd442

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## next
4+
5+
- refactor(dependency): replace is-plain-obj with is-plain-object
6+
37
## [v3.0.1](https://github.com/chimurai/http-proxy-middleware/releases/tag/v3.0.1)
48

59
- fix(type): fix RequestHandler return type ([#980](https://github.com/chimurai/http-proxy-middleware/pull/980))

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"debug": "^4.3.6",
9191
"http-proxy": "^1.18.1",
9292
"is-glob": "^4.0.3",
93-
"is-plain-obj": "^3.0.0",
93+
"is-plain-object": "^5.0.0",
9494
"micromatch": "^4.0.8"
9595
},
9696
"engines": {

src/path-rewriter.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import isPlainObj = require('is-plain-obj');
1+
import { isPlainObject } from 'is-plain-object';
22
import { ERRORS } from './errors';
33
import { Debug } from './debug';
44

@@ -45,7 +45,7 @@ export function createPathRewriter(rewriteConfig) {
4545
function isValidRewriteConfig(rewriteConfig) {
4646
if (typeof rewriteConfig === 'function') {
4747
return true;
48-
} else if (isPlainObj(rewriteConfig)) {
48+
} else if (isPlainObject(rewriteConfig)) {
4949
return Object.keys(rewriteConfig).length !== 0;
5050
} else if (rewriteConfig === undefined || rewriteConfig === null) {
5151
return false;
@@ -57,7 +57,7 @@ function isValidRewriteConfig(rewriteConfig) {
5757
function parsePathRewriteRules(rewriteConfig: Record<string, string>) {
5858
const rules: RewriteRule[] = [];
5959

60-
if (isPlainObj(rewriteConfig)) {
60+
if (isPlainObject(rewriteConfig)) {
6161
for (const [key, value] of Object.entries(rewriteConfig)) {
6262
rules.push({
6363
regex: new RegExp(key),

src/router.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import isPlainObj = require('is-plain-obj');
1+
import { isPlainObject } from 'is-plain-object';
22
import { Debug } from './debug';
33

44
const debug = Debug.extend('router');
@@ -7,7 +7,7 @@ export async function getTarget(req, config) {
77
let newTarget;
88
const router = config.router;
99

10-
if (isPlainObj(router)) {
10+
if (isPlainObject(router)) {
1111
newTarget = getTargetFromProxyTable(req, router);
1212
} else if (typeof router === 'function') {
1313
newTarget = await router(req);

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -2959,10 +2959,10 @@ is-path-inside@^3.0.3:
29592959
resolved "https://registry.yarnpkg.com/is-path-inside/-/is-path-inside-3.0.3.tgz#d231362e53a07ff2b0e0ea7fed049161ffd16283"
29602960
integrity sha512-Fd4gABb+ycGAmKou8eMftCupSir5lRxqf4aD/vd0cD2qc4HL07OjCeuHMr8Ro4CoMaeCKDB0/ECBOVWjTwUvPQ==
29612961

2962-
is-plain-obj@^3.0.0:
2963-
version "3.0.0"
2964-
resolved "https://registry.yarnpkg.com/is-plain-obj/-/is-plain-obj-3.0.0.tgz#af6f2ea14ac5a646183a5bbdb5baabbc156ad9d7"
2965-
integrity sha512-gwsOE28k+23GP1B6vFl1oVh/WOzmawBrKwo5Ev6wMKzPkaXaCDIQKzLnvsA42DRlbVTWorkgTKIviAKCWkfUwA==
2962+
is-plain-object@^5.0.0:
2963+
version "5.0.0"
2964+
resolved "https://registry.yarnpkg.com/is-plain-object/-/is-plain-object-5.0.0.tgz#4427f50ab3429e9025ea7d52e9043a9ef4159344"
2965+
integrity sha512-VRSzKkbMm5jMDoKLbltAkFQ5Qr7VDiTFGXxYFXXowVj387GeGNOCsOH6Msy00SGZ3Fp84b1Naa1psqgcCIEP5Q==
29662966

29672967
is-stream@^2.0.0:
29682968
version "2.0.1"

0 commit comments

Comments
 (0)