Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const appendCSS = css =>
unless(
always(isEmptyString(css)),
compose(joinWithNewline, appendFlipped([css]))
)
private async validateData (functionBindings: ICheckMarkerFunctionBindings, validatedCheck: ValidatedCheck, logger: ILogger): Promise {
if (RA.isEmptyString(validatedCheck.answers)) {
await this.updateReceivedCheckWithMarkingError(validatedCheck, 'answers property not populated')
return
}
let parsedAnswersJson: any
try {
parsedAnswersJson = JSON.parse(validatedCheck.answers)
} catch (error) {
await this.updateReceivedCheckWithMarkingError(validatedCheck, 'answers data is not valid JSON')
return
}
if (!RA.isArray(parsedAnswersJson)) {
await this.updateReceivedCheckWithMarkingError(validatedCheck, 'answers data is not an array')
return
}
R.forEach(f => {
if (!f.fieldValue || RA.isEmptyString(f.fieldValue && f.fieldValue.trim())) {
validationError.addError(f.fieldKey, f.errorMessage)
}
}, fields)
return validationError