MCPcopy
hub / github.com/YMFE/yapi / handleSegment

Function handleSegment

common/power-string.js:165–188  ·  view source on GitHub ↗
(str, index)

Source from the content-addressed store, hash-verified

163}
164
165function handleSegment(str, index) {
166 str = str.trim();
167 if (index === 0) {
168 return _handleValue(str);
169 }
170
171 let method,
172 args = [];
173 if (str.indexOf(methodAndArgsSeparateChar) > 0) {
174 str = str.split(methodAndArgsSeparateChar);
175 method = str[0].trim();
176 args = str[1].split(argsSeparateChar).map(item => _handleValue(item.trim()));
177 } else {
178 method = str;
179 }
180 if (typeof stringHandles[method] !== 'function') {
181 throw new Error(`This method name(${method}) is not exist.`);
182 }
183
184 return {
185 method,
186 args
187 };
188}
189
190module.exports = {
191 utils: stringHandles,

Callers

nothing calls this directly

Calls 1

_handleValueFunction · 0.85

Tested by

no test coverage detected