MCPcopy Create free account
hub / github.com/react-component/select / separate

Function separate

src/utils/valueUtil.ts:123–132  ·  view source on GitHub ↗
(str: string, [token, ...restTokens]: string[])

Source from the content-addressed store, hash-verified

121 }
122 let match = false;
123 const separate = (str: string, [token, ...restTokens]: string[]): string[] => {
124 if (!token) {
125 return [str];
126 }
127 const list = str.split(token);
128 match = match || list.length > 1;
129 return list
130 .reduce((prevList, unitStr) => [...prevList, ...separate(unitStr, restTokens)], [])
131 .filter(Boolean);
132 };
133 const list = separate(text, tokens);
134 if (match) {
135 return typeof end !== 'undefined' ? list.slice(0, end) : list;

Callers 1

getSeparatedContentFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…