mirror of
https://github.com/github/codeql-action.git
synced 2025-12-27 01:30:10 +08:00
16 lines
633 B
JavaScript
16 lines
633 B
JavaScript
'use strict';
|
|
function parseTestArgs(args) {
|
|
const rawTitle = typeof args[0] === 'string' ? args.shift() : undefined;
|
|
const receivedImplementationArray = Array.isArray(args[0]);
|
|
const implementations = receivedImplementationArray ? args.shift() : args.splice(0, 1);
|
|
|
|
const buildTitle = implementation => {
|
|
const title = implementation.title ? implementation.title(rawTitle, ...args) : rawTitle;
|
|
return {title, isSet: typeof title !== 'undefined', isValid: typeof title === 'string', isEmpty: !title};
|
|
};
|
|
|
|
return {args, buildTitle, implementations, rawTitle, receivedImplementationArray};
|
|
}
|
|
|
|
module.exports = parseTestArgs;
|