(str, index)
| 163 | } |
| 164 | |
| 165 | function 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 | |
| 190 | module.exports = { |
| 191 | utils: stringHandles, |
nothing calls this directly
no test coverage detected