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

Function toArray

src/utils/strings.js:31–45  ·  view source on GitHub ↗
(value, sep)

Source from the content-addressed store, hash-verified

29}
30
31export function toArray(value, sep) {
32 if (value === null || value === undefined) {
33 value = [];
34 }
35 if (typeof value === 'string' && sep) {
36 value = value.split(sep);
37 } else if (!(value instanceof Array)) {
38 value = [value.toString()];
39 } else if (sep) {
40 // if use sep, convert every value to string
41 value = value.map((v)=>v.toString());
42 }
43
44 return value;
45}
46
47export function toStyleObject (str) {
48 if (!str) { return undefined; }

Callers 6

constructorFunction · 0.90
setValueFunction · 0.90
constructorMethod · 0.90
setValueMethod · 0.90
validateFunction · 0.90
formatValueFunction · 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…