-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathindex.mjs
39 lines (32 loc) · 806 Bytes
/
index.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
function merge(target, source) {
for (const key in source) {
if (typeof source[key] === 'object') {
target[key] = merge({ ...target[key] }, source[key]);
} else {
target[key] = source[key];
}
}
return target;
}
function getValues(obj) {
const values = [];
for (const key in obj) {
const val = obj[key];
if (typeof val === 'object') {
values.push(...getValues(val));
} else {
values.push(val);
}
}
return values;
}
export default function style9(...styles) {
const merged = styles.reduce(merge, {});
return getValues(merged).join(' ');
}
style9.create = () => {
throw new Error('style9.create calls should be compiled away');
};
style9.keyframes = () => {
throw new Error('style9.keyframes calls should be compiled away');
};