G_GNUC_UNUSED static gboolean fdn_is_null (napi_env env, napi_value value);
static gboolean fdn_is_undefined_or_null (napi_env env, napi_value value);
static gboolean fdn_is_function (napi_env env, napi_value value);

static gboolean fdn_boolean_from_value (napi_env env, napi_value value, gboolean * b);
static napi_value fdn_boolean_to_value (napi_env env, gboolean b);
static gboolean fdn_size_from_value (napi_env env, napi_value value, gsize * s);
static napi_value fdn_size_to_value (napi_env env, gsize s);
static napi_value fdn_ssize_to_value (napi_env env, gssize s);
static gboolean fdn_int_from_value (napi_env env, napi_value value, gint * i);
static napi_value fdn_int_to_value (napi_env env, gint i);
static gboolean fdn_uint_from_value (napi_env env, napi_value value, guint * u);
static napi_value fdn_uint_to_value (napi_env env, guint u);
static napi_value fdn_int8_to_value (napi_env env, gint8 i);
static napi_value fdn_int16_to_value (napi_env env, gint16 i);
static gboolean fdn_uint16_from_value (napi_env env, napi_value value, guint16 * u);
static napi_value fdn_uint16_to_value (napi_env env, guint16 u);
static napi_value fdn_int32_to_value (napi_env env, gint32 i);
static napi_value fdn_uint32_to_value (napi_env env, guint32 u);
static gboolean fdn_int64_from_value (napi_env env, napi_value value, gint64 * i);
static napi_value fdn_int64_to_value (napi_env env, gint64 i);
static napi_value fdn_uint64_to_value (napi_env env, guint64 u);
static gboolean fdn_ulong_from_value (napi_env env, napi_value value, gulong * u);
static gboolean fdn_double_from_value (napi_env env, napi_value value, gdouble * d);
static napi_value fdn_double_to_value (napi_env env, gdouble d);
static gboolean fdn_enum_from_value (napi_env env, GType enum_type, napi_value value, gint * e);
static napi_value fdn_enum_to_value (napi_env env, GType enum_type, gint e);
static gboolean fdn_utf8_from_value (napi_env env, napi_value value, gchar ** str);
static napi_value fdn_utf8_to_value (napi_env env, const gchar * str);
static gboolean fdn_strv_from_value (napi_env env, napi_value value, gchar *** strv);
static napi_value fdn_strv_to_value (napi_env env, gchar ** strv);
static napi_value fdn_buffer_to_value (napi_env env, const guint8 * data, gsize size);
static gboolean fdn_bytes_from_value (napi_env env, napi_value value, GBytes ** bytes);
static napi_value fdn_bytes_to_value (napi_env env, GBytes * bytes);
static gboolean fdn_vardict_from_value (napi_env env, napi_value value, GHashTable ** vardict);
static napi_value fdn_vardict_to_value (napi_env env, GHashTable * vardict);
static gboolean fdn_variant_from_value (napi_env env, napi_value value, GVariant ** variant);
static napi_value fdn_variant_to_value (napi_env env, GVariant * variant);
static gboolean fdn_gvalue_from_value (napi_env env, GType type, napi_value js_value, GValue * value);
static napi_value fdn_gvalue_to_value (napi_env env, GValue * value);
static gboolean fdn_error_from_value (napi_env env, napi_value value, GError ** error);
static napi_value fdn_error_to_value (napi_env env, GError * error);
static gboolean fdn_file_from_value (napi_env env, napi_value value, GFile ** file);
static napi_value fdn_file_to_value (napi_env env, GFile * file);
static gboolean fdn_tls_certificate_from_value (napi_env env, napi_value value, GTlsCertificate ** certificate);
static napi_value fdn_tls_certificate_to_value (napi_env env, GTlsCertificate * certificate);
static gboolean fdn_options_from_value (napi_env env, GType object_type, napi_value value, gpointer * options);

static napi_value fdn_object_subclass_to_value (napi_env env, GObject * object);
static napi_value fdn_object_new (napi_env env, GObject * handle, napi_ref constructor);
static gboolean fdn_object_wrap (napi_env env, napi_value wrapper, GObject * handle, napi_finalize finalizer);
static gboolean fdn_object_unwrap (napi_env env, napi_value wrapper, GType expected_type, GObject ** handle);
static void fdn_object_finalize (napi_env env, void * finalize_data, void * finalize_hint);
static napi_value fdn_object_get_signal (napi_env env, napi_callback_info info, const gchar * name, const gchar * js_storage_name, FdnSignalBehavior behavior);

static napi_value fdn_signal_new (napi_env env, GObject * handle, const gchar * name, FdnSignalBehavior behavior);
static void fdn_signal_register (napi_env env, napi_value exports);
static napi_value fdn_signal_construct (napi_env env, napi_callback_info info);
static void fdn_signal_finalize (napi_env env, void * finalize_data, void * finalize_hint);
static napi_value fdn_signal_connect (napi_env env, napi_callback_info info);
static napi_value fdn_signal_disconnect (napi_env env, napi_callback_info info);
static void fdn_signal_disconnect_closure (FdnSignal * self, FdnSignalClosure * closure);
static gboolean fdn_signal_parse_arguments (napi_env env, napi_callback_info info, FdnSignal ** self, napi_value * js_self, napi_value * handler);
static FdnSignalClosure * fdn_signal_closure_new (napi_env env, FdnSignal * sig, napi_value js_sig, napi_value handler);
static void fdn_signal_closure_finalize (gpointer data, GClosure * closure);
static void fdn_signal_closure_marshal (GClosure * closure, GValue * return_gvalue, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
static void fdn_signal_closure_deliver (napi_env env, napi_value js_cb, void * context, void * data);

static void fdn_keep_alive_until (napi_env env, napi_value js_object, GObject * handle, FdnIsDestroyedFunc is_destroyed, const gchar * destroy_signal_name);
static void fdn_keep_alive_on_finalize (napi_env env, void * finalize_data, void * finalize_hint);
static void fdn_keep_alive_on_destroy_signal (GObject * handle, gpointer user_data);
static void fdn_keep_alive_on_destroy_signal_handler_detached (gpointer data, GClosure * closure);
static void fdn_keep_alive_schedule_cleanup (FdnKeepAliveContext * context);
static void fdn_keep_alive_on_tsfn_invoke (napi_env env, napi_value js_cb, void * context, void * data);
static void fdn_keep_alive_context_unref (FdnKeepAliveContext * ctx);

static void fdn_inherit_val_val (napi_env env, napi_value sub_ctor, napi_value super_ctor, napi_value object_ctor, napi_value set_proto);
G_GNUC_UNUSED static void fdn_inherit_val_ref (napi_env env, napi_value sub_ctor, napi_ref super_ctor, napi_value object_ctor, napi_value set_proto);
static void fdn_inherit_ref_val (napi_env env, napi_ref sub_ctor, napi_value super_ctor, napi_value object_ctor, napi_value set_proto);
static void fdn_inherit_ref_ref (napi_env env, napi_ref sub_ctor, napi_ref super_ctor, napi_value object_ctor, napi_value set_proto);

static gchar * fdn_camel_case_to_kebab_case (const gchar * name);
