objc2-javascript-core 0.3.1

Bindings to the JavaScriptCore framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;

use crate::*;

/// A constant identifying the type of a JSValue.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/javascriptcore/jstype?language=objc)
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct JSType(pub c_uint);
impl JSType {
    #[doc(alias = "kJSTypeUndefined")]
    pub const Undefined: Self = Self(0);
    #[doc(alias = "kJSTypeNull")]
    pub const Null: Self = Self(1);
    #[doc(alias = "kJSTypeBoolean")]
    pub const Boolean: Self = Self(2);
    #[doc(alias = "kJSTypeNumber")]
    pub const Number: Self = Self(3);
    #[doc(alias = "kJSTypeString")]
    pub const String: Self = Self(4);
    #[doc(alias = "kJSTypeObject")]
    pub const Object: Self = Self(5);
    #[doc(alias = "kJSTypeSymbol")]
    pub const Symbol: Self = Self(6);
    #[doc(alias = "kJSTypeBigInt")]
    pub const BigInt: Self = Self(7);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for JSType {
    const ENCODING: Encoding = c_uint::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for JSType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// A constant identifying the Typed Array type of a JSObjectRef.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/javascriptcore/jstypedarraytype?language=objc)
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct JSTypedArrayType(pub c_uint);
impl JSTypedArrayType {
    #[doc(alias = "kJSTypedArrayTypeInt8Array")]
    pub const Int8Array: Self = Self(0);
    #[doc(alias = "kJSTypedArrayTypeInt16Array")]
    pub const Int16Array: Self = Self(1);
    #[doc(alias = "kJSTypedArrayTypeInt32Array")]
    pub const Int32Array: Self = Self(2);
    #[doc(alias = "kJSTypedArrayTypeUint8Array")]
    pub const Uint8Array: Self = Self(3);
    #[doc(alias = "kJSTypedArrayTypeUint8ClampedArray")]
    pub const Uint8ClampedArray: Self = Self(4);
    #[doc(alias = "kJSTypedArrayTypeUint16Array")]
    pub const Uint16Array: Self = Self(5);
    #[doc(alias = "kJSTypedArrayTypeUint32Array")]
    pub const Uint32Array: Self = Self(6);
    #[doc(alias = "kJSTypedArrayTypeFloat32Array")]
    pub const Float32Array: Self = Self(7);
    #[doc(alias = "kJSTypedArrayTypeFloat64Array")]
    pub const Float64Array: Self = Self(8);
    #[doc(alias = "kJSTypedArrayTypeArrayBuffer")]
    pub const ArrayBuffer: Self = Self(9);
    #[doc(alias = "kJSTypedArrayTypeNone")]
    pub const None: Self = Self(10);
    #[doc(alias = "kJSTypedArrayTypeBigInt64Array")]
    pub const BigInt64Array: Self = Self(11);
    #[doc(alias = "kJSTypedArrayTypeBigUint64Array")]
    pub const BigUint64Array: Self = Self(12);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for JSTypedArrayType {
    const ENCODING: Encoding = c_uint::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for JSTypedArrayType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

/// A constant identifying the type of JavaScript relation condition.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/javascriptcore/jsrelationcondition?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct JSRelationCondition(pub u32);
impl JSRelationCondition {
    /// A constant identifying the type of JavaScript relation condition.
    #[doc(alias = "kJSRelationConditionUndefined")]
    pub const Undefined: Self = Self(0);
    /// A constant identifying the type of JavaScript relation condition.
    #[doc(alias = "kJSRelationConditionEqual")]
    pub const Equal: Self = Self(1);
    /// A constant identifying the type of JavaScript relation condition.
    #[doc(alias = "kJSRelationConditionGreaterThan")]
    pub const GreaterThan: Self = Self(2);
    /// A constant identifying the type of JavaScript relation condition.
    #[doc(alias = "kJSRelationConditionLessThan")]
    pub const LessThan: Self = Self(3);
}

#[cfg(feature = "objc2")]
unsafe impl Encode for JSRelationCondition {
    const ENCODING: Encoding = u32::ENCODING;
}

#[cfg(feature = "objc2")]
unsafe impl RefEncode for JSRelationCondition {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

#[cfg(all(feature = "JSValue", feature = "objc2"))]
impl JSValue {
    /// Returns a JavaScript value's type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue whose type you want to obtain.
    ///
    /// Returns: A value of type JSType that identifies value's type.
    #[doc(alias = "JSValueGetType")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn r#type(ctx: JSContextRef, value: JSValueRef) -> JSType {
        extern "C-unwind" {
            fn JSValueGetType(ctx: JSContextRef, value: JSValueRef) -> JSType;
        }
        unsafe { JSValueGetType(ctx, value) }
    }

    /// Tests whether a JavaScript value's type is the undefined type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to test.
    ///
    /// Returns: true if value's type is the undefined type, otherwise false.
    #[doc(alias = "JSValueIsUndefined")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_undefined(ctx: JSContextRef, value: JSValueRef) -> bool {
        extern "C-unwind" {
            fn JSValueIsUndefined(ctx: JSContextRef, value: JSValueRef) -> bool;
        }
        unsafe { JSValueIsUndefined(ctx, value) }
    }

    /// Tests whether a JavaScript value's type is the null type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to test.
    ///
    /// Returns: true if value's type is the null type, otherwise false.
    #[doc(alias = "JSValueIsNull")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_null(ctx: JSContextRef, value: JSValueRef) -> bool {
        extern "C-unwind" {
            fn JSValueIsNull(ctx: JSContextRef, value: JSValueRef) -> bool;
        }
        unsafe { JSValueIsNull(ctx, value) }
    }

    /// Tests whether a JavaScript value's type is the boolean type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to test.
    ///
    /// Returns: true if value's type is the boolean type, otherwise false.
    #[doc(alias = "JSValueIsBoolean")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_boolean(ctx: JSContextRef, value: JSValueRef) -> bool {
        extern "C-unwind" {
            fn JSValueIsBoolean(ctx: JSContextRef, value: JSValueRef) -> bool;
        }
        unsafe { JSValueIsBoolean(ctx, value) }
    }

    /// Tests whether a JavaScript value's type is the number type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to test.
    ///
    /// Returns: true if value's type is the number type, otherwise false.
    #[doc(alias = "JSValueIsNumber")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_number(ctx: JSContextRef, value: JSValueRef) -> bool {
        extern "C-unwind" {
            fn JSValueIsNumber(ctx: JSContextRef, value: JSValueRef) -> bool;
        }
        unsafe { JSValueIsNumber(ctx, value) }
    }

    /// Tests whether a JavaScript value's type is the string type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to test.
    ///
    /// Returns: true if value's type is the string type, otherwise false.
    #[doc(alias = "JSValueIsString")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_string(ctx: JSContextRef, value: JSValueRef) -> bool {
        extern "C-unwind" {
            fn JSValueIsString(ctx: JSContextRef, value: JSValueRef) -> bool;
        }
        unsafe { JSValueIsString(ctx, value) }
    }

    /// Tests whether a JavaScript value's type is the symbol type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to test.
    ///
    /// Returns: true if value's type is the symbol type, otherwise false.
    #[doc(alias = "JSValueIsSymbol")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_symbol(ctx: JSContextRef, value: JSValueRef) -> bool {
        extern "C-unwind" {
            fn JSValueIsSymbol(ctx: JSContextRef, value: JSValueRef) -> bool;
        }
        unsafe { JSValueIsSymbol(ctx, value) }
    }

    /// Tests whether a JavaScript value's type is the BigInt type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to test.
    ///
    /// Returns: true if value's type is the BigInt type, otherwise false.
    #[doc(alias = "JSValueIsBigInt")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_big_int(ctx: JSContextRef, value: JSValueRef) -> bool {
        extern "C-unwind" {
            fn JSValueIsBigInt(ctx: JSContextRef, value: JSValueRef) -> bool;
        }
        unsafe { JSValueIsBigInt(ctx, value) }
    }

    /// Tests whether a JavaScript value's type is the object type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to test.
    ///
    /// Returns: true if value's type is the object type, otherwise false.
    #[doc(alias = "JSValueIsObject")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_object(ctx: JSContextRef, value: JSValueRef) -> bool {
        extern "C-unwind" {
            fn JSValueIsObject(ctx: JSContextRef, value: JSValueRef) -> bool;
        }
        unsafe { JSValueIsObject(ctx, value) }
    }

    /// Tests whether a JavaScript value is an object with a given class in its class chain.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to test.
    ///
    /// Parameter `jsClass`: The JSClass to test against.
    ///
    /// Returns: true if value is an object and has jsClass in its class chain, otherwise false.
    #[doc(alias = "JSValueIsObjectOfClass")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_object_of_class(
        ctx: JSContextRef,
        value: JSValueRef,
        js_class: JSClassRef,
    ) -> bool {
        extern "C-unwind" {
            fn JSValueIsObjectOfClass(
                ctx: JSContextRef,
                value: JSValueRef,
                js_class: JSClassRef,
            ) -> bool;
        }
        unsafe { JSValueIsObjectOfClass(ctx, value, js_class) }
    }

    /// Tests whether a JavaScript value is an array.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to test.
    ///
    /// Returns: true if value is an array, otherwise false.
    #[doc(alias = "JSValueIsArray")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_array(ctx: JSContextRef, value: JSValueRef) -> bool {
        extern "C-unwind" {
            fn JSValueIsArray(ctx: JSContextRef, value: JSValueRef) -> bool;
        }
        unsafe { JSValueIsArray(ctx, value) }
    }

    /// Tests whether a JavaScript value is a date.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to test.
    ///
    /// Returns: true if value is a date, otherwise false.
    #[doc(alias = "JSValueIsDate")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_date(ctx: JSContextRef, value: JSValueRef) -> bool {
        extern "C-unwind" {
            fn JSValueIsDate(ctx: JSContextRef, value: JSValueRef) -> bool;
        }
        unsafe { JSValueIsDate(ctx, value) }
    }

    /// Returns a JavaScript value's Typed Array type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue whose Typed Array type to return.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: A value of type JSTypedArrayType that identifies value's Typed Array type, or kJSTypedArrayTypeNone if the value is not a Typed Array object.
    #[doc(alias = "JSValueGetTypedArrayType")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn typed_array_type(
        ctx: JSContextRef,
        value: JSValueRef,
        exception: *mut JSValueRef,
    ) -> JSTypedArrayType {
        extern "C-unwind" {
            fn JSValueGetTypedArrayType(
                ctx: JSContextRef,
                value: JSValueRef,
                exception: *mut JSValueRef,
            ) -> JSTypedArrayType;
        }
        unsafe { JSValueGetTypedArrayType(ctx, value, exception) }
    }

    /// Tests whether two JavaScript values are equal, as compared by the JS == operator.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `a`: The first value to test.
    ///
    /// Parameter `b`: The second value to test.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: true if the two values are equal, false if they are not equal or an exception is thrown.
    #[doc(alias = "JSValueIsEqual")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_equal(
        ctx: JSContextRef,
        a: JSValueRef,
        b: JSValueRef,
        exception: *mut JSValueRef,
    ) -> bool {
        extern "C-unwind" {
            fn JSValueIsEqual(
                ctx: JSContextRef,
                a: JSValueRef,
                b: JSValueRef,
                exception: *mut JSValueRef,
            ) -> bool;
        }
        unsafe { JSValueIsEqual(ctx, a, b, exception) }
    }

    /// Tests whether two JavaScript values are strict equal, as compared by the JS === operator.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `a`: The first value to test.
    ///
    /// Parameter `b`: The second value to test.
    ///
    /// Returns: true if the two values are strict equal, otherwise false.
    #[doc(alias = "JSValueIsStrictEqual")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_strict_equal(ctx: JSContextRef, a: JSValueRef, b: JSValueRef) -> bool {
        extern "C-unwind" {
            fn JSValueIsStrictEqual(ctx: JSContextRef, a: JSValueRef, b: JSValueRef) -> bool;
        }
        unsafe { JSValueIsStrictEqual(ctx, a, b) }
    }

    /// Tests whether a JavaScript value is an object constructed by a given constructor, as compared by the JS instanceof operator.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to test.
    ///
    /// Parameter `constructor`: The constructor to test against.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: true if value is an object constructed by constructor, as compared by the JS instanceof operator, otherwise false.
    #[doc(alias = "JSValueIsInstanceOfConstructor")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn is_instance_of_constructor(
        ctx: JSContextRef,
        value: JSValueRef,
        constructor: JSObjectRef,
        exception: *mut JSValueRef,
    ) -> bool {
        extern "C-unwind" {
            fn JSValueIsInstanceOfConstructor(
                ctx: JSContextRef,
                value: JSValueRef,
                constructor: JSObjectRef,
                exception: *mut JSValueRef,
            ) -> bool;
        }
        unsafe { JSValueIsInstanceOfConstructor(ctx, value, constructor, exception) }
    }

    /// Compares two JSValues.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `left`: The JSValue as the left operand.
    ///
    /// Parameter `right`: The JSValue as the right operand.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: A value of JSRelationCondition, a kJSRelationConditionUndefined is returned if an exception is thrown.
    ///
    /// The result is computed by comparing the results of JavaScript's `==`, `
    /// <
    /// `, and `>` operators. If either `left` or `right` is (or would coerce to) `NaN` in JavaScript, then the result is kJSRelationConditionUndefined.
    #[doc(alias = "JSValueCompare")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn compare(
        ctx: JSContextRef,
        left: JSValueRef,
        right: JSValueRef,
        exception: *mut JSValueRef,
    ) -> JSRelationCondition {
        extern "C-unwind" {
            fn JSValueCompare(
                ctx: JSContextRef,
                left: JSValueRef,
                right: JSValueRef,
                exception: *mut JSValueRef,
            ) -> JSRelationCondition;
        }
        unsafe { JSValueCompare(ctx, left, right, exception) }
    }

    /// Compares a JSValue with a signed 64-bit integer.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `left`: The JSValue as the left operand.
    ///
    /// Parameter `right`: The int64_t as the right operand.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: A value of JSRelationCondition, a kJSRelationConditionUndefined is returned if an exception is thrown.
    ///
    /// `left` is converted to an integer according to the rules specified by the JavaScript language then compared with `right`.
    #[doc(alias = "JSValueCompareInt64")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn compare_int64(
        ctx: JSContextRef,
        left: JSValueRef,
        right: i64,
        exception: *mut JSValueRef,
    ) -> JSRelationCondition {
        extern "C-unwind" {
            fn JSValueCompareInt64(
                ctx: JSContextRef,
                left: JSValueRef,
                right: i64,
                exception: *mut JSValueRef,
            ) -> JSRelationCondition;
        }
        unsafe { JSValueCompareInt64(ctx, left, right, exception) }
    }

    /// Compares a JSValue with an unsigned 64-bit integer.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `left`: The JSValue as the left operand.
    ///
    /// Parameter `right`: The uint64_t as the right operand.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: A value of JSRelationCondition, a kJSRelationConditionUndefined is returned if an exception is thrown.
    ///
    /// `left` is converted to an integer according to the rules specified by the JavaScript language then compared with `right`.
    #[doc(alias = "JSValueCompareUInt64")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn compare_u_int64(
        ctx: JSContextRef,
        left: JSValueRef,
        right: u64,
        exception: *mut JSValueRef,
    ) -> JSRelationCondition {
        extern "C-unwind" {
            fn JSValueCompareUInt64(
                ctx: JSContextRef,
                left: JSValueRef,
                right: u64,
                exception: *mut JSValueRef,
            ) -> JSRelationCondition;
        }
        unsafe { JSValueCompareUInt64(ctx, left, right, exception) }
    }

    /// Compares a JSValue with a double.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `left`: The JSValue as the left operand.
    ///
    /// Parameter `right`: The double as the right operand.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: A value of JSRelationCondition, a kJSRelationConditionUndefined is returned if an exception is thrown.
    ///
    /// `left` is converted to a double according to the rules specified by the JavaScript language then compared with `right`.
    #[doc(alias = "JSValueCompareDouble")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn compare_double(
        ctx: JSContextRef,
        left: JSValueRef,
        right: c_double,
        exception: *mut JSValueRef,
    ) -> JSRelationCondition {
        extern "C-unwind" {
            fn JSValueCompareDouble(
                ctx: JSContextRef,
                left: JSValueRef,
                right: c_double,
                exception: *mut JSValueRef,
            ) -> JSRelationCondition;
        }
        unsafe { JSValueCompareDouble(ctx, left, right, exception) }
    }

    /// Creates a JavaScript value of the undefined type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Returns: The unique undefined value.
    #[doc(alias = "JSValueMakeUndefined")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn new_undefined(ctx: JSContextRef) -> JSValueRef {
        extern "C-unwind" {
            fn JSValueMakeUndefined(ctx: JSContextRef) -> JSValueRef;
        }
        unsafe { JSValueMakeUndefined(ctx) }
    }

    /// Creates a JavaScript value of the null type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Returns: The unique null value.
    #[doc(alias = "JSValueMakeNull")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn new_null(ctx: JSContextRef) -> JSValueRef {
        extern "C-unwind" {
            fn JSValueMakeNull(ctx: JSContextRef) -> JSValueRef;
        }
        unsafe { JSValueMakeNull(ctx) }
    }

    /// Creates a JavaScript value of the boolean type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `boolean`: The bool to assign to the newly created JSValue.
    ///
    /// Returns: A JSValue of the boolean type, representing the value of boolean.
    #[doc(alias = "JSValueMakeBoolean")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn new_boolean(ctx: JSContextRef, boolean: bool) -> JSValueRef {
        extern "C-unwind" {
            fn JSValueMakeBoolean(ctx: JSContextRef, boolean: bool) -> JSValueRef;
        }
        unsafe { JSValueMakeBoolean(ctx, boolean) }
    }

    /// Creates a JavaScript value of the number type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `number`: The double to assign to the newly created JSValue.
    ///
    /// Returns: A JSValue of the number type, representing the value of number.
    #[doc(alias = "JSValueMakeNumber")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn new_number(ctx: JSContextRef, number: c_double) -> JSValueRef {
        extern "C-unwind" {
            fn JSValueMakeNumber(ctx: JSContextRef, number: c_double) -> JSValueRef;
        }
        unsafe { JSValueMakeNumber(ctx, number) }
    }

    /// Creates a JavaScript value of the string type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `string`: The JSString to assign to the newly created JSValue. The
    /// newly created JSValue retains string, and releases it upon garbage collection.
    ///
    /// Returns: A JSValue of the string type, representing the value of string.
    #[doc(alias = "JSValueMakeString")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn new_string(ctx: JSContextRef, string: JSStringRef) -> JSValueRef {
        extern "C-unwind" {
            fn JSValueMakeString(ctx: JSContextRef, string: JSStringRef) -> JSValueRef;
        }
        unsafe { JSValueMakeString(ctx, string) }
    }

    /// Creates a JavaScript value of the symbol type.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `description`: A description of the newly created symbol value.
    ///
    /// Returns: A unique JSValue of the symbol type, whose description matches the one provided.
    #[doc(alias = "JSValueMakeSymbol")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn new_symbol(ctx: JSContextRef, description: JSStringRef) -> JSValueRef {
        extern "C-unwind" {
            fn JSValueMakeSymbol(ctx: JSContextRef, description: JSStringRef) -> JSValueRef;
        }
        unsafe { JSValueMakeSymbol(ctx, description) }
    }
}

extern "C-unwind" {
    /// Creates a JavaScript BigInt with a double.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The value to copy into the new BigInt JSValue.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: A BigInt JSValue of the value, or NULL if an exception is thrown.
    ///
    /// If the value is not an integer, an exception is thrown.
    #[cfg(feature = "JSBase")]
    pub fn JSBigIntCreateWithDouble(
        ctx: JSContextRef,
        value: c_double,
        exception: *mut JSValueRef,
    ) -> JSValueRef;
}

extern "C-unwind" {
    /// Creates a JavaScript BigInt with a 64-bit signed integer.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `integer`: The 64-bit signed integer to copy into the new BigInt JSValue.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: A BigInt JSValue of the integer, or NULL if an exception is thrown.
    #[cfg(feature = "JSBase")]
    pub fn JSBigIntCreateWithInt64(
        ctx: JSContextRef,
        integer: i64,
        exception: *mut JSValueRef,
    ) -> JSValueRef;
}

extern "C-unwind" {
    /// Creates a JavaScript BigInt with a 64-bit unsigned integer.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `integer`: The 64-bit unsigned integer to copy into the new BigInt JSValue.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: A BigInt JSValue of the integer, or NULL if an exception is thrown.
    #[cfg(feature = "JSBase")]
    pub fn JSBigIntCreateWithUInt64(
        ctx: JSContextRef,
        integer: u64,
        exception: *mut JSValueRef,
    ) -> JSValueRef;
}

extern "C-unwind" {
    /// Creates a JavaScript BigInt with an integer represented in string.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `string`: The JSStringRef representation of an integer.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: A BigInt JSValue of the string, or NULL if an exception is thrown.
    ///
    /// This is equivalent to calling the `BigInt` constructor from JavaScript with a string argument.
    #[cfg(feature = "JSBase")]
    pub fn JSBigIntCreateWithString(
        ctx: JSContextRef,
        string: JSStringRef,
        exception: *mut JSValueRef,
    ) -> JSValueRef;
}

#[cfg(all(feature = "JSValue", feature = "objc2"))]
impl JSValue {
    /// Creates a JavaScript value from a JSON formatted string.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `string`: The JSString containing the JSON string to be parsed.
    ///
    /// Returns: A JSValue containing the parsed value, or NULL if the input is invalid.
    #[doc(alias = "JSValueMakeFromJSONString")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn from_json_string(ctx: JSContextRef, string: JSStringRef) -> JSValueRef {
        extern "C-unwind" {
            fn JSValueMakeFromJSONString(ctx: JSContextRef, string: JSStringRef) -> JSValueRef;
        }
        unsafe { JSValueMakeFromJSONString(ctx, string) }
    }

    /// Creates a JavaScript string containing the JSON serialized representation of a JS value.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The value to serialize.
    ///
    /// Parameter `indent`: The number of spaces to indent when nesting.  If 0, the resulting JSON will not contains newlines.  The size of the indent is clamped to 10 spaces.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: A JSString with the result of serialization, or NULL if an exception is thrown.
    #[doc(alias = "JSValueCreateJSONString")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn create_json_string(
        ctx: JSContextRef,
        value: JSValueRef,
        indent: c_uint,
        exception: *mut JSValueRef,
    ) -> JSStringRef {
        extern "C-unwind" {
            fn JSValueCreateJSONString(
                ctx: JSContextRef,
                value: JSValueRef,
                indent: c_uint,
                exception: *mut JSValueRef,
            ) -> JSStringRef;
        }
        unsafe { JSValueCreateJSONString(ctx, value, indent, exception) }
    }

    /// Converts a JavaScript value to boolean and returns the resulting boolean.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to convert.
    ///
    /// Returns: The boolean result of conversion.
    #[doc(alias = "JSValueToBoolean")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn to_boolean(ctx: JSContextRef, value: JSValueRef) -> bool {
        extern "C-unwind" {
            fn JSValueToBoolean(ctx: JSContextRef, value: JSValueRef) -> bool;
        }
        unsafe { JSValueToBoolean(ctx, value) }
    }

    /// Converts a JavaScript value to number and returns the resulting number.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to convert.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: The numeric result of conversion, or NaN if an exception is thrown.
    ///
    /// The result is equivalent to `Number(value)` in JavaScript.
    #[doc(alias = "JSValueToNumber")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn to_number(
        ctx: JSContextRef,
        value: JSValueRef,
        exception: *mut JSValueRef,
    ) -> c_double {
        extern "C-unwind" {
            fn JSValueToNumber(
                ctx: JSContextRef,
                value: JSValueRef,
                exception: *mut JSValueRef,
            ) -> c_double;
        }
        unsafe { JSValueToNumber(ctx, value, exception) }
    }

    /// Converts a JSValue to a singed 32-bit integer and returns the resulting integer.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to convert.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: An int32_t with the result of conversion, or 0 if an exception is thrown. Since 0 is valid value, `exception` must be checked after the call.
    ///
    /// The JSValue is converted to an integer according to the rules specified by the JavaScript language. If the value is a BigInt, then the JSValue is truncated to an int32_t.
    #[doc(alias = "JSValueToInt32")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn to_int32(
        ctx: JSContextRef,
        value: JSValueRef,
        exception: *mut JSValueRef,
    ) -> i32 {
        extern "C-unwind" {
            fn JSValueToInt32(
                ctx: JSContextRef,
                value: JSValueRef,
                exception: *mut JSValueRef,
            ) -> i32;
        }
        unsafe { JSValueToInt32(ctx, value, exception) }
    }

    /// Converts a JSValue to an unsigned 32-bit integer and returns the resulting integer.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to convert.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: A uint32_t with the result of conversion, or 0 if an exception is thrown. Since 0 is valid value, `exception` must be checked after the call.
    ///
    /// The JSValue is converted to an integer according to the rules specified by the JavaScript language. If the value is a BigInt, then the JSValue is truncated to a uint32_t.
    #[doc(alias = "JSValueToUInt32")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn to_u_int32(
        ctx: JSContextRef,
        value: JSValueRef,
        exception: *mut JSValueRef,
    ) -> u32 {
        extern "C-unwind" {
            fn JSValueToUInt32(
                ctx: JSContextRef,
                value: JSValueRef,
                exception: *mut JSValueRef,
            ) -> u32;
        }
        unsafe { JSValueToUInt32(ctx, value, exception) }
    }

    /// Converts a JSValue to a singed 64-bit integer and returns the resulting integer.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to convert.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: An int64_t with the result of conversion, or 0 if an exception is thrown. Since 0 is valid value, `exception` must be checked after the call.
    ///
    /// The JSValue is converted to an integer according to the rules specified by the JavaScript language. If the value is a BigInt, then the JSValue is truncated to an int64_t.
    #[doc(alias = "JSValueToInt64")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn to_int64(
        ctx: JSContextRef,
        value: JSValueRef,
        exception: *mut JSValueRef,
    ) -> i64 {
        extern "C-unwind" {
            fn JSValueToInt64(
                ctx: JSContextRef,
                value: JSValueRef,
                exception: *mut JSValueRef,
            ) -> i64;
        }
        unsafe { JSValueToInt64(ctx, value, exception) }
    }

    /// Converts a JSValue to an unsigned 64-bit integer and returns the resulting integer.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to convert.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: A uint64_t with the result of conversion, or 0 if an exception is thrown. Since 0 is valid value, `exception` must be checked after the call.
    ///
    /// The JSValue is converted to an integer according to the rules specified by the JavaScript language. If the value is a BigInt, then the JSValue is truncated to a uint64_t.
    #[doc(alias = "JSValueToUInt64")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn to_u_int64(
        ctx: JSContextRef,
        value: JSValueRef,
        exception: *mut JSValueRef,
    ) -> u64 {
        extern "C-unwind" {
            fn JSValueToUInt64(
                ctx: JSContextRef,
                value: JSValueRef,
                exception: *mut JSValueRef,
            ) -> u64;
        }
        unsafe { JSValueToUInt64(ctx, value, exception) }
    }

    /// Converts a JavaScript value to string and copies the result into a JavaScript string.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to convert.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: A JSString with the result of conversion, or NULL if an exception is thrown. Ownership follows the Create Rule.
    #[doc(alias = "JSValueToStringCopy")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn to_string_copy(
        ctx: JSContextRef,
        value: JSValueRef,
        exception: *mut JSValueRef,
    ) -> JSStringRef {
        extern "C-unwind" {
            fn JSValueToStringCopy(
                ctx: JSContextRef,
                value: JSValueRef,
                exception: *mut JSValueRef,
            ) -> JSStringRef;
        }
        unsafe { JSValueToStringCopy(ctx, value, exception) }
    }

    /// Converts a JavaScript value to object and returns the resulting object.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to convert.
    ///
    /// Parameter `exception`: A pointer to a JSValueRef in which to store an exception, if any. To reliable detect exception, initialize this to null before the call. Pass NULL if you do not care to store an exception.
    ///
    /// Returns: The JSObject result of conversion, or NULL if an exception is thrown.
    #[doc(alias = "JSValueToObject")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn to_object(
        ctx: JSContextRef,
        value: JSValueRef,
        exception: *mut JSValueRef,
    ) -> JSObjectRef {
        extern "C-unwind" {
            fn JSValueToObject(
                ctx: JSContextRef,
                value: JSValueRef,
                exception: *mut JSValueRef,
            ) -> JSObjectRef;
        }
        unsafe { JSValueToObject(ctx, value, exception) }
    }

    /// Protects a JavaScript value from garbage collection.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to protect.
    ///
    /// Use this method when you want to store a JSValue in a global or on the heap, where the garbage collector will not be able to discover your reference to it.
    ///
    /// A value may be protected multiple times and must be unprotected an equal number of times before becoming eligible for garbage collection.
    #[doc(alias = "JSValueProtect")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn protect(ctx: JSContextRef, value: JSValueRef) {
        extern "C-unwind" {
            fn JSValueProtect(ctx: JSContextRef, value: JSValueRef);
        }
        unsafe { JSValueProtect(ctx, value) }
    }

    /// Unprotects a JavaScript value from garbage collection.
    ///
    /// Parameter `ctx`: The execution context to use.
    ///
    /// Parameter `value`: The JSValue to unprotect.
    ///
    /// A value may be protected multiple times and must be unprotected an
    /// equal number of times before becoming eligible for garbage collection.
    #[doc(alias = "JSValueUnprotect")]
    #[cfg(feature = "JSBase")]
    #[inline]
    pub unsafe fn unprotect(ctx: JSContextRef, value: JSValueRef) {
        extern "C-unwind" {
            fn JSValueUnprotect(ctx: JSContextRef, value: JSValueRef);
        }
        unsafe { JSValueUnprotect(ctx, value) }
    }
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::type`"]
    pub fn JSValueGetType(ctx: JSContextRef, value: JSValueRef) -> JSType;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_undefined`"]
    pub fn JSValueIsUndefined(ctx: JSContextRef, value: JSValueRef) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_null`"]
    pub fn JSValueIsNull(ctx: JSContextRef, value: JSValueRef) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_boolean`"]
    pub fn JSValueIsBoolean(ctx: JSContextRef, value: JSValueRef) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_number`"]
    pub fn JSValueIsNumber(ctx: JSContextRef, value: JSValueRef) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_string`"]
    pub fn JSValueIsString(ctx: JSContextRef, value: JSValueRef) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_symbol`"]
    pub fn JSValueIsSymbol(ctx: JSContextRef, value: JSValueRef) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_big_int`"]
    pub fn JSValueIsBigInt(ctx: JSContextRef, value: JSValueRef) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_object`"]
    pub fn JSValueIsObject(ctx: JSContextRef, value: JSValueRef) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_object_of_class`"]
    pub fn JSValueIsObjectOfClass(
        ctx: JSContextRef,
        value: JSValueRef,
        js_class: JSClassRef,
    ) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_array`"]
    pub fn JSValueIsArray(ctx: JSContextRef, value: JSValueRef) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_date`"]
    pub fn JSValueIsDate(ctx: JSContextRef, value: JSValueRef) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::typed_array_type`"]
    pub fn JSValueGetTypedArrayType(
        ctx: JSContextRef,
        value: JSValueRef,
        exception: *mut JSValueRef,
    ) -> JSTypedArrayType;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_equal`"]
    pub fn JSValueIsEqual(
        ctx: JSContextRef,
        a: JSValueRef,
        b: JSValueRef,
        exception: *mut JSValueRef,
    ) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_strict_equal`"]
    pub fn JSValueIsStrictEqual(ctx: JSContextRef, a: JSValueRef, b: JSValueRef) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::is_instance_of_constructor`"]
    pub fn JSValueIsInstanceOfConstructor(
        ctx: JSContextRef,
        value: JSValueRef,
        constructor: JSObjectRef,
        exception: *mut JSValueRef,
    ) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::compare`"]
    pub fn JSValueCompare(
        ctx: JSContextRef,
        left: JSValueRef,
        right: JSValueRef,
        exception: *mut JSValueRef,
    ) -> JSRelationCondition;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::compare_int64`"]
    pub fn JSValueCompareInt64(
        ctx: JSContextRef,
        left: JSValueRef,
        right: i64,
        exception: *mut JSValueRef,
    ) -> JSRelationCondition;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::compare_u_int64`"]
    pub fn JSValueCompareUInt64(
        ctx: JSContextRef,
        left: JSValueRef,
        right: u64,
        exception: *mut JSValueRef,
    ) -> JSRelationCondition;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::compare_double`"]
    pub fn JSValueCompareDouble(
        ctx: JSContextRef,
        left: JSValueRef,
        right: c_double,
        exception: *mut JSValueRef,
    ) -> JSRelationCondition;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::new_undefined`"]
    pub fn JSValueMakeUndefined(ctx: JSContextRef) -> JSValueRef;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::new_null`"]
    pub fn JSValueMakeNull(ctx: JSContextRef) -> JSValueRef;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::new_boolean`"]
    pub fn JSValueMakeBoolean(ctx: JSContextRef, boolean: bool) -> JSValueRef;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::new_number`"]
    pub fn JSValueMakeNumber(ctx: JSContextRef, number: c_double) -> JSValueRef;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::new_string`"]
    pub fn JSValueMakeString(ctx: JSContextRef, string: JSStringRef) -> JSValueRef;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::new_symbol`"]
    pub fn JSValueMakeSymbol(ctx: JSContextRef, description: JSStringRef) -> JSValueRef;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::from_json_string`"]
    pub fn JSValueMakeFromJSONString(ctx: JSContextRef, string: JSStringRef) -> JSValueRef;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::create_json_string`"]
    pub fn JSValueCreateJSONString(
        ctx: JSContextRef,
        value: JSValueRef,
        indent: c_uint,
        exception: *mut JSValueRef,
    ) -> JSStringRef;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::to_boolean`"]
    pub fn JSValueToBoolean(ctx: JSContextRef, value: JSValueRef) -> bool;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::to_number`"]
    pub fn JSValueToNumber(
        ctx: JSContextRef,
        value: JSValueRef,
        exception: *mut JSValueRef,
    ) -> c_double;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::to_int32`"]
    pub fn JSValueToInt32(ctx: JSContextRef, value: JSValueRef, exception: *mut JSValueRef) -> i32;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::to_u_int32`"]
    pub fn JSValueToUInt32(ctx: JSContextRef, value: JSValueRef, exception: *mut JSValueRef)
        -> u32;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::to_int64`"]
    pub fn JSValueToInt64(ctx: JSContextRef, value: JSValueRef, exception: *mut JSValueRef) -> i64;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::to_u_int64`"]
    pub fn JSValueToUInt64(ctx: JSContextRef, value: JSValueRef, exception: *mut JSValueRef)
        -> u64;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::to_string_copy`"]
    pub fn JSValueToStringCopy(
        ctx: JSContextRef,
        value: JSValueRef,
        exception: *mut JSValueRef,
    ) -> JSStringRef;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::to_object`"]
    pub fn JSValueToObject(
        ctx: JSContextRef,
        value: JSValueRef,
        exception: *mut JSValueRef,
    ) -> JSObjectRef;
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::protect`"]
    pub fn JSValueProtect(ctx: JSContextRef, value: JSValueRef);
}

extern "C-unwind" {
    #[cfg(feature = "JSBase")]
    #[deprecated = "renamed to `JSValue::unprotect`"]
    pub fn JSValueUnprotect(ctx: JSContextRef, value: JSValueRef);
}