How to use the ramda-adjunct.isEmptyArray function in ramda-adjunct

To help you get started, we’ve selected a few ramda-adjunct examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DFEAGILEDEVOPS / MTC / tslib / src / functions / check-marker / check-marker.v1.ts View on Github external
}

    if (R.isNil(rawCheckForm)) {
      return this.updateReceivedCheckWithMarkingError(validatedCheck, 'associated checkForm could not be found by checkCode')
    }

    let checkForm: any

    try {
      checkForm = JSON.parse(rawCheckForm)
    } catch (error) {
      logger.error(error)
      return this.updateReceivedCheckWithMarkingError(validatedCheck, 'associated checkForm data is not valid JSON')
    }

    if (!RA.isArray(checkForm) || RA.isEmptyArray(checkForm)) {
      return this.updateReceivedCheckWithMarkingError(validatedCheck, 'check form data is either empty or not an array')
    }

    const toReturn: MarkingData = {
      answers: parsedAnswersJson,
      formQuestions: checkForm,
      results: []
    }
    return toReturn
  }
github DFEAGILEDEVOPS / MTC / tslib / src / functions / check-marker / check-marker.v1.ts View on Github external
if (R.isNil(rawCheckForm)) {
      await this.updateReceivedCheckWithMarkingError(validatedCheck, 'associated checkForm could not be found by checkCode')
      return
    }

    let checkForm: any

    try {
      checkForm = JSON.parse(rawCheckForm)
    } catch (error) {
      await this.updateReceivedCheckWithMarkingError(validatedCheck, 'associated checkForm data is not valid JSON')
      return
    }

    if (!RA.isArray(checkForm) || RA.isEmptyArray(checkForm)) {
      await this.updateReceivedCheckWithMarkingError(validatedCheck, 'check form data is either empty or not an array')
      return
    }

    const toReturn: MarkingData = {
      answers: parsedAnswersJson,
      formQuestions: checkForm,
      results: []
    }
    return toReturn
  }
github DFEAGILEDEVOPS / MTC / tslib / src / functions / check-marker / check-marker.v1.ts View on Github external
private findValidatedCheck (receivedCheckRef: Array): ReceivedCheckTableEntity {
    if (RA.isEmptyArray(receivedCheckRef)) {
      throw new Error('received check reference is empty')
    }
    return receivedCheckRef[0]
  }
github DFEAGILEDEVOPS / MTC / tslib / src / functions / check-marker / check-marker.v1.ts View on Github external
private findValidatedCheck (receivedCheckRef: Array): ValidatedCheck {
    if (RA.isEmptyArray(receivedCheckRef)) {
      throw new Error('received check reference is empty')
    }
    return receivedCheckRef[0]
  }
github DFEAGILEDEVOPS / MTC / tslib / src / functions / check-validator / check-validator.v1.ts View on Github external
private validateCheckStructure (check: object) {
    const errorMessagePrefix = 'submitted check is missing the following properties:'
    const missingProperties: string[] = []
    for (let index = 0; index < requiredSubmittedCheckProperties.length; index++) {
      const propertyName = requiredSubmittedCheckProperties[index]
      if (!check.hasOwnProperty(propertyName)) {
        missingProperties.push(propertyName)
      }
    }
    const missingPropertyNames = missingProperties.join()
    if (!RA.isEmptyArray(missingProperties)) {
      throw new Error(`${errorMessagePrefix} ${missingPropertyNames}`)
    }
  }
}