}
+static njs_int_t
+njs_object_is(njs_vm_t *vm, njs_value_t *args, njs_uint_t nargs,
+ njs_index_t unused)
+{
+ njs_set_boolean(&vm->retval, njs_values_same(njs_arg(args, nargs, 1),
+ njs_arg(args, nargs, 2)));
+
+ return NJS_OK;
+}
+
+
/*
* The __proto__ property of booleans, numbers and strings primitives,
* of objects created by Boolean(), Number(), and String() constructors,
.writable = 1,
.configurable = 1,
},
+
+ /* Object.is(). */
+ {
+ .type = NJS_PROPERTY,
+ .name = njs_string("is"),
+ .value = njs_native_function(njs_object_is, 2),
+ .writable = 1,
+ .configurable = 1,
+ },
};
{ njs_str("Object.isExtensible(undefined)"),
njs_str("false") },
+ /* Object.is() */
+
+ { njs_str("typeof Object.is"),
+ njs_str("function") },
+
+ { njs_str("Object.is.length == 2"),
+ njs_str("true") },
+
+ { njs_str("Object.is()"),
+ njs_str("true") },
+
+ { njs_str("[undefined, null, false, NaN, '', Symbol(), {}]"
+ ".map((x) => Object.is(x, x))"
+ ".every((x) => x === true)"),
+ njs_str("true") },
+
+ { njs_str("[null, false, NaN, '', Symbol(), {}]"
+ ".map((x) => Object.is(x) || Object.is(void 0, x))"
+ ".every((x) => x === false)"),
+ njs_str("true") },
+
+ { njs_str("[false, NaN, '', Symbol()]"
+ ".map((x) => Object.is(Object(x), Object(x)))"
+ ".every((x) => x === false)"),
+ njs_str("true") },
+
+ { njs_str("Object.is(0, -0)"),
+ njs_str("false") },
+
+ { njs_str("Object.is(0, null)"),
+ njs_str("false") },
+
+ { njs_str("Object.is(42, '42')"),
+ njs_str("false") },
+
{ njs_str(
"var fail;"
"function isConfigurableMethods(o) {"