summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
inline | side by side (from parent 1:
c5be143)
This requires making `sameValue` a wrapper of `Object.is` instead of
literally the same function.
-/**
- * Returns whether the provided values are the same value.
- *
- * ※ This differs from `===` in the cases of nan and zero.
- */
-export const sameValue = Object.is;
-
+ /**
+ * Returns whether the provided values are the same value.
+ *
+ * ※ This differs from `===` in the cases of nan and zero.
+ */
+ sameValue,
+
/**
* Returns whether the provided values are either the same value or
* both zero (either positive or negative).
/**
* Returns whether the provided values are either the same value or
* both zero (either positive or negative).
sameValueZero,
} = (() => {
const { isNaN: isNan } = Number;
sameValueZero,
} = (() => {
const { isNaN: isNan } = Number;
+ sameValue: (a, b) => is(a, b),
sameValueZero: ($1, $2) => {
const type1 = type($1);
const type2 = type($2);
sameValueZero: ($1, $2) => {
const type1 = type($1);
const type2 = type($2);
};
assertThrows(() => ordinaryToPrimitive(obj));
});
};
assertThrows(() => ordinaryToPrimitive(obj));
});
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(
+ ordinaryToPrimitive.name,
+ "ordinaryToPrimitive",
+ );
+ });
+ });
});
describe("sameValue", () => {
});
describe("sameValue", () => {
it("[[Call]] returns false for a primitive and its wrapped object", () => {
assertStrictEquals(sameValue(false, new Boolean(false)), false);
});
it("[[Call]] returns false for a primitive and its wrapped object", () => {
assertStrictEquals(sameValue(false, new Boolean(false)), false);
});
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(sameValue.name, "sameValue");
+ });
+ });
});
describe("sameValueZero", () => {
});
describe("sameValueZero", () => {
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(sameValueZero.name, "sameValueZero");
+ });
+ });
});
describe("toPrimitive", () => {
});
describe("toPrimitive", () => {
assertThrows(() => toPrimitive(value2, "badhint"));
assertThrows(() => toPrimitive(true, "badhint"));
});
assertThrows(() => toPrimitive(value2, "badhint"));
assertThrows(() => toPrimitive(true, "badhint"));
});
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(toPrimitive.name, "toPrimitive");
+ });
+ });
});
describe("type", () => {
});
describe("type", () => {
it('[[Call]] returns "object" for constructable objects', () => {
assertStrictEquals(type(class {}), "object");
});
it('[[Call]] returns "object" for constructable objects', () => {
assertStrictEquals(type(class {}), "object");
});
+
+ describe(".name", () => {
+ it("[[Get]] returns the correct name", () => {
+ assertStrictEquals(type.name, "type");
+ });
+ });