1 | ;
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = solveClass;
|
7 |
|
8 | var _lodash = require('lodash');
|
9 |
|
10 | function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; } /**
|
11 | * React Blessed Classes Solving
|
12 | * ==============================
|
13 | *
|
14 | * Solving a component's classes to apply correct props to an element.
|
15 | */
|
16 |
|
17 |
|
18 | /**
|
19 | * Solves the given props by applying classes.
|
20 | *
|
21 | * @param {object} props - The component's props.
|
22 | * @return {object} - The solved props.
|
23 | */
|
24 | function solveClass(props) {
|
25 | var classes = props.class,
|
26 | rest = _objectWithoutProperties(props, ['class']);
|
27 |
|
28 | // Coercing to array & compacting
|
29 |
|
30 |
|
31 | classes = (0, _lodash.compact)([].concat(classes));
|
32 |
|
33 | return _lodash.merge.apply(null, [{}].concat(classes).concat(rest));
|
34 | } |
\ | No newline at end of file |