File tree Expand file tree Collapse file tree 4 files changed +6
-30
lines changed Expand file tree Collapse file tree 4 files changed +6
-30
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,6 @@ import {
25
25
DocumentActionEventType ,
26
26
FormatError ,
27
27
info ,
28
- isBool ,
29
28
isString ,
30
29
objectSize ,
31
30
PermissionFlag ,
@@ -221,7 +220,7 @@ class Catalog {
221
220
continue ;
222
221
}
223
222
const value = obj . get ( key ) ;
224
- if ( ! isBool ( value ) ) {
223
+ if ( typeof value !== "boolean" ) {
225
224
continue ;
226
225
}
227
226
markInfo [ key ] = value ;
@@ -1521,7 +1520,7 @@ class Catalog {
1521
1520
}
1522
1521
// The 'NewWindow' property, equal to `LinkTarget.BLANK`.
1523
1522
const newWindow = action . get ( "NewWindow" ) ;
1524
- if ( isBool ( newWindow ) ) {
1523
+ if ( typeof newWindow === "boolean" ) {
1525
1524
resultObj . newWindow = newWindow ;
1526
1525
}
1527
1526
break ;
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ import { Dict, Ref } from "./primitives.js";
17
17
import {
18
18
FormatError ,
19
19
info ,
20
- isBool ,
21
20
IsEvalSupportedCached ,
22
21
shadow ,
23
22
unreachable ,
@@ -627,7 +626,7 @@ class PostScriptEvaluator {
627
626
case "and" :
628
627
b = stack . pop ( ) ;
629
628
a = stack . pop ( ) ;
630
- if ( isBool ( a ) && isBool ( b ) ) {
629
+ if ( typeof a === "boolean" && typeof b === "boolean" ) {
631
630
stack . push ( a && b ) ;
632
631
} else {
633
632
stack . push ( a & b ) ;
@@ -751,7 +750,7 @@ class PostScriptEvaluator {
751
750
break ;
752
751
case "not" :
753
752
a = stack . pop ( ) ;
754
- if ( isBool ( a ) ) {
753
+ if ( typeof a === "boolean" ) {
755
754
stack . push ( ! a ) ;
756
755
} else {
757
756
stack . push ( ~ a ) ;
@@ -760,7 +759,7 @@ class PostScriptEvaluator {
760
759
case "or" :
761
760
b = stack . pop ( ) ;
762
761
a = stack . pop ( ) ;
763
- if ( isBool ( a ) && isBool ( b ) ) {
762
+ if ( typeof a === "boolean" && typeof b === "boolean" ) {
764
763
stack . push ( a || b ) ;
765
764
} else {
766
765
stack . push ( a | b ) ;
@@ -802,7 +801,7 @@ class PostScriptEvaluator {
802
801
case "xor" :
803
802
b = stack . pop ( ) ;
804
803
a = stack . pop ( ) ;
805
- if ( isBool ( a ) && isBool ( b ) ) {
804
+ if ( typeof a === "boolean" && typeof b === "boolean" ) {
806
805
stack . push ( a !== b ) ;
807
806
} else {
808
807
stack . push ( a ^ b ) ;
Original file line number Diff line number Diff line change @@ -1030,10 +1030,6 @@ function utf8StringToString(str) {
1030
1030
return unescape ( encodeURIComponent ( str ) ) ;
1031
1031
}
1032
1032
1033
- function isBool ( v ) {
1034
- return typeof v === "boolean" ;
1035
- }
1036
-
1037
1033
function isString ( v ) {
1038
1034
return typeof v === "string" ;
1039
1035
}
@@ -1139,7 +1135,6 @@ export {
1139
1135
isArrayBuffer ,
1140
1136
isArrayEqual ,
1141
1137
isAscii ,
1142
- isBool ,
1143
1138
IsEvalSupportedCached ,
1144
1139
IsLittleEndianCached ,
1145
1140
isSameOrigin ,
Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ import {
21
21
getModificationDate ,
22
22
isArrayBuffer ,
23
23
isAscii ,
24
- isBool ,
25
24
isSameOrigin ,
26
25
isString ,
27
26
string32 ,
@@ -74,22 +73,6 @@ describe("util", function () {
74
73
} ) ;
75
74
} ) ;
76
75
77
- describe ( "isBool" , function ( ) {
78
- it ( "handles boolean values" , function ( ) {
79
- expect ( isBool ( true ) ) . toEqual ( true ) ;
80
- expect ( isBool ( false ) ) . toEqual ( true ) ;
81
- } ) ;
82
-
83
- it ( "handles non-boolean values" , function ( ) {
84
- expect ( isBool ( "true" ) ) . toEqual ( false ) ;
85
- expect ( isBool ( "false" ) ) . toEqual ( false ) ;
86
- expect ( isBool ( 1 ) ) . toEqual ( false ) ;
87
- expect ( isBool ( 0 ) ) . toEqual ( false ) ;
88
- expect ( isBool ( null ) ) . toEqual ( false ) ;
89
- expect ( isBool ( undefined ) ) . toEqual ( false ) ;
90
- } ) ;
91
- } ) ;
92
-
93
76
describe ( "isString" , function ( ) {
94
77
it ( "handles string values" , function ( ) {
95
78
expect ( isString ( "foo" ) ) . toEqual ( true ) ;
You can’t perform that action at this time.
0 commit comments