function _getAnyValue (getter, connector, inputName, index, fieldName) {
  const numberVal = ref.alloc('double')
  const boolVal = ref.alloc('int')
  const stringVal = ref.alloc('char *')
  let selection = ref.alloc('int')
  const retcode = getter(
    connector,
    numberVal,
    boolVal,
    stringVal,
    selection,
    inputName,
    index + 1,
    fieldName)
  _checkRetcode(retcode)
  if (retcode === _ReturnCodes.noData) {
    return null
  }
  selection = selection.deref()
  if (selection === _AnyValueKind.connector_number) {
    return numberVal.deref()
  } else if (selection === _AnyValueKind.connector_boolean) {
    return !!boolVal.deref()
  } else if (selection === _AnyValueKind.connector_string) {
    const nodeStr = _moveCString(stringVal.deref())
    // Try to convert the returned string to a JSON object. We can now return
    // one of two things:
    // - An actual string (if the JSON.parse call fails)
    // - A JSON object (if the JSON.parse call succeeds)
    try {
      return JSON.parse(nodeStr)
    } catch (err) {
      return nodeStr
    }
  } else {
    // This shouldn't happen
    throw new Error('Unexpected type returned by ' + getter.name)
  }
}
/**
 * Function used to get any value from either the samples or infos (depending
 * on the supplied getter). The type of the fieldName need not be specified.
 *
 * @param {function} getter - The function to use to get the value
 * @param {Connector} connector - The Connector
 * @param {string} inputName - The name of the input to access
 * @param {number} index - The index in the samples / infos array
 * @param {string} fieldName - The name of the fields to obtain
 *
 * @private
 */
Function used to get any value from either the samples or infos (depending
on the supplied getter). The type of the fieldName need not be specified.



@private
Function used to get any value from either the samples or infos ( depending on the supplied getter ) . The type of the fieldName need not be specified . @private
function _getAnyValue (getter, connector, inputName, index, fieldName) {
  const numberVal = ref.alloc('double')
  const boolVal = ref.alloc('int')
  const stringVal = ref.alloc('char *')
  let selection = ref.alloc('int')
  const retcode = getter(
    connector,
    numberVal,
    boolVal,
    stringVal,
    selection,
    inputName,
    index + 1,
    fieldName)
  _checkRetcode(retcode)
  if (retcode === _ReturnCodes.noData) {
    return null
  }
  selection = selection.deref()
  if (selection === _AnyValueKind.connector_number) {
    return numberVal.deref()
  } else if (selection === _AnyValueKind.connector_boolean) {
    return !!boolVal.deref()
  } else if (selection === _AnyValueKind.connector_string) {
    const nodeStr = _moveCString(stringVal.deref())
    try {
      return JSON.parse(nodeStr)
    } catch (err) {
      return nodeStr
    }
  } else {
    throw new Error('Unexpected type returned by ' + getter.name)
  }
}
function _getAnyValue ( getter , connector , inputName , index , fieldName ) { const numberVal = ref . alloc ( 'double' ) const boolVal = ref . alloc ( 'int' ) const stringVal = ref . alloc ( 'char *' ) let selection = ref . alloc ( 'int' ) const retcode = getter ( connector , numberVal , boolVal , stringVal , selection , inputName , index + 1 , fieldName ) _checkRetcode ( retcode ) if ( retcode === _ReturnCodes . noData ) { return null } selection = selection . deref ( ) if ( selection === _AnyValueKind . connector_number ) { return numberVal . deref ( ) } else if ( selection === _AnyValueKind . connector_boolean ) { return ! ! boolVal . deref ( ) } else if ( selection === _AnyValueKind . connector_string ) { const nodeStr = _moveCString ( stringVal . deref ( ) ) try { return JSON . parse ( nodeStr ) } catch ( err ) { return nodeStr } } else { throw new Error ( 'Unexpected type returned by ' + getter . name ) } }
Function used to get any value from either the samples or infos (depending
 on the supplied getter).
Function used to get any value from either the samples or infos ( depending on the supplied getter ) .
// Try to convert the returned string to a JSON object. We can now return // one of two things: // - An actual string (if the JSON.parse call fails) // - A JSON object (if the JSON.parse call succeeds) // This shouldn't happen