MCPcopy Index your code
hub / github.com/Lobos/react-ui / toStyleObject

Function toStyleObject

src/utils/strings.js:47–68  ·  view source on GitHub ↗
(str)

Source from the content-addressed store, hash-verified

45}
46
47export function toStyleObject (str) {
48 if (!str) { return undefined; }
49
50 let style = {};
51 let kv;
52 str.split(';').forEach((s) => {
53 s = s.trim();
54 if (!s) { return; }
55
56 kv = s.split(':');
57 if (kv.length < 2) {
58 console.warn('style is error');
59 return;
60 }
61 let key = kv[0].replace(/-./g, (r) => {
62 return r.replace('-','').toUpperCase();
63 }).trim();
64 style[key] = kv[1].trim();
65 });
66
67 return style;
68}

Callers 1

renderMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…