src/utils/object-contains.js   A
last analyzed

Complexity

Total Complexity 2
Complexity/F 1

Size

Lines of Code 4
Function Count 2

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 3
mnd 0
bc 0
fnc 2
dl 0
loc 4
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
/**
2
 * Check if object a contains another object b by shallow equal.
3
 *
4
 * @param  {object} a - The bigger object.
5
 * @param  {object} b - The smaller object.
6
 * @returns {boolean}   If contains.
7
 */
8
const objectContains = (a, b) =>
9
  Object.keys(b).every((keyName) => b[keyName] === a[keyName]);
10
11
export default objectContains;
12