.name = njs_string("name"),
        .value = njs_string("RegExp"),
    },

    /* RegExp.length == 2. */
    {
        .type = NJS_PROPERTY,
        .name = njs_string("length"),
        .value = njs_value(NJS_NUMBER, 1, 2.0),
    },

    /* RegExp.prototype. */
    {
        .type = NJS_NATIVE_GETTER,
        .name = njs_string("prototype"),
        .value = njs_native_getter(njs_object_prototype_create),
    },
};


const njs_object_init_t  njs_regexp_constructor_init = {
    njs_regexp_constructor_properties,
    nxt_nitems(njs_regexp_constructor_properties),
};


static const njs_object_prop_t  njs_regexp_prototype_properties[] =
{
    {
        .type = NJS_NATIVE_GETTER,
        .name = njs_string("lastIndex"),
Beispiel #2
0

static const njs_object_prop_t  njs_object_constructor_properties[] =
{
    /* Object.name == "name". */
    { njs_string("Object"),
      njs_string("name"),
      NJS_PROPERTY, 0, 0, 0, },

    /* Object.length == 1. */
    { njs_value(NJS_NUMBER, 1, 1.0),
      njs_string("length"),
      NJS_PROPERTY, 0, 0, 0, },

    /* Object.prototype. */
    { njs_native_getter(njs_object_prototype_create),
      njs_string("prototype"),
      NJS_NATIVE_GETTER, 0, 0, 0, },

    /* Object.create(). */
    { njs_native_function(njs_object_create, 0),
      njs_string("create"),
      NJS_METHOD, 0, 0, 0, },
};


const njs_object_init_t  njs_object_constructor_init = {
     njs_object_constructor_properties,
     nxt_nitems(njs_object_constructor_properties),
};