(plugins_: {plugins: string[]})
| 227 | } |
| 228 | |
| 229 | function toDependencies(plugins_: {plugins: string[]}) { |
| 230 | const obj: Record<string, string> = {}; |
| 231 | plugins_.plugins.forEach((plugin) => { |
| 232 | const regex = /.(@|#)/; |
| 233 | const match = regex.exec(plugin); |
| 234 | |
| 235 | if (match) { |
| 236 | const index = match.index + 1; |
| 237 | const pieces: string[] = []; |
| 238 | |
| 239 | pieces[0] = plugin.substring(0, index); |
| 240 | pieces[1] = plugin.substring(index + 1, plugin.length); |
| 241 | obj[pieces[0]] = pieces[1]; |
| 242 | } else { |
| 243 | obj[plugin] = 'latest'; |
| 244 | } |
| 245 | }); |
| 246 | return obj; |
| 247 | } |
| 248 | |
| 249 | export const subscribe = (fn: Function) => { |
| 250 | watchers.push(fn); |
no test coverage detected