"use strict";

var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.toArray = toArray;
exports.getFieldId = getFieldId;

var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));

function toArray(candidate) {
  if (candidate === undefined || candidate === false) return [];
  return Array.isArray(candidate) ? candidate : [candidate];
}

function getFieldId(namePath, formName) {
  var _context;

  if (!namePath.length) return undefined;
  var mergedId = namePath.join('_');
  return formName ? (0, _concat["default"])(_context = "".concat(formName, "_")).call(_context, mergedId) : mergedId;
}