Add yet-another-react-lightbox package and update .gitignore to exclude node_modules

This commit is contained in:
IGNY8 VPS (Salman)
2025-11-12 18:50:30 +00:00
parent bd2a5570a9
commit c92f4a5edd
9304 changed files with 29 additions and 2008667 deletions

View File

@@ -1 +0,0 @@
export declare function shallow<T>(valueA: T, valueB: T): boolean;

View File

@@ -1,57 +0,0 @@
'use strict';
const isIterable = (obj) => Symbol.iterator in obj;
const hasIterableEntries = (value) => (
// HACK: avoid checking entries type
"entries" in value
);
const compareEntries = (valueA, valueB) => {
const mapA = valueA instanceof Map ? valueA : new Map(valueA.entries());
const mapB = valueB instanceof Map ? valueB : new Map(valueB.entries());
if (mapA.size !== mapB.size) {
return false;
}
for (const [key, value] of mapA) {
if (!mapB.has(key) || !Object.is(value, mapB.get(key))) {
return false;
}
}
return true;
};
const compareIterables = (valueA, valueB) => {
const iteratorA = valueA[Symbol.iterator]();
const iteratorB = valueB[Symbol.iterator]();
let nextA = iteratorA.next();
let nextB = iteratorB.next();
while (!nextA.done && !nextB.done) {
if (!Object.is(nextA.value, nextB.value)) {
return false;
}
nextA = iteratorA.next();
nextB = iteratorB.next();
}
return !!nextA.done && !!nextB.done;
};
function shallow(valueA, valueB) {
if (Object.is(valueA, valueB)) {
return true;
}
if (typeof valueA !== "object" || valueA === null || typeof valueB !== "object" || valueB === null) {
return false;
}
if (Object.getPrototypeOf(valueA) !== Object.getPrototypeOf(valueB)) {
return false;
}
if (isIterable(valueA) && isIterable(valueB)) {
if (hasIterableEntries(valueA) && hasIterableEntries(valueB)) {
return compareEntries(valueA, valueB);
}
return compareIterables(valueA, valueB);
}
return compareEntries(
{ entries: () => Object.entries(valueA) },
{ entries: () => Object.entries(valueB) }
);
}
exports.shallow = shallow;