Skip to content

Commit 76dd222

Browse files
authored
fix: Changed judgment of undefined to not use a function (#1552)
1 parent 51445e6 commit 76dd222

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

packages/graphql-shield/src/rules.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import {
1515
} from './types.js'
1616
import { isLogicRule } from './utils.js'
1717
import { GraphQLResolveInfo } from 'graphql'
18-
import { isUndefined } from 'util'
1918

2019
export class Rule implements IRule {
2120
readonly name: string
@@ -387,7 +386,7 @@ export class RuleChain extends LogicRule {
387386
async function iterate([rule, ...otherRules]: ShieldRule[]): Promise<
388387
IRuleResult[]
389388
> {
390-
if (isUndefined(rule)) return []
389+
if (rule === undefined) return []
391390
return rule.resolve(parent, args, ctx, info, options).then((res) => {
392391
if (res !== true) {
393392
return [res]
@@ -441,7 +440,7 @@ export class RuleRace extends LogicRule {
441440
async function iterate([rule, ...otherRules]: ShieldRule[]): Promise<
442441
IRuleResult[]
443442
> {
444-
if (isUndefined(rule)) return []
443+
if (rule === undefined) return []
445444
return rule.resolve(parent, args, ctx, info, options).then((res) => {
446445
if (res === true) {
447446
return [res]

0 commit comments

Comments
 (0)