A vendorable Object.is polyfill bundle based on the dependency-free object-is 1.1.0 release. Useful when you want the classic shim behavior locally without pulling in newer helper packages.
Why copy this?
This page ships an Object.is polyfill bundle based on the old dependency-free release line. The value is to keep SameValue semantics local and inspectable without carrying the newer helper graph.
Native alternative: Object.is exists in modern runtimes, but old compatibility layers and cleanup work may still want a vendorable shim with the familiar export shape.
Note: Current object-is releases pull in helper packages. This snippet intentionally uses the simpler 1.1.0 release line as a vendorable first pass.
This copy is your responsibility once you adopt it. It does not
automatically receive upstream bug fixes or security updates.
Snippet
Copy-first distribution
Project-specific, rule-based variant for easier Node.js and Bun copy-paste use. Not an official upstream distribution.
Keeps the published package shape as-is.
Normalized
ESM / TS / normalized
Runtime: node, bun
/**
* Derived from [email protected]
* Rule-based normalized variant generated by this repository.
* Preserve the upstream license and attribution notices when copying this file.
*/
/**
* Derived from [email protected]
* Rule-based normalized variant generated by this repository.
* See THIRD_PARTY_NOTICES.md for upstream license and attribution details.
*/
"use strict";
var numberIsNaN = function (value) {
return value !== value;
};
var implementation = function is(a, b) {
if (a === 0 && b === 0) {
return 1 / a === 1 / b;
}
if (a === b) {
return true;
}
if (numberIsNaN(a) && numberIsNaN(b)) {
return true;
}
return false;
};
var getPolyfill = function getPolyfill() {
return typeof Object.is === "function" ? Object.is : implementation;
};
var shim = function shimObjectIs() {
var polyfill = getPolyfill();
if (typeof Object.defineProperty === "function") {
Object.defineProperty(Object, "is", {
configurable: true,
enumerable: false,
writable: true,
value: polyfill,
});
} else {
Object.is = polyfill;
}
return polyfill;
};
var polyfill = getPolyfill();
polyfill.getPolyfill = getPolyfill;
polyfill.implementation = implementation;
polyfill.shim = shim;
export default polyfill;
Variant note: Bundled from the dependency-free release line, then rule-based normalized for copy-paste into modern TS projects.