GLib.Variant.prototype.n_children

function n_children(): Number(gsize) {
    // Gjs wrapper for g_variant_n_children()
}
  

Determines the number of children in a container GLib.Variant instance. This includes variants, maybes, arrays, tuples and dictionary entries. It is an error to call this function on any other type of GLib.Variant.

For variants, the return value is always 1. For values with maybe types, it is always zero or one. For arrays, it is the length of the array. For tuples it is the number of tuple items (which depends only on the type). For dictionary entries, it is always 2

This function is O(1).

Since 2.24

Returns

the number of children in the container