src/globalStateLens.js   A
last analyzed

Complexity

Total Complexity 1
Complexity/F 1

Size

Lines of Code 19
Function Count 1

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 6
mnd 0
bc 0
fnc 1
dl 0
loc 19
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10
1
import { lensPath, pipe } from 'ramda'
2
3
/**
4
 * Lens for zooming in the global state.
5
 * @function
6
 */
7
const globalStateLens = lensPath(['store', 'state'])
8
9
/**
10
 * Create a new lens based on the given lens and globalStateLens.
11
 * @function
12
 * @param {function} lens - The lens to zoom into the global state
13
 * @return {function} Composed lens
14
 */
15
export const inGlobalStateLens = lens =>
16
  pipe(
17
    lens,
18
    globalStateLens
19
  )
20