Files
remark42/frontend/app/utils/shallowCompare.ts
T
Pavel MineevandUmputun 5825a55b69 Update frontend
* change root dit and change way to import modules
* update deps to latest versions
* use latest tools for building bundles
* rewrite webpack config
* use nomodule technique for loading modern bundle
* inject polyfills by babel usebuiltins
* update eslint rules
* rename all style files to CSS
* use postcss preset env for building styles
* proper typescript typing
* put all html files to templates folder
* etc
2021-01-12 13:39:26 -06:00

10 lines
323 B
TypeScript

export default function shallowCompare<T extends Record<string, unknown>>(a: T, b: T): boolean {
const entriesA = Object.entries(a);
const keysB = Object.keys(b);
if (entriesA.length !== keysB.length) return false;
for (const [key, value] of entriesA) {
if (value !== b[key]) return false;
}
return true;
}