How to use the ramda-adjunct.isArray 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.

github Undistraction / cssapi-mq / src / renderers / cssRenderers / queryRenderer.js View on Github external
map(element => {
    if (isArray(element)) {
      // Only add prefix if no media type is declared
      if (arrayContainsMediaType(element)) {
        return element
      }
      return [defaultMediaType, ...element]
    }
    if (containsMediaType(element)) {
      return element
    }
    return joinAnd([defaultMediaType, element])
  })(elements)
github DFEAGILEDEVOPS / MTC / tslib / src / functions / check-marker / check-marker.v1.ts View on Github external
private async validateData (functionBindings: ICheckMarkerFunctionBindings, validatedCheck: ReceivedCheckTableEntity, logger: ILogger): Promise<MarkingData | void> {
    if (RA.isNilOrEmpty(validatedCheck.answers)) {
      await this.updateReceivedCheckWithMarkingError(validatedCheck, 'answers property not populated')
      return
    }
    let parsedAnswersJson: any
    try {
      // tsc does not recognise the RA.IsNilOrEmpty check above
      // therefore we use the exclamanation to assert non null guarantee
      parsedAnswersJson = JSON.parse(validatedCheck.answers!)
    } catch (error) {
      logger.error(error)
      return this.updateReceivedCheckWithMarkingError(validatedCheck, 'answers data is not valid JSON')
    }

    if (!RA.isArray(parsedAnswersJson)) {
      return this.updateReceivedCheckWithMarkingError(validatedCheck, 'answers data is not an array')
    }

    const checkCode = validatedCheck.RowKey
    let rawCheckForm

    try {
      rawCheckForm = await this.sqlService.getCheckFormDataByCheckCode(checkCode)
    } catch (error) {
      logger.error(error)
      return this.updateReceivedCheckWithMarkingError(validatedCheck, `checkForm lookup failed:${error.message}`)
    }

    if (R.isNil(rawCheckForm)) {
      return this.updateReceivedCheckWithMarkingError(validatedCheck, 'associated checkForm could not be found by checkCode')
    }
github DFEAGILEDEVOPS / MTC / tslib / src / tests-integration / sql.service.integration.spec.ts View on Github external
test('supplied parameters are applied to the query', async () => {
    const schoolId = 1
    const params = [
      {
        name: 'schoolId',
        value: schoolId,
        type: mssql.Int
      }
    ]
    const sql = 'SELECT TOP 1 * FROM [mtc_admin].school WHERE id=@schoolId'
    const result = await sut.query(sql, params)
    expect(result).toBeDefined()
    expect(RA.isArray(result)).toBe(true)
    expect(result.length).toBe(1)
    const school = result[0]
    expect(RA.isObj(school)).toBe(true)
    expect(school.id).toEqual(schoolId)
  })
github DFEAGILEDEVOPS / MTC / functions-app / report-psychometrician / spec / detections / input-after-the-timer-has-completed.spec.js View on Github external
it('returns an empty array if no anomalies were found', () => {
    const r = detectInputAfterTheTimerHasCompleted({})
    expect(RA.isArray(r)).toBe(true)
  })
github DFEAGILEDEVOPS / MTC / functions-app / report-psychometrician / service / check-processing.service.js View on Github external
anomalyData.forEach(data => {
            if (RA.isArray(data)) {
              data.forEach(innerData => {
                checkProcessingService.writeCsv(inputStream, anomalyCsvStream, innerData)
              })
            } else {
              checkProcessingService.writeCsv(inputStream, anomalyCsvStream, data)
            }
          })
          meta.processCount += 1
github cablelabs / lpwanserver / ui / src / utils / generalUtils.js View on Github external
export const arrayify = input => isArray(input) ? input : [input];
github DFEAGILEDEVOPS / MTC / functions-app / report-psychometrician / spec / detections / filter-input-for-questions.spec.js View on Github external
input: '',
          eventType: '',
          clientTimestamp: '',
          question: '4x2',
          sequenceNumber: 1
        },
        {
          input: '',
          eventType: '',
          clientTimestamp: '',
          question: '4x2',
          sequenceNumber: 2
        }
      ]
    )
    expect(RA.isArray(r)).toBe(true)
    expect(r.length).toBe(1)
  })
})