MCPcopy Create free account
hub / github.com/ionic-team/ionic-framework / shallowEqualStringMap

Function shallowEqualStringMap

core/src/utils/helpers.ts:363–390  ·  view source on GitHub ↗
(
  map1: { [k: string]: any } | undefined,
  map2: { [k: string]: any } | undefined
)

Source from the content-addressed store, hash-verified

361 * @returns whether the keys are the same and the values are shallow equal.
362 */
363export const shallowEqualStringMap = (
364 map1: { [k: string]: any } | undefined,
365 map2: { [k: string]: any } | undefined
366): boolean => {
367 map1 ??= {};
368 map2 ??= {};
369
370 if (map1 === map2) {
371 return true;
372 }
373
374 const keys1 = Object.keys(map1);
375
376 if (keys1.length !== Object.keys(map2).length) {
377 return false;
378 }
379
380 for (const k1 of keys1) {
381 if (!(k1 in map2)) {
382 return false;
383 }
384 if (map1[k1] !== map2[k1]) {
385 return false;
386 }
387 }
388
389 return true;
390};
391
392/**
393 * Checks input for usable number. Not NaN and not Infinite.

Callers 2

setRootMethod · 0.90
matchesFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected