1 | import {
|
2 | inc,
|
3 | compose,
|
4 | map,
|
5 | zipObj,
|
6 | prop,
|
7 | toPairs,
|
8 | findIndex,
|
9 | propEq,
|
10 | nth,
|
11 | } from 'ramda';
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 | export const propEqName = propEq('name');
|
22 | const propName = prop('name');
|
23 | const zipToNameAndValue = zipObj(['name', 'value']);
|
24 |
|
25 | const findBreakpointIndex = (breakpoint, breakpointsArray) =>
|
26 | findIndex(propEqName(breakpoint))(breakpointsArray);
|
27 |
|
28 | export const toBreakpointArray = compose(map(zipToNameAndValue), toPairs);
|
29 |
|
30 | export const getUpperLimit = (breakpointsArray, breakpoint) => {
|
31 | const index = findBreakpointIndex(breakpoint, breakpointsArray);
|
32 | return compose(propName, nth(inc(index)))(breakpointsArray);
|
33 | };
|