1 | import memoize from './memoize';
|
2 |
|
3 | export default memoize(declaration => {
|
4 | const [property, value] = declaration.split(': ');
|
5 | const camelCaseProperty = property.replace(/-(\w)/g, (_, letter) => letter.toUpperCase());
|
6 | const div = document.createElement('div');
|
7 | if (div.style[camelCaseProperty] === undefined) {
|
8 | return false;
|
9 | }
|
10 |
|
11 | if (value) {
|
12 | div.style[camelCaseProperty] = value;
|
13 | return Boolean(div.style[camelCaseProperty]);
|
14 | }
|
15 |
|
16 | return true;
|
17 | });
|