vm->retval.data.truth = 1; return NXT_OK; } return NXT_ERROR; } static const njs_object_prop_t njs_array_function_properties[] = { { njs_string("Array"), njs_string("name"), NJS_PROPERTY, 0, 0, 0, }, { njs_value(NJS_NUMBER, 1, 1.0), njs_string("length"), NJS_PROPERTY, 0, 0, 0, }, { njs_getter(njs_object_prototype_create_prototype), njs_string("prototype"), NJS_NATIVE_GETTER, 0, 0, 0, }, }; nxt_int_t njs_array_function_hash(njs_vm_t *vm, nxt_lvlhsh_t *hash) { return njs_object_hash_create(vm, hash, njs_array_function_properties, nxt_nitems(njs_array_function_properties)); }
static const njs_object_prop_t njs_regexp_constructor_properties[] = { /* RegExp.name == "RegExp". */ { .type = NJS_PROPERTY, .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), };