MCPcopy Create free account
hub / github.com/FlashpointProject/launcher / parseApplication

Function parseApplication

src/back/extensions/ExtensionsScanner.ts:250–266  ·  view source on GitHub ↗
(parser: IObjectParserProp<Application>)

Source from the content-addressed store, hash-verified

248}
249
250function parseApplication(parser: IObjectParserProp<Application>): Application {
251 const application: Application = {
252 provides: [],
253 arguments: [],
254 name: '',
255 };
256 parser.prop('provides').arrayRaw((item) => application.provides.push(str(item)));
257 parser.prop('name', v => application.name = str(v));
258 parser.prop('command', v => application.command = str(v), true);
259 parser.prop('arguments', true).arrayRaw(v => application.arguments.push(str(v)));
260 parser.prop('path', v => application.path = str(v), true);
261 parser.prop('url', v => application.url = str(v), true);
262 const numDefined = num(!!application.command) + num(!!application.path) + num(!!application.url);
263 if (numDefined !== 1) { throw new Error('Exactly one "path", "url" or "command" variable must be defined for an application, not both.'); }
264 if (application.provides.length === 0) { throw new Error('Application must provide something. (Empty provides array)'); }
265 return application;
266}
267
268function parseConfiguration(parser: IObjectParserProp<ExtConfiguration>): ExtConfiguration {
269 const configuration: ExtConfiguration = {

Callers 1

parseContributionsFunction · 0.85

Calls 5

strFunction · 0.85
numFunction · 0.85
arrayRawMethod · 0.65
propMethod · 0.65
pushMethod · 0.65

Tested by

no test coverage detected