UNPKG

974 BJavaScriptView Raw
1'use strict';
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6
7var _lodash = require('lodash');
8
9var _lodash2 = _interopRequireDefault(_lodash);
10
11function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
13var styleNameIndex = {};
14
15exports.default = function (styleNamePropertyValue, allowMultiple) {
16 var styleNames = void 0;
17
18 if (styleNameIndex[styleNamePropertyValue]) {
19 styleNames = styleNameIndex[styleNamePropertyValue];
20 } else {
21 styleNames = _lodash2.default.trim(styleNamePropertyValue).split(' ');
22 styleNames = _lodash2.default.filter(styleNames);
23
24 styleNameIndex[styleNamePropertyValue] = styleNames;
25 }
26
27 if (allowMultiple === false && styleNames.length > 1) {
28 throw new Error('ReactElement styleName property defines multiple module names ("' + styleNamePropertyValue + '").');
29 }
30
31 return styleNames;
32};
33
34module.exports = exports['default'];
\No newline at end of file