Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.toString = function (doc) {
return parser.toJSString(doc, ' ');
};
return js.map((stage) => {
return createStage(
Object.keys(stage)[0],
toShellString(Object.values(stage)[0], INDENT),
null
);
});
} catch (e) {
export default function generateStage(state) {
if (!state.isEnabled || !state.stageOperator || state.stage === '') {
return {};
}
const stage = {};
try {
const decommented = decomment(state.stage);
parse(`{${state.stageOperator}: ${decommented}}`);
stage[state.stageOperator] = parser(decommented);
} catch (e) {
state.syntaxError = e.message;
state.isValid = false;
state.previewDocuments = [];
return {};
}
state.isValid = true;
state.syntaxError = null;
return stage;
}
export const collationChanged = (collation) => {
return {
type: COLLATION_CHANGED,
collation: queryParser.isCollationValid(collation)
};
};
export const createPipeline = (text) => {
try {
const jsText = transpiler[SHELL][JS].compile(text);
const js = parseFilter(jsText);
return js.map((stage) => {
return createStage(
Object.keys(stage)[0],
toShellString(Object.values(stage)[0], INDENT),
null
);
});
} catch (e) {
return [ createStage(null, '', e.message) ];
}
};