function createVariableNodes(variables) {
  // Group variables
  let variableByIdByLang = Arrays.groupBy(
    variables,
    // By ID
    v => v['observationVariableDbId'],
    // By language (with DEFAULT_DATA_LANG as a default)
    v => (v['language'] || DEFAULT_DATA_LANG).toLowerCase()
  )

  // Transform to tree node
  return $.map(variableByIdByLang, createVariableNode)
}
/**
 * Create tree nodes from BrAPI variables
 */
Create tree nodes from BrAPI variables
Create tree nodes from BrAPI variables
function createVariableNodes(variables) {
  let variableByIdByLang = Arrays.groupBy(
    variables,
    v => v['observationVariableDbId'],
    v => (v['language'] || DEFAULT_DATA_LANG).toLowerCase()
  )
  return $.map(variableByIdByLang, createVariableNode)
}
function createVariableNodes ( variables ) { let variableByIdByLang = Arrays . groupBy ( variables , v => v [ 'observationVariableDbId' ] , v => ( v [ 'language' ] || DEFAULT_DATA_LANG ) . toLowerCase ( ) ) return $ . map ( variableByIdByLang , createVariableNode ) }
Create tree nodes from BrAPI variables
Create tree nodes from BrAPI variables
// Group variables // By ID // By language (with DEFAULT_DATA_LANG as a default) // Transform to tree node