koffi 0.9.1 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CMakeLists.txt +2 -36
- package/package.json +3 -3
- package/vendor/dragonbox/CMakeLists.txt +123 -0
- package/vendor/dragonbox/LICENSE-Apache2-LLVM +218 -0
- package/vendor/dragonbox/LICENSE-Boost +23 -0
- package/vendor/dragonbox/README.md +277 -0
- package/vendor/dragonbox/cmake/dragonboxConfig.cmake +1 -0
- package/vendor/dragonbox/include/dragonbox/dragonbox.h +2670 -0
- package/vendor/dragonbox/include/dragonbox/dragonbox_to_chars.h +108 -0
- package/vendor/dragonbox/other_files/Dragonbox.pdf +0 -0
- package/vendor/dragonbox/other_files/Dragonbox_old.pdf +0 -0
- package/vendor/dragonbox/other_files/milo_benchmark.png +0 -0
- package/vendor/dragonbox/other_files/unknown_win64_vc2019.html +540 -0
- package/vendor/dragonbox/other_files/unknown_win64_vc2019_randomdigit_time.png +0 -0
- package/vendor/dragonbox/source/dragonbox_to_chars.cpp +303 -0
- package/vendor/dragonbox/subproject/3rdparty/grisu_exact/CMakeLists.txt +24 -0
- package/vendor/dragonbox/subproject/3rdparty/grisu_exact/fp_to_chars.cpp +238 -0
- package/vendor/dragonbox/subproject/3rdparty/grisu_exact/fp_to_chars.h +95 -0
- package/vendor/dragonbox/subproject/3rdparty/grisu_exact/grisu_exact.h +2666 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/CMakeLists.txt +16 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/common.h +114 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s.c +509 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s_full_table.h +367 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/d2s_intrinsics.h +357 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/digit_table.h +35 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s.c +345 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s_full_table.h +55 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/f2s_intrinsics.h +128 -0
- package/vendor/dragonbox/subproject/3rdparty/ryu/ryu/ryu.h +46 -0
- package/vendor/dragonbox/subproject/3rdparty/schubfach/CMakeLists.txt +22 -0
- package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_32.cc +699 -0
- package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_32.h +31 -0
- package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_64.cc +1354 -0
- package/vendor/dragonbox/subproject/3rdparty/schubfach/schubfach_64.h +31 -0
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/example_shaded_plots.m +68 -0
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/license.txt +25 -0
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_distribution.m +92 -0
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_distribution_prctile.m +121 -0
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_histogram_shaded.m +99 -0
- package/vendor/dragonbox/subproject/3rdparty/shaded_plots/plot_shaded.m +93 -0
- package/vendor/dragonbox/subproject/benchmark/CMakeLists.txt +65 -0
- package/vendor/dragonbox/subproject/benchmark/include/benchmark.h +40 -0
- package/vendor/dragonbox/subproject/benchmark/matlab/plot_benchmarks.m +22 -0
- package/vendor/dragonbox/subproject/benchmark/matlab/plot_digit_benchmark.m +78 -0
- package/vendor/dragonbox/subproject/benchmark/matlab/plot_uniform_benchmark.m +95 -0
- package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary32_clang.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary32_msvc.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary64_clang.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/digits_benchmark_binary64_msvc.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary32_clang.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary32_msvc.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary64_clang.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/results/uniform_benchmark_binary64_msvc.png +0 -0
- package/vendor/dragonbox/subproject/benchmark/source/benchmark.cpp +238 -0
- package/vendor/dragonbox/subproject/benchmark/source/dragonbox.cpp +30 -0
- package/vendor/dragonbox/subproject/benchmark/source/grisu_exact.cpp +36 -0
- package/vendor/dragonbox/subproject/benchmark/source/ryu.cpp +27 -0
- package/vendor/dragonbox/subproject/benchmark/source/schubfach.cpp +31 -0
- package/vendor/dragonbox/subproject/common/CMakeLists.txt +42 -0
- package/vendor/dragonbox/subproject/common/include/best_rational_approx.h +97 -0
- package/vendor/dragonbox/subproject/common/include/big_uint.h +218 -0
- package/vendor/dragonbox/subproject/common/include/continued_fractions.h +174 -0
- package/vendor/dragonbox/subproject/common/include/good_rational_approx.h +267 -0
- package/vendor/dragonbox/subproject/common/include/random_float.h +182 -0
- package/vendor/dragonbox/subproject/common/include/rational_continued_fractions.h +57 -0
- package/vendor/dragonbox/subproject/common/source/big_uint.cpp +602 -0
- package/vendor/dragonbox/subproject/meta/CMakeLists.txt +41 -0
- package/vendor/dragonbox/subproject/meta/results/binary32_generated_cache.txt +82 -0
- package/vendor/dragonbox/subproject/meta/results/binary64_compressed_cache_error_table.txt +10 -0
- package/vendor/dragonbox/subproject/meta/results/binary64_generated_cache.txt +623 -0
- package/vendor/dragonbox/subproject/meta/source/generate_cache.cpp +126 -0
- package/vendor/dragonbox/subproject/meta/source/live_test.cpp +81 -0
- package/vendor/dragonbox/subproject/meta/source/perf_test.cpp +104 -0
- package/vendor/dragonbox/subproject/meta/source/sandbox.cpp +20 -0
- package/vendor/dragonbox/subproject/test/CMakeLists.txt +70 -0
- package/vendor/dragonbox/subproject/test/results/binary32.csv +255 -0
- package/vendor/dragonbox/subproject/test/results/binary64.csv +2047 -0
- package/vendor/dragonbox/subproject/test/results/plot_required_bits.m +18 -0
- package/vendor/dragonbox/subproject/test/source/test_all_shorter_interval_cases.cpp +88 -0
- package/vendor/dragonbox/subproject/test/source/uniform_random_test.cpp +95 -0
- package/vendor/dragonbox/subproject/test/source/verify_cache_precision.cpp +338 -0
- package/vendor/dragonbox/subproject/test/source/verify_compressed_cache.cpp +154 -0
- package/vendor/dragonbox/subproject/test/source/verify_fast_multiplication.cpp +168 -0
- package/vendor/dragonbox/subproject/test/source/verify_log_computation.cpp +251 -0
- package/vendor/dragonbox/subproject/test/source/verify_magic_division.cpp +113 -0
- package/vendor/libcc/libcc.cc +7651 -0
- package/vendor/libcc/libcc.hh +4312 -0
- package/vendor/node-addon-api/CHANGELOG.md +859 -0
- package/vendor/node-addon-api/CODE_OF_CONDUCT.md +4 -0
- package/vendor/node-addon-api/CONTRIBUTING.md +93 -0
- package/vendor/node-addon-api/LICENSE.md +13 -0
- package/vendor/node-addon-api/README.md +293 -0
- package/vendor/node-addon-api/appveyor.yml +37 -0
- package/vendor/node-addon-api/benchmark/README.md +47 -0
- package/vendor/node-addon-api/benchmark/binding.gyp +25 -0
- package/vendor/node-addon-api/benchmark/function_args.cc +217 -0
- package/vendor/node-addon-api/benchmark/function_args.js +60 -0
- package/vendor/node-addon-api/benchmark/index.js +34 -0
- package/vendor/node-addon-api/benchmark/property_descriptor.cc +91 -0
- package/vendor/node-addon-api/benchmark/property_descriptor.js +37 -0
- package/vendor/node-addon-api/common.gypi +21 -0
- package/vendor/node-addon-api/doc/addon.md +163 -0
- package/vendor/node-addon-api/doc/array.md +81 -0
- package/vendor/node-addon-api/doc/array_buffer.md +155 -0
- package/vendor/node-addon-api/doc/async_context.md +86 -0
- package/vendor/node-addon-api/doc/async_operations.md +31 -0
- package/vendor/node-addon-api/doc/async_worker.md +427 -0
- package/vendor/node-addon-api/doc/async_worker_variants.md +557 -0
- package/vendor/node-addon-api/doc/bigint.md +97 -0
- package/vendor/node-addon-api/doc/boolean.md +68 -0
- package/vendor/node-addon-api/doc/buffer.md +150 -0
- package/vendor/node-addon-api/doc/callback_scope.md +54 -0
- package/vendor/node-addon-api/doc/callbackinfo.md +97 -0
- package/vendor/node-addon-api/doc/checker-tool.md +32 -0
- package/vendor/node-addon-api/doc/class_property_descriptor.md +115 -0
- package/vendor/node-addon-api/doc/cmake-js.md +68 -0
- package/vendor/node-addon-api/doc/conversion-tool.md +28 -0
- package/vendor/node-addon-api/doc/creating_a_release.md +62 -0
- package/vendor/node-addon-api/doc/dataview.md +248 -0
- package/vendor/node-addon-api/doc/date.md +68 -0
- package/vendor/node-addon-api/doc/env.md +196 -0
- package/vendor/node-addon-api/doc/error.md +120 -0
- package/vendor/node-addon-api/doc/error_handling.md +254 -0
- package/vendor/node-addon-api/doc/escapable_handle_scope.md +80 -0
- package/vendor/node-addon-api/doc/external.md +63 -0
- package/vendor/node-addon-api/doc/function.md +402 -0
- package/vendor/node-addon-api/doc/function_reference.md +238 -0
- package/vendor/node-addon-api/doc/generator.md +13 -0
- package/vendor/node-addon-api/doc/handle_scope.md +63 -0
- package/vendor/node-addon-api/doc/hierarchy.md +91 -0
- package/vendor/node-addon-api/doc/instance_wrap.md +408 -0
- package/vendor/node-addon-api/doc/maybe.md +76 -0
- package/vendor/node-addon-api/doc/memory_management.md +27 -0
- package/vendor/node-addon-api/doc/name.md +29 -0
- package/vendor/node-addon-api/doc/node-gyp.md +82 -0
- package/vendor/node-addon-api/doc/number.md +163 -0
- package/vendor/node-addon-api/doc/object.md +432 -0
- package/vendor/node-addon-api/doc/object_lifetime_management.md +83 -0
- package/vendor/node-addon-api/doc/object_reference.md +117 -0
- package/vendor/node-addon-api/doc/object_wrap.md +561 -0
- package/vendor/node-addon-api/doc/prebuild_tools.md +16 -0
- package/vendor/node-addon-api/doc/promises.md +79 -0
- package/vendor/node-addon-api/doc/property_descriptor.md +286 -0
- package/vendor/node-addon-api/doc/propertylvalue.md +50 -0
- package/vendor/node-addon-api/doc/range_error.md +59 -0
- package/vendor/node-addon-api/doc/reference.md +113 -0
- package/vendor/node-addon-api/doc/setup.md +110 -0
- package/vendor/node-addon-api/doc/string.md +93 -0
- package/vendor/node-addon-api/doc/symbol.md +61 -0
- package/vendor/node-addon-api/doc/threadsafe.md +121 -0
- package/vendor/node-addon-api/doc/threadsafe_function.md +290 -0
- package/vendor/node-addon-api/doc/type_error.md +59 -0
- package/vendor/node-addon-api/doc/typed_array.md +78 -0
- package/vendor/node-addon-api/doc/typed_array_of.md +137 -0
- package/vendor/node-addon-api/doc/typed_threadsafe_function.md +306 -0
- package/vendor/node-addon-api/doc/value.md +340 -0
- package/vendor/node-addon-api/doc/version_management.md +43 -0
- package/vendor/node-addon-api/except.gypi +25 -0
- package/vendor/node-addon-api/index.js +11 -0
- package/vendor/node-addon-api/napi-inl.deprecated.h +192 -0
- package/vendor/node-addon-api/napi-inl.h +6209 -0
- package/vendor/node-addon-api/napi.h +2983 -0
- package/vendor/node-addon-api/node_api.gyp +9 -0
- package/vendor/node-addon-api/noexcept.gypi +26 -0
- package/vendor/node-addon-api/nothing.c +0 -0
- package/vendor/node-addon-api/package-support.json +21 -0
- package/vendor/node-addon-api/package.json +399 -0
- package/vendor/node-addon-api/test/README.md +91 -0
- package/vendor/node-addon-api/test/addon.cc +36 -0
- package/vendor/node-addon-api/test/addon.js +11 -0
- package/vendor/node-addon-api/test/addon_build/index.js +49 -0
- package/vendor/node-addon-api/test/addon_build/tpl/addon.cc +17 -0
- package/vendor/node-addon-api/test/addon_build/tpl/binding.gyp +62 -0
- package/vendor/node-addon-api/test/addon_build/tpl/index.js +9 -0
- package/vendor/node-addon-api/test/addon_build/tpl/package.json +11 -0
- package/vendor/node-addon-api/test/addon_data.cc +99 -0
- package/vendor/node-addon-api/test/addon_data.js +46 -0
- package/vendor/node-addon-api/test/array_buffer.cc +243 -0
- package/vendor/node-addon-api/test/array_buffer.js +69 -0
- package/vendor/node-addon-api/test/async_context.cc +21 -0
- package/vendor/node-addon-api/test/async_context.js +86 -0
- package/vendor/node-addon-api/test/async_progress_queue_worker.cc +83 -0
- package/vendor/node-addon-api/test/async_progress_queue_worker.js +46 -0
- package/vendor/node-addon-api/test/async_progress_worker.cc +134 -0
- package/vendor/node-addon-api/test/async_progress_worker.js +61 -0
- package/vendor/node-addon-api/test/async_worker.cc +106 -0
- package/vendor/node-addon-api/test/async_worker.js +179 -0
- package/vendor/node-addon-api/test/async_worker_nocallback.js +13 -0
- package/vendor/node-addon-api/test/async_worker_persistent.cc +63 -0
- package/vendor/node-addon-api/test/async_worker_persistent.js +24 -0
- package/vendor/node-addon-api/test/basic_types/array.cc +40 -0
- package/vendor/node-addon-api/test/basic_types/array.js +35 -0
- package/vendor/node-addon-api/test/basic_types/boolean.cc +38 -0
- package/vendor/node-addon-api/test/basic_types/boolean.js +35 -0
- package/vendor/node-addon-api/test/basic_types/number.cc +99 -0
- package/vendor/node-addon-api/test/basic_types/number.js +114 -0
- package/vendor/node-addon-api/test/basic_types/value.cc +120 -0
- package/vendor/node-addon-api/test/basic_types/value.js +133 -0
- package/vendor/node-addon-api/test/bigint.cc +91 -0
- package/vendor/node-addon-api/test/bigint.js +53 -0
- package/vendor/node-addon-api/test/binding-swallowexcept.cc +12 -0
- package/vendor/node-addon-api/test/binding.cc +171 -0
- package/vendor/node-addon-api/test/binding.gyp +117 -0
- package/vendor/node-addon-api/test/buffer.cc +183 -0
- package/vendor/node-addon-api/test/buffer.js +69 -0
- package/vendor/node-addon-api/test/callbackscope.cc +22 -0
- package/vendor/node-addon-api/test/callbackscope.js +49 -0
- package/vendor/node-addon-api/test/common/index.js +113 -0
- package/vendor/node-addon-api/test/common/test_helper.h +61 -0
- package/vendor/node-addon-api/test/dataview/dataview.cc +48 -0
- package/vendor/node-addon-api/test/dataview/dataview.js +35 -0
- package/vendor/node-addon-api/test/dataview/dataview_read_write.cc +115 -0
- package/vendor/node-addon-api/test/dataview/dataview_read_write.js +90 -0
- package/vendor/node-addon-api/test/date.cc +44 -0
- package/vendor/node-addon-api/test/date.js +18 -0
- package/vendor/node-addon-api/test/env_cleanup.cc +88 -0
- package/vendor/node-addon-api/test/env_cleanup.js +56 -0
- package/vendor/node-addon-api/test/error.cc +287 -0
- package/vendor/node-addon-api/test/error.js +81 -0
- package/vendor/node-addon-api/test/error_handling_for_primitives.cc +13 -0
- package/vendor/node-addon-api/test/error_handling_for_primitives.js +29 -0
- package/vendor/node-addon-api/test/error_terminating_environment.js +94 -0
- package/vendor/node-addon-api/test/external.cc +81 -0
- package/vendor/node-addon-api/test/external.js +88 -0
- package/vendor/node-addon-api/test/function.cc +295 -0
- package/vendor/node-addon-api/test/function.js +121 -0
- package/vendor/node-addon-api/test/function_reference.cc +202 -0
- package/vendor/node-addon-api/test/function_reference.js +157 -0
- package/vendor/node-addon-api/test/globalObject/global_object.cc +61 -0
- package/vendor/node-addon-api/test/globalObject/global_object_delete_property.cc +31 -0
- package/vendor/node-addon-api/test/globalObject/global_object_delete_property.js +61 -0
- package/vendor/node-addon-api/test/globalObject/global_object_get_property.cc +40 -0
- package/vendor/node-addon-api/test/globalObject/global_object_get_property.js +57 -0
- package/vendor/node-addon-api/test/globalObject/global_object_has_own_property.cc +28 -0
- package/vendor/node-addon-api/test/globalObject/global_object_has_own_property.js +48 -0
- package/vendor/node-addon-api/test/globalObject/global_object_set_property.cc +31 -0
- package/vendor/node-addon-api/test/globalObject/global_object_set_property.js +58 -0
- package/vendor/node-addon-api/test/handlescope.cc +60 -0
- package/vendor/node-addon-api/test/handlescope.js +14 -0
- package/vendor/node-addon-api/test/index.js +136 -0
- package/vendor/node-addon-api/test/maybe/check.cc +23 -0
- package/vendor/node-addon-api/test/maybe/index.js +38 -0
- package/vendor/node-addon-api/test/memory_management.cc +17 -0
- package/vendor/node-addon-api/test/memory_management.js +9 -0
- package/vendor/node-addon-api/test/movable_callbacks.cc +23 -0
- package/vendor/node-addon-api/test/movable_callbacks.js +21 -0
- package/vendor/node-addon-api/test/name.cc +108 -0
- package/vendor/node-addon-api/test/name.js +59 -0
- package/vendor/node-addon-api/test/napi_child.js +14 -0
- package/vendor/node-addon-api/test/object/delete_property.cc +38 -0
- package/vendor/node-addon-api/test/object/delete_property.js +41 -0
- package/vendor/node-addon-api/test/object/finalizer.cc +29 -0
- package/vendor/node-addon-api/test/object/finalizer.js +28 -0
- package/vendor/node-addon-api/test/object/get_property.cc +34 -0
- package/vendor/node-addon-api/test/object/get_property.js +40 -0
- package/vendor/node-addon-api/test/object/has_own_property.cc +34 -0
- package/vendor/node-addon-api/test/object/has_own_property.js +34 -0
- package/vendor/node-addon-api/test/object/has_property.cc +38 -0
- package/vendor/node-addon-api/test/object/has_property.js +37 -0
- package/vendor/node-addon-api/test/object/object.cc +348 -0
- package/vendor/node-addon-api/test/object/object.js +217 -0
- package/vendor/node-addon-api/test/object/object_deprecated.cc +66 -0
- package/vendor/node-addon-api/test/object/object_deprecated.js +47 -0
- package/vendor/node-addon-api/test/object/object_freeze_seal.cc +25 -0
- package/vendor/node-addon-api/test/object/object_freeze_seal.js +61 -0
- package/vendor/node-addon-api/test/object/set_property.cc +37 -0
- package/vendor/node-addon-api/test/object/set_property.js +29 -0
- package/vendor/node-addon-api/test/object/subscript_operator.cc +42 -0
- package/vendor/node-addon-api/test/object/subscript_operator.js +17 -0
- package/vendor/node-addon-api/test/object_reference.cc +219 -0
- package/vendor/node-addon-api/test/object_reference.js +259 -0
- package/vendor/node-addon-api/test/objectwrap.cc +268 -0
- package/vendor/node-addon-api/test/objectwrap.js +284 -0
- package/vendor/node-addon-api/test/objectwrap_constructor_exception.cc +26 -0
- package/vendor/node-addon-api/test/objectwrap_constructor_exception.js +18 -0
- package/vendor/node-addon-api/test/objectwrap_multiple_inheritance.cc +30 -0
- package/vendor/node-addon-api/test/objectwrap_multiple_inheritance.js +13 -0
- package/vendor/node-addon-api/test/objectwrap_removewrap.cc +45 -0
- package/vendor/node-addon-api/test/objectwrap_removewrap.js +40 -0
- package/vendor/node-addon-api/test/objectwrap_worker_thread.js +19 -0
- package/vendor/node-addon-api/test/promise.cc +29 -0
- package/vendor/node-addon-api/test/promise.js +18 -0
- package/vendor/node-addon-api/test/reference.cc +24 -0
- package/vendor/node-addon-api/test/reference.js +14 -0
- package/vendor/node-addon-api/test/run_script.cc +56 -0
- package/vendor/node-addon-api/test/run_script.js +45 -0
- package/vendor/node-addon-api/test/symbol.cc +79 -0
- package/vendor/node-addon-api/test/symbol.js +73 -0
- package/vendor/node-addon-api/test/testUtil.js +54 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function.cc +195 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function.js +188 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_ctx.cc +63 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_ctx.js +12 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_existing_tsfn.cc +115 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_existing_tsfn.js +14 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_ptr.cc +26 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_ptr.js +7 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_sum.cc +225 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_sum.js +59 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_unref.cc +42 -0
- package/vendor/node-addon-api/test/threadsafe_function/threadsafe_function_unref.js +53 -0
- package/vendor/node-addon-api/test/thunking_manual.cc +140 -0
- package/vendor/node-addon-api/test/thunking_manual.js +17 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function.cc +215 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function.js +188 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_ctx.cc +68 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_ctx.js +12 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_existing_tsfn.cc +127 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_existing_tsfn.js +14 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_ptr.cc +28 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_ptr.js +7 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_sum.cc +237 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_sum.js +59 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_unref.cc +53 -0
- package/vendor/node-addon-api/test/typed_threadsafe_function/typed_threadsafe_function_unref.js +53 -0
- package/vendor/node-addon-api/test/typedarray-bigint.js +58 -0
- package/vendor/node-addon-api/test/typedarray.cc +216 -0
- package/vendor/node-addon-api/test/typedarray.js +69 -0
- package/vendor/node-addon-api/test/version_management.cc +27 -0
- package/vendor/node-addon-api/test/version_management.js +31 -0
- package/vendor/node-addon-api/tools/README.md +73 -0
- package/vendor/node-addon-api/tools/check-napi.js +100 -0
- package/vendor/node-addon-api/tools/clang-format.js +68 -0
- package/vendor/node-addon-api/tools/conversion.js +309 -0
- package/vendor/node-addon-api/tools/eslint-format.js +71 -0
- package/build/ALL_BUILD.vcxproj +0 -190
- package/build/ALL_BUILD.vcxproj.filters +0 -8
- package/build/CMakeCache.txt +0 -429
- package/build/CMakeFiles/3.23.0-rc1/CMakeASMCompiler.cmake +0 -20
- package/build/CMakeFiles/3.23.0-rc1/CMakeASM_MASMCompiler.cmake +0 -20
- package/build/CMakeFiles/3.23.0-rc1/CMakeCCompiler.cmake +0 -72
- package/build/CMakeFiles/3.23.0-rc1/CMakeCXXCompiler.cmake +0 -83
- package/build/CMakeFiles/3.23.0-rc1/CMakeDetermineCompilerABI_C.bin +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CMakeDetermineCompilerABI_CXX.bin +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CMakeRCCompiler.cmake +0 -6
- package/build/CMakeFiles/3.23.0-rc1/CMakeSystem.cmake +0 -15
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/CMakeCCompilerId.c +0 -828
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/CompilerIdC.exe +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/CompilerIdC.vcxproj +0 -71
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CMakeCCompilerId.obj +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.exe.recipe +0 -11
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/CL.command.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/CL.read.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/CL.write.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/CompilerIdC.lastbuildstate +0 -2
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/link.command.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/link.read.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdC/Debug/CompilerIdC.tlog/link.write.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/CMakeCXXCompilerId.cpp +0 -816
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/CompilerIdCXX.exe +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/CompilerIdCXX.vcxproj +0 -71
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CMakeCXXCompilerId.obj +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.exe.recipe +0 -11
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.command.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.read.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CL.write.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/CompilerIdCXX.lastbuildstate +0 -2
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.command.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.read.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/CompilerIdCXX/Debug/CompilerIdCXX.tlog/link.write.1.tlog +0 -0
- package/build/CMakeFiles/3.23.0-rc1/VCTargetsPath.txt +0 -1
- package/build/CMakeFiles/3.23.0-rc1/VCTargetsPath.vcxproj +0 -31
- package/build/CMakeFiles/3.23.0-rc1/x64/Debug/VCTargetsPath.recipe +0 -11
- package/build/CMakeFiles/3.23.0-rc1/x64/Debug/VCTargetsPath.tlog/VCTargetsPath.lastbuildstate +0 -2
- package/build/CMakeFiles/41bcd16856091d4a38fd1f71fbe2f202/generate.stamp.rule +0 -1
- package/build/CMakeFiles/CMakeError.log +0 -108
- package/build/CMakeFiles/CMakeOutput.log +0 -413
- package/build/CMakeFiles/TargetDirectories.txt +0 -4
- package/build/CMakeFiles/cmake.check_cache +0 -1
- package/build/CMakeFiles/generate.stamp +0 -1
- package/build/CMakeFiles/generate.stamp.depend +0 -28
- package/build/CMakeFiles/generate.stamp.list +0 -1
- package/build/Raylib.dir/Release/Raylib.dll.recipe +0 -14
- package/build/Raylib.dir/Release/Raylib.tlog/CL.command.1.tlog +0 -0
- package/build/Raylib.dir/Release/Raylib.tlog/CL.read.1.tlog +0 -0
- package/build/Raylib.dir/Release/Raylib.tlog/CL.write.1.tlog +0 -0
- package/build/Raylib.dir/Release/Raylib.tlog/CustomBuild.command.1.tlog +0 -10
- package/build/Raylib.dir/Release/Raylib.tlog/CustomBuild.read.1.tlog +0 -27
- package/build/Raylib.dir/Release/Raylib.tlog/CustomBuild.write.1.tlog +0 -2
- package/build/Raylib.dir/Release/Raylib.tlog/Raylib.lastbuildstate +0 -2
- package/build/Raylib.dir/Release/Raylib.tlog/Raylib.write.1u.tlog +0 -0
- package/build/Raylib.dir/Release/Raylib.tlog/link.command.1.tlog +0 -0
- package/build/Raylib.dir/Release/Raylib.tlog/link.read.1.tlog +0 -0
- package/build/Raylib.dir/Release/Raylib.tlog/link.write.1.tlog +0 -0
- package/build/Raylib.dir/Release/raudio.obj +0 -0
- package/build/Raylib.dir/Release/rcore.obj +0 -0
- package/build/Raylib.dir/Release/rglfw.obj +0 -0
- package/build/Raylib.dir/Release/rmodels.obj +0 -0
- package/build/Raylib.dir/Release/rshapes.obj +0 -0
- package/build/Raylib.dir/Release/rtext.obj +0 -0
- package/build/Raylib.dir/Release/rtextures.obj +0 -0
- package/build/Raylib.dir/Release/utils.obj +0 -0
- package/build/Raylib.vcxproj +0 -358
- package/build/Raylib.vcxproj.filters +0 -37
- package/build/Release/Raylib.dll +0 -0
- package/build/Release/Raylib.exp +0 -0
- package/build/Release/Raylib.lib +0 -0
- package/build/Release/koffi.exp +0 -0
- package/build/Release/koffi.lib +0 -0
- package/build/Release/koffi.node +0 -0
- package/build/ZERO_CHECK.vcxproj +0 -176
- package/build/ZERO_CHECK.vcxproj.filters +0 -13
- package/build/cmake_install.cmake +0 -44
- package/build/koffi.dir/Release/call_arm64.obj +0 -0
- package/build/koffi.dir/Release/call_x64_sysv.obj +0 -0
- package/build/koffi.dir/Release/call_x64_win.obj +0 -0
- package/build/koffi.dir/Release/call_x64_win_fwd.obj +0 -0
- package/build/koffi.dir/Release/call_x86.obj +0 -0
- package/build/koffi.dir/Release/ffi.obj +0 -0
- package/build/koffi.dir/Release/koffi.node.recipe +0 -14
- package/build/koffi.dir/Release/koffi.tlog/CL.command.1.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/CL.read.1.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/CL.write.1.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/CustomBuild.command.1.tlog +0 -10
- package/build/koffi.dir/Release/koffi.tlog/CustomBuild.read.1.tlog +0 -27
- package/build/koffi.dir/Release/koffi.tlog/CustomBuild.write.1.tlog +0 -2
- package/build/koffi.dir/Release/koffi.tlog/Masm.read.1u.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/Masm.write.1u.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/koffi.lastbuildstate +0 -2
- package/build/koffi.dir/Release/koffi.tlog/koffi.write.1u.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/link.command.1.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/link.read.1.tlog +0 -0
- package/build/koffi.dir/Release/koffi.tlog/link.write.1.tlog +0 -0
- package/build/koffi.dir/Release/libcc.obj +0 -0
- package/build/koffi.dir/Release/util.obj +0 -0
- package/build/koffi.dir/Release/win_delay_load_hook.obj +0 -0
- package/build/koffi.sln +0 -67
- package/build/koffi.vcxproj +0 -363
- package/build/koffi.vcxproj.filters +0 -40
- package/build/x64/Release/ALL_BUILD/ALL_BUILD.recipe +0 -20
- package/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/ALL_BUILD.lastbuildstate +0 -2
- package/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.command.1.tlog +0 -10
- package/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.read.1.tlog +0 -27
- package/build/x64/Release/ALL_BUILD/ALL_BUILD.tlog/CustomBuild.write.1.tlog +0 -2
- package/build/x64/Release/ZERO_CHECK/ZERO_CHECK.recipe +0 -11
- package/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.command.1.tlog +0 -10
- package/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.read.1.tlog +0 -28
- package/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/CustomBuild.write.1.tlog +0 -2
- package/build/x64/Release/ZERO_CHECK/ZERO_CHECK.tlog/ZERO_CHECK.lastbuildstate +0 -2
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('assert');
|
|
4
|
+
|
|
5
|
+
function test(binding, succeed) {
|
|
6
|
+
return new Promise((resolve) =>
|
|
7
|
+
// Can't pass an arrow function to doWork because that results in an
|
|
8
|
+
// undefined context inside its body when the function gets called.
|
|
9
|
+
binding.doWork(succeed, function(e) {
|
|
10
|
+
setImmediate(() => {
|
|
11
|
+
// If the work is supposed to fail, make sure there's an error.
|
|
12
|
+
assert.strictEqual(succeed || e.message === 'test error', true);
|
|
13
|
+
assert.strictEqual(binding.workerGone, false);
|
|
14
|
+
binding.deleteWorker();
|
|
15
|
+
assert.strictEqual(binding.workerGone, true);
|
|
16
|
+
resolve();
|
|
17
|
+
});
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = require('./common').runTest(async binding => {
|
|
22
|
+
await test(binding.persistentasyncworker, false);
|
|
23
|
+
await test(binding.persistentasyncworker, true);
|
|
24
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#include "napi.h"
|
|
2
|
+
|
|
3
|
+
using namespace Napi;
|
|
4
|
+
|
|
5
|
+
Value CreateArray(const CallbackInfo& info) {
|
|
6
|
+
if (info.Length() > 0) {
|
|
7
|
+
size_t length = info[0].As<Number>().Uint32Value();
|
|
8
|
+
return Array::New(info.Env(), length);
|
|
9
|
+
} else {
|
|
10
|
+
return Array::New(info.Env());
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
Value GetLength(const CallbackInfo& info) {
|
|
15
|
+
Array array = info[0].As<Array>();
|
|
16
|
+
return Number::New(info.Env(), static_cast<uint32_t>(array.Length()));
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
Value GetElement(const CallbackInfo& info) {
|
|
20
|
+
Array array = info[0].As<Array>();
|
|
21
|
+
size_t index = info[1].As<Number>().Uint32Value();
|
|
22
|
+
return array[index];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
void SetElement(const CallbackInfo& info) {
|
|
26
|
+
Array array = info[0].As<Array>();
|
|
27
|
+
size_t index = info[1].As<Number>().Uint32Value();
|
|
28
|
+
array[index] = info[2].As<Value>();
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
Object InitBasicTypesArray(Env env) {
|
|
32
|
+
Object exports = Object::New(env);
|
|
33
|
+
|
|
34
|
+
exports["createArray"] = Function::New(env, CreateArray);
|
|
35
|
+
exports["getLength"] = Function::New(env, GetLength);
|
|
36
|
+
exports["get"] = Function::New(env, GetElement);
|
|
37
|
+
exports["set"] = Function::New(env, SetElement);
|
|
38
|
+
|
|
39
|
+
return exports;
|
|
40
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
const assert = require('assert');
|
|
3
|
+
|
|
4
|
+
module.exports = require('../common').runTest(test);
|
|
5
|
+
|
|
6
|
+
function test(binding) {
|
|
7
|
+
|
|
8
|
+
// create empty array
|
|
9
|
+
const array = binding.basic_types_array.createArray();
|
|
10
|
+
assert.strictEqual(binding.basic_types_array.getLength(array), 0);
|
|
11
|
+
|
|
12
|
+
// create array with length
|
|
13
|
+
const arrayWithLength = binding.basic_types_array.createArray(10);
|
|
14
|
+
assert.strictEqual(binding.basic_types_array.getLength(arrayWithLength), 10);
|
|
15
|
+
|
|
16
|
+
// set function test
|
|
17
|
+
binding.basic_types_array.set(array, 0, 10);
|
|
18
|
+
binding.basic_types_array.set(array, 1, "test");
|
|
19
|
+
binding.basic_types_array.set(array, 2, 3.0);
|
|
20
|
+
|
|
21
|
+
// check length after set data
|
|
22
|
+
assert.strictEqual(binding.basic_types_array.getLength(array), 3);
|
|
23
|
+
|
|
24
|
+
// get function test
|
|
25
|
+
assert.strictEqual(binding.basic_types_array.get(array, 0), 10);
|
|
26
|
+
assert.strictEqual(binding.basic_types_array.get(array, 1), "test");
|
|
27
|
+
assert.strictEqual(binding.basic_types_array.get(array, 2), 3.0);
|
|
28
|
+
|
|
29
|
+
// overwrite test
|
|
30
|
+
binding.basic_types_array.set(array, 0, 5);
|
|
31
|
+
assert.strictEqual(binding.basic_types_array.get(array, 0), 5);
|
|
32
|
+
|
|
33
|
+
// out of index test
|
|
34
|
+
assert.strictEqual(binding.basic_types_array.get(array, 5), undefined);
|
|
35
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#include "napi.h"
|
|
2
|
+
|
|
3
|
+
using namespace Napi;
|
|
4
|
+
|
|
5
|
+
Value CreateBoolean(const CallbackInfo& info) {
|
|
6
|
+
return Boolean::New(info.Env(), info[0].As<Boolean>().Value());
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
Value CreateEmptyBoolean(const CallbackInfo& info) {
|
|
10
|
+
Boolean* boolean = new Boolean();
|
|
11
|
+
return Boolean::New(info.Env(), boolean->IsEmpty());
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
Value CreateBooleanFromExistingValue(const CallbackInfo& info) {
|
|
15
|
+
Boolean boolean(info.Env(), info[0].As<Boolean>());
|
|
16
|
+
return Boolean::New(info.Env(), boolean.Value());
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
Value CreateBooleanFromPrimitive(const CallbackInfo& info) {
|
|
20
|
+
bool boolean = info[0].As<Boolean>();
|
|
21
|
+
return Boolean::New(info.Env(), boolean);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Value OperatorBool(const CallbackInfo& info) {
|
|
25
|
+
Boolean boolean(info.Env(), info[0].As<Boolean>());
|
|
26
|
+
return Boolean::New(info.Env(), static_cast<bool>(boolean));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
Object InitBasicTypesBoolean(Env env) {
|
|
30
|
+
Object exports = Object::New(env);
|
|
31
|
+
|
|
32
|
+
exports["createBoolean"] = Function::New(env, CreateBoolean);
|
|
33
|
+
exports["createEmptyBoolean"] = Function::New(env, CreateEmptyBoolean);
|
|
34
|
+
exports["createBooleanFromExistingValue"] = Function::New(env, CreateBooleanFromExistingValue);
|
|
35
|
+
exports["createBooleanFromPrimitive"] = Function::New(env, CreateBooleanFromPrimitive);
|
|
36
|
+
exports["operatorBool"] = Function::New(env, OperatorBool);
|
|
37
|
+
return exports;
|
|
38
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('assert');
|
|
4
|
+
|
|
5
|
+
module.exports = require('../common').runTest(test);
|
|
6
|
+
|
|
7
|
+
function test(binding) {
|
|
8
|
+
const bool1 = binding.basic_types_boolean.createBoolean(true);
|
|
9
|
+
assert.strictEqual(bool1, true);
|
|
10
|
+
|
|
11
|
+
const bool2 = binding.basic_types_boolean.createBoolean(false);
|
|
12
|
+
assert.strictEqual(bool2, false);
|
|
13
|
+
|
|
14
|
+
const emptyBoolean = binding.basic_types_boolean.createEmptyBoolean();
|
|
15
|
+
assert.strictEqual(emptyBoolean, true);
|
|
16
|
+
|
|
17
|
+
const bool3 = binding.basic_types_boolean.createBooleanFromExistingValue(true);
|
|
18
|
+
assert.strictEqual(bool3, true);
|
|
19
|
+
|
|
20
|
+
const bool4 = binding.basic_types_boolean.createBooleanFromExistingValue(false);
|
|
21
|
+
assert.strictEqual(bool4, false);
|
|
22
|
+
|
|
23
|
+
const bool5 = binding.basic_types_boolean.createBooleanFromPrimitive(true);
|
|
24
|
+
assert.strictEqual(bool5, true);
|
|
25
|
+
|
|
26
|
+
const bool6 = binding.basic_types_boolean.createBooleanFromPrimitive(false);
|
|
27
|
+
assert.strictEqual(bool6, false);
|
|
28
|
+
|
|
29
|
+
const bool7 = binding.basic_types_boolean.operatorBool(true);
|
|
30
|
+
assert.strictEqual(bool7, true);
|
|
31
|
+
|
|
32
|
+
const bool8 = binding.basic_types_boolean.operatorBool(false);
|
|
33
|
+
assert.strictEqual(bool8, false);
|
|
34
|
+
|
|
35
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
#include <cfloat>
|
|
2
|
+
|
|
3
|
+
#include "napi.h"
|
|
4
|
+
|
|
5
|
+
using namespace Napi;
|
|
6
|
+
|
|
7
|
+
Value ToInt32(const CallbackInfo& info) {
|
|
8
|
+
return Number::New(info.Env(), info[0].As<Number>().Int32Value());
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
Value ToUint32(const CallbackInfo& info) {
|
|
12
|
+
return Number::New(info.Env(), info[0].As<Number>().Uint32Value());
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
Value ToInt64(const CallbackInfo& info) {
|
|
16
|
+
return Number::New(info.Env(),
|
|
17
|
+
static_cast<double>(info[0].As<Number>().Int64Value()));
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
Value ToFloat(const CallbackInfo& info) {
|
|
21
|
+
return Number::New(info.Env(), info[0].As<Number>().FloatValue());
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
Value ToDouble(const CallbackInfo& info) {
|
|
25
|
+
return Number::New(info.Env(), info[0].As<Number>().DoubleValue());
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Value MinFloat(const CallbackInfo& info) {
|
|
29
|
+
return Number::New(info.Env(), FLT_MIN);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
Value MaxFloat(const CallbackInfo& info) {
|
|
33
|
+
return Number::New(info.Env(), FLT_MAX);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
Value MinDouble(const CallbackInfo& info) {
|
|
37
|
+
return Number::New(info.Env(), DBL_MIN);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
Value MaxDouble(const CallbackInfo& info) {
|
|
41
|
+
return Number::New(info.Env(), DBL_MAX);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
Value OperatorInt32(const CallbackInfo& info) {
|
|
45
|
+
Number number = info[0].As<Number>();
|
|
46
|
+
return Boolean::New(info.Env(), number.Int32Value() == static_cast<int32_t>(number));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
Value OperatorUint32(const CallbackInfo& info) {
|
|
50
|
+
Number number = info[0].As<Number>();
|
|
51
|
+
return Boolean::New(info.Env(), number.Uint32Value() == static_cast<uint32_t>(number));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
Value OperatorInt64(const CallbackInfo& info) {
|
|
55
|
+
Number number = info[0].As<Number>();
|
|
56
|
+
return Boolean::New(info.Env(), number.Int64Value() == static_cast<int64_t>(number));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
Value OperatorFloat(const CallbackInfo& info) {
|
|
60
|
+
Number number = info[0].As<Number>();
|
|
61
|
+
return Boolean::New(info.Env(), number.FloatValue() == static_cast<float>(number));
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
Value OperatorDouble(const CallbackInfo& info) {
|
|
65
|
+
Number number = info[0].As<Number>();
|
|
66
|
+
return Boolean::New(info.Env(), number.DoubleValue() == static_cast<double>(number));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
Value CreateEmptyNumber(const CallbackInfo& info) {
|
|
70
|
+
Number number;
|
|
71
|
+
return Boolean::New(info.Env(), number.IsEmpty());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
Value CreateNumberFromExistingValue(const CallbackInfo& info) {
|
|
75
|
+
return info[0].As<Number>();
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
Object InitBasicTypesNumber(Env env) {
|
|
79
|
+
Object exports = Object::New(env);
|
|
80
|
+
|
|
81
|
+
exports["toInt32"] = Function::New(env, ToInt32);
|
|
82
|
+
exports["toUint32"] = Function::New(env, ToUint32);
|
|
83
|
+
exports["toInt64"] = Function::New(env, ToInt64);
|
|
84
|
+
exports["toFloat"] = Function::New(env, ToFloat);
|
|
85
|
+
exports["toDouble"] = Function::New(env, ToDouble);
|
|
86
|
+
exports["minFloat"] = Function::New(env, MinFloat);
|
|
87
|
+
exports["maxFloat"] = Function::New(env, MaxFloat);
|
|
88
|
+
exports["minDouble"] = Function::New(env, MinDouble);
|
|
89
|
+
exports["maxDouble"] = Function::New(env, MaxDouble);
|
|
90
|
+
exports["operatorInt32"] = Function::New(env, OperatorInt32);
|
|
91
|
+
exports["operatorUint32"] = Function::New(env, OperatorUint32);
|
|
92
|
+
exports["operatorInt64"] = Function::New(env, OperatorInt64);
|
|
93
|
+
exports["operatorFloat"] = Function::New(env, OperatorFloat);
|
|
94
|
+
exports["operatorDouble"] = Function::New(env, OperatorDouble);
|
|
95
|
+
exports["createEmptyNumber"] = Function::New(env, CreateEmptyNumber);
|
|
96
|
+
exports["createNumberFromExistingValue"] = Function::New(env, CreateNumberFromExistingValue);
|
|
97
|
+
|
|
98
|
+
return exports;
|
|
99
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('assert');
|
|
4
|
+
|
|
5
|
+
module.exports = require('../common').runTest(test);
|
|
6
|
+
|
|
7
|
+
function test(binding) {
|
|
8
|
+
const MIN_INT32 = -2147483648;
|
|
9
|
+
const MAX_INT32 = 2147483647;
|
|
10
|
+
const MIN_UINT32 = 0;
|
|
11
|
+
const MAX_UINT32 = 4294967295;
|
|
12
|
+
const MIN_INT64 = Number.MIN_SAFE_INTEGER;
|
|
13
|
+
const MAX_INT64 = Number.MAX_SAFE_INTEGER;
|
|
14
|
+
const MIN_FLOAT = binding.basic_types_number.minFloat();
|
|
15
|
+
const MAX_FLOAT = binding.basic_types_number.maxFloat();
|
|
16
|
+
const MIN_DOUBLE = binding.basic_types_number.minDouble();
|
|
17
|
+
const MAX_DOUBLE = binding.basic_types_number.maxDouble();
|
|
18
|
+
|
|
19
|
+
function randomRangeTestForInteger(min, max, converter) {
|
|
20
|
+
for (let i = min; i < max; i+= Math.floor(Math.random() * max / 100)) {
|
|
21
|
+
assert.strictEqual(i, converter(i));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Test for 32bit signed integer [-2147483648, 2147483647]
|
|
26
|
+
{
|
|
27
|
+
// Range tests
|
|
28
|
+
randomRangeTestForInteger(MIN_INT32, MAX_INT32, binding.basic_types_number.toInt32);
|
|
29
|
+
assert.strictEqual(MIN_INT32, binding.basic_types_number.toInt32(MIN_INT32));
|
|
30
|
+
assert.strictEqual(MAX_INT32, binding.basic_types_number.toInt32(MAX_INT32));
|
|
31
|
+
|
|
32
|
+
// Overflow tests
|
|
33
|
+
assert.notStrictEqual(MAX_INT32 + 1, binding.basic_types_number.toInt32(MAX_INT32 + 1));
|
|
34
|
+
assert.notStrictEqual(MIN_INT32 - 1, binding.basic_types_number.toInt32(MIN_INT32 - 1));
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Test for 32bit unsigned integer [0, 4294967295]
|
|
38
|
+
{
|
|
39
|
+
// Range tests
|
|
40
|
+
randomRangeTestForInteger(MIN_UINT32, MAX_UINT32, binding.basic_types_number.toUint32);
|
|
41
|
+
assert.strictEqual(MIN_UINT32, binding.basic_types_number.toUint32(MIN_UINT32));
|
|
42
|
+
assert.strictEqual(MAX_UINT32, binding.basic_types_number.toUint32(MAX_UINT32));
|
|
43
|
+
|
|
44
|
+
// Overflow tests
|
|
45
|
+
assert.notStrictEqual(MAX_UINT32 + 1, binding.basic_types_number.toUint32(MAX_UINT32 + 1));
|
|
46
|
+
assert.notStrictEqual(MIN_UINT32 - 1, binding.basic_types_number.toUint32(MIN_UINT32 - 1));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Test for 64bit signed integer
|
|
50
|
+
{
|
|
51
|
+
// Range tests
|
|
52
|
+
randomRangeTestForInteger(MIN_INT64, MAX_INT64, binding.basic_types_number.toInt64);
|
|
53
|
+
assert.strictEqual(MIN_INT64, binding.basic_types_number.toInt64(MIN_INT64));
|
|
54
|
+
assert.strictEqual(MAX_INT64, binding.basic_types_number.toInt64(MAX_INT64));
|
|
55
|
+
|
|
56
|
+
// The int64 type can't be represented with full precision in JavaScript.
|
|
57
|
+
// So, we are not able to do overflow test here.
|
|
58
|
+
// Please see https://tc39.github.io/ecma262/#sec-ecmascript-language-types-number-type.
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Test for float type (might be single-precision 32bit IEEE 754 floating point number)
|
|
62
|
+
{
|
|
63
|
+
// Range test
|
|
64
|
+
assert.strictEqual(MIN_FLOAT, binding.basic_types_number.toFloat(MIN_FLOAT));
|
|
65
|
+
assert.strictEqual(MAX_FLOAT, binding.basic_types_number.toFloat(MAX_FLOAT));
|
|
66
|
+
|
|
67
|
+
// Overflow test
|
|
68
|
+
assert.strictEqual(0, binding.basic_types_number.toFloat(MIN_FLOAT * MIN_FLOAT));
|
|
69
|
+
assert.strictEqual(Infinity, binding.basic_types_number.toFloat(MAX_FLOAT * MAX_FLOAT));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// Test for double type (is double-precision 64 bit IEEE 754 floating point number)
|
|
73
|
+
{
|
|
74
|
+
assert.strictEqual(MIN_DOUBLE, binding.basic_types_number.toDouble(MIN_DOUBLE));
|
|
75
|
+
assert.strictEqual(MAX_DOUBLE, binding.basic_types_number.toDouble(MAX_DOUBLE));
|
|
76
|
+
|
|
77
|
+
// Overflow test
|
|
78
|
+
assert.strictEqual(0, binding.basic_types_number.toDouble(MIN_DOUBLE * MIN_DOUBLE));
|
|
79
|
+
assert.strictEqual(Infinity, binding.basic_types_number.toDouble(MAX_DOUBLE * MAX_DOUBLE));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// Test for operator overloading
|
|
83
|
+
{
|
|
84
|
+
assert.strictEqual(binding.basic_types_number.operatorInt32(MIN_INT32), true);
|
|
85
|
+
assert.strictEqual(binding.basic_types_number.operatorInt32(MAX_INT32), true);
|
|
86
|
+
assert.strictEqual(binding.basic_types_number.operatorUint32(MIN_UINT32), true);
|
|
87
|
+
assert.strictEqual(binding.basic_types_number.operatorUint32(MAX_UINT32), true);
|
|
88
|
+
assert.strictEqual(binding.basic_types_number.operatorInt64(MIN_INT64), true);
|
|
89
|
+
assert.strictEqual(binding.basic_types_number.operatorInt64(MAX_INT64), true);
|
|
90
|
+
assert.strictEqual(binding.basic_types_number.operatorFloat(MIN_FLOAT), true);
|
|
91
|
+
assert.strictEqual(binding.basic_types_number.operatorFloat(MAX_FLOAT), true);
|
|
92
|
+
assert.strictEqual(binding.basic_types_number.operatorFloat(MAX_DOUBLE), true);
|
|
93
|
+
assert.strictEqual(binding.basic_types_number.operatorDouble(MIN_DOUBLE), true);
|
|
94
|
+
assert.strictEqual(binding.basic_types_number.operatorDouble(MAX_DOUBLE), true);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Construction test
|
|
98
|
+
{
|
|
99
|
+
assert.strictEqual(binding.basic_types_number.createEmptyNumber(), true);
|
|
100
|
+
randomRangeTestForInteger(MIN_INT32, MAX_INT32, binding.basic_types_number.createNumberFromExistingValue);
|
|
101
|
+
assert.strictEqual(MIN_INT32, binding.basic_types_number.createNumberFromExistingValue(MIN_INT32));
|
|
102
|
+
assert.strictEqual(MAX_INT32, binding.basic_types_number.createNumberFromExistingValue(MAX_INT32));
|
|
103
|
+
randomRangeTestForInteger(MIN_UINT32, MAX_UINT32, binding.basic_types_number.createNumberFromExistingValue);
|
|
104
|
+
assert.strictEqual(MIN_UINT32, binding.basic_types_number.createNumberFromExistingValue(MIN_UINT32));
|
|
105
|
+
assert.strictEqual(MAX_UINT32, binding.basic_types_number.createNumberFromExistingValue(MAX_UINT32));
|
|
106
|
+
randomRangeTestForInteger(MIN_INT64, MAX_INT64, binding.basic_types_number.createNumberFromExistingValue);
|
|
107
|
+
assert.strictEqual(MIN_INT64, binding.basic_types_number.createNumberFromExistingValue(MIN_INT64));
|
|
108
|
+
assert.strictEqual(MAX_INT64, binding.basic_types_number.createNumberFromExistingValue(MAX_INT64));
|
|
109
|
+
assert.strictEqual(MIN_FLOAT, binding.basic_types_number.createNumberFromExistingValue(MIN_FLOAT));
|
|
110
|
+
assert.strictEqual(MAX_FLOAT, binding.basic_types_number.createNumberFromExistingValue(MAX_FLOAT));
|
|
111
|
+
assert.strictEqual(MIN_DOUBLE, binding.basic_types_number.createNumberFromExistingValue(MIN_DOUBLE));
|
|
112
|
+
assert.strictEqual(MAX_DOUBLE, binding.basic_types_number.createNumberFromExistingValue(MAX_DOUBLE));
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#include "napi.h"
|
|
2
|
+
#include "test_helper.h"
|
|
3
|
+
|
|
4
|
+
using namespace Napi;
|
|
5
|
+
|
|
6
|
+
namespace {
|
|
7
|
+
|
|
8
|
+
int testData = 1;
|
|
9
|
+
|
|
10
|
+
// Helpers for testing non-Javascript values.
|
|
11
|
+
Value CreateExternal(const CallbackInfo& info) {
|
|
12
|
+
return External<int>::New(info.Env(), &testData);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
} // end anonymous namespace
|
|
16
|
+
|
|
17
|
+
static Value IsEmpty(const CallbackInfo& info) {
|
|
18
|
+
Value value;
|
|
19
|
+
return Boolean::New(info.Env(), value.IsEmpty());
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static Value IsUndefined(const CallbackInfo& info) {
|
|
23
|
+
return Boolean::New(info.Env(), info[0].IsUndefined());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
static Value IsNull(const CallbackInfo& info) {
|
|
27
|
+
return Boolean::New(info.Env(), info[0].IsNull());
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
static Value IsBoolean(const CallbackInfo& info) {
|
|
31
|
+
return Boolean::New(info.Env(), info[0].IsBoolean());
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
static Value IsNumber(const CallbackInfo& info) {
|
|
35
|
+
return Boolean::New(info.Env(), info[0].IsNumber());
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
static Value IsString(const CallbackInfo& info) {
|
|
39
|
+
return Boolean::New(info.Env(), info[0].IsString());
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
static Value IsSymbol(const CallbackInfo& info) {
|
|
43
|
+
return Boolean::New(info.Env(), info[0].IsSymbol());
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static Value IsArray(const CallbackInfo& info) {
|
|
47
|
+
return Boolean::New(info.Env(), info[0].IsArray());
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
static Value IsArrayBuffer(const CallbackInfo& info) {
|
|
51
|
+
return Boolean::New(info.Env(), info[0].IsArrayBuffer());
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
static Value IsTypedArray(const CallbackInfo& info) {
|
|
55
|
+
return Boolean::New(info.Env(), info[0].IsTypedArray());
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
static Value IsObject(const CallbackInfo& info) {
|
|
59
|
+
return Boolean::New(info.Env(), info[0].IsObject());
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
static Value IsFunction(const CallbackInfo& info) {
|
|
63
|
+
return Boolean::New(info.Env(), info[0].IsFunction());
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
static Value IsPromise(const CallbackInfo& info) {
|
|
67
|
+
return Boolean::New(info.Env(), info[0].IsPromise());
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
static Value IsDataView(const CallbackInfo& info) {
|
|
71
|
+
return Boolean::New(info.Env(), info[0].IsDataView());
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
static Value IsExternal(const CallbackInfo& info) {
|
|
75
|
+
return Boolean::New(info.Env(), info[0].IsExternal());
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
static Value ToBoolean(const CallbackInfo& info) {
|
|
79
|
+
return MaybeUnwrap(info[0].ToBoolean());
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
static Value ToNumber(const CallbackInfo& info) {
|
|
83
|
+
return MaybeUnwrap(info[0].ToNumber());
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
static Value ToString(const CallbackInfo& info) {
|
|
87
|
+
return MaybeUnwrap(info[0].ToString());
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
static Value ToObject(const CallbackInfo& info) {
|
|
91
|
+
return MaybeUnwrap(info[0].ToObject());
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
Object InitBasicTypesValue(Env env) {
|
|
95
|
+
Object exports = Object::New(env);
|
|
96
|
+
|
|
97
|
+
exports["isEmpty"] = Function::New(env, IsEmpty);
|
|
98
|
+
exports["isUndefined"] = Function::New(env, IsUndefined);
|
|
99
|
+
exports["isNull"] = Function::New(env, IsNull);
|
|
100
|
+
exports["isBoolean"] = Function::New(env, IsBoolean);
|
|
101
|
+
exports["isNumber"] = Function::New(env, IsNumber);
|
|
102
|
+
exports["isString"] = Function::New(env, IsString);
|
|
103
|
+
exports["isSymbol"] = Function::New(env, IsSymbol);
|
|
104
|
+
exports["isArray"] = Function::New(env, IsArray);
|
|
105
|
+
exports["isArrayBuffer"] = Function::New(env, IsArrayBuffer);
|
|
106
|
+
exports["isTypedArray"] = Function::New(env, IsTypedArray);
|
|
107
|
+
exports["isObject"] = Function::New(env, IsObject);
|
|
108
|
+
exports["isFunction"] = Function::New(env, IsFunction);
|
|
109
|
+
exports["isPromise"] = Function::New(env, IsPromise);
|
|
110
|
+
exports["isDataView"] = Function::New(env, IsDataView);
|
|
111
|
+
exports["isExternal"] = Function::New(env, IsExternal);
|
|
112
|
+
exports["toBoolean"] = Function::New(env, ToBoolean);
|
|
113
|
+
exports["toNumber"] = Function::New(env, ToNumber);
|
|
114
|
+
exports["toString"] = Function::New(env, ToString);
|
|
115
|
+
exports["toObject"] = Function::New(env, ToObject);
|
|
116
|
+
|
|
117
|
+
exports["createExternal"] = Function::New(env, CreateExternal);
|
|
118
|
+
|
|
119
|
+
return exports;
|
|
120
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const assert = require('assert');
|
|
4
|
+
|
|
5
|
+
module.exports = require('../common').runTest(test);
|
|
6
|
+
|
|
7
|
+
function test(binding) {
|
|
8
|
+
const externalValue = binding.basic_types_value.createExternal();
|
|
9
|
+
|
|
10
|
+
function isObject(value) {
|
|
11
|
+
return (typeof value === 'object' && value !== externalValue) ||
|
|
12
|
+
(typeof value === 'function');
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function detailedTypeOf(value) {
|
|
16
|
+
const type = typeof value;
|
|
17
|
+
if (type !== 'object')
|
|
18
|
+
return type;
|
|
19
|
+
|
|
20
|
+
if (value === null)
|
|
21
|
+
return 'null';
|
|
22
|
+
|
|
23
|
+
if (Array.isArray(value))
|
|
24
|
+
return 'array';
|
|
25
|
+
|
|
26
|
+
if (value === externalValue)
|
|
27
|
+
return 'external';
|
|
28
|
+
|
|
29
|
+
if (!value.constructor)
|
|
30
|
+
return type;
|
|
31
|
+
|
|
32
|
+
if (value instanceof ArrayBuffer)
|
|
33
|
+
return 'arraybuffer';
|
|
34
|
+
|
|
35
|
+
if (ArrayBuffer.isView(value)) {
|
|
36
|
+
if (value instanceof DataView) {
|
|
37
|
+
return 'dataview';
|
|
38
|
+
} else {
|
|
39
|
+
return 'typedarray';
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (value instanceof Promise)
|
|
44
|
+
return 'promise';
|
|
45
|
+
|
|
46
|
+
return 'object';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function typeCheckerTest(typeChecker, expectedType) {
|
|
50
|
+
const testValueList = [
|
|
51
|
+
undefined,
|
|
52
|
+
null,
|
|
53
|
+
true,
|
|
54
|
+
10,
|
|
55
|
+
'string',
|
|
56
|
+
Symbol('symbol'),
|
|
57
|
+
[],
|
|
58
|
+
new ArrayBuffer(10),
|
|
59
|
+
new Int32Array(new ArrayBuffer(12)),
|
|
60
|
+
{},
|
|
61
|
+
function() {},
|
|
62
|
+
new Promise((resolve, reject) => {}),
|
|
63
|
+
new DataView(new ArrayBuffer(12)),
|
|
64
|
+
externalValue
|
|
65
|
+
];
|
|
66
|
+
|
|
67
|
+
testValueList.forEach((testValue) => {
|
|
68
|
+
if (testValue !== null && expectedType === 'object') {
|
|
69
|
+
assert.strictEqual(typeChecker(testValue), isObject(testValue));
|
|
70
|
+
} else {
|
|
71
|
+
assert.strictEqual(typeChecker(testValue), detailedTypeOf(testValue) === expectedType);
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function typeConverterTest(typeConverter, expectedType) {
|
|
77
|
+
const testValueList = [
|
|
78
|
+
true,
|
|
79
|
+
false,
|
|
80
|
+
0,
|
|
81
|
+
10,
|
|
82
|
+
'string',
|
|
83
|
+
[],
|
|
84
|
+
new ArrayBuffer(10),
|
|
85
|
+
new Int32Array(new ArrayBuffer(12)),
|
|
86
|
+
{},
|
|
87
|
+
function() {},
|
|
88
|
+
new Promise((resolve, reject) => {})
|
|
89
|
+
];
|
|
90
|
+
|
|
91
|
+
testValueList.forEach((testValue) => {
|
|
92
|
+
const expected = expectedType(testValue);
|
|
93
|
+
const actual = typeConverter(testValue);
|
|
94
|
+
|
|
95
|
+
if (isNaN(expected)) {
|
|
96
|
+
assert(isNaN(actual));
|
|
97
|
+
} else {
|
|
98
|
+
assert.deepStrictEqual(typeConverter(testValue), expectedType(testValue));
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const value = binding.basic_types_value;
|
|
104
|
+
|
|
105
|
+
typeCheckerTest(value.isUndefined, 'undefined');
|
|
106
|
+
typeCheckerTest(value.isNull, 'null');
|
|
107
|
+
typeCheckerTest(value.isBoolean, 'boolean');
|
|
108
|
+
typeCheckerTest(value.isNumber, 'number');
|
|
109
|
+
typeCheckerTest(value.isString, 'string');
|
|
110
|
+
typeCheckerTest(value.isSymbol, 'symbol');
|
|
111
|
+
typeCheckerTest(value.isArray, 'array');
|
|
112
|
+
typeCheckerTest(value.isArrayBuffer, 'arraybuffer');
|
|
113
|
+
typeCheckerTest(value.isTypedArray, 'typedarray');
|
|
114
|
+
typeCheckerTest(value.isObject, 'object');
|
|
115
|
+
typeCheckerTest(value.isFunction, 'function');
|
|
116
|
+
typeCheckerTest(value.isPromise, 'promise');
|
|
117
|
+
typeCheckerTest(value.isDataView, 'dataview');
|
|
118
|
+
typeCheckerTest(value.isExternal, 'external');
|
|
119
|
+
|
|
120
|
+
typeConverterTest(value.toBoolean, Boolean);
|
|
121
|
+
assert.strictEqual(value.toBoolean(undefined), false);
|
|
122
|
+
assert.strictEqual(value.toBoolean(null), false);
|
|
123
|
+
|
|
124
|
+
typeConverterTest(value.toNumber, Number);
|
|
125
|
+
assert(isNaN(value.toNumber(undefined)));
|
|
126
|
+
assert.strictEqual(value.toNumber(null), 0);
|
|
127
|
+
|
|
128
|
+
typeConverterTest(value.toString, String);
|
|
129
|
+
assert.strictEqual(value.toString(undefined), 'undefined');
|
|
130
|
+
assert.strictEqual(value.toString(null), 'null');
|
|
131
|
+
|
|
132
|
+
typeConverterTest(value.toObject, Object);
|
|
133
|
+
}
|