debian-mirror-gitlab/app/assets/javascripts/serverless/utils.js

24 lines
724 B
JavaScript
Raw Normal View History

2019-05-18 00:54:41 +05:30
// Validate that the object coming in has valid query details and results
export const validateGraphData = data =>
data.queries &&
Array.isArray(data.queries) &&
data.queries.filter(query => {
if (Array.isArray(query.result)) {
return query.result.filter(res => Array.isArray(res.values)).length === query.result.length;
}
return false;
}).length === data.queries.length;
export const translate = functions =>
functions.reduce(
(acc, func) =>
Object.assign(acc, {
[func.environment_scope]: (acc[func.environment_scope] || []).concat([func]),
}),
{},
);
// prevent babel-plugin-rewire from generating an invalid default during karma tests
export default () => {};