dataPath.js 257 B

123456789
  1. function appendDataPath(dataPath, relationOrIndex) {
  2. const token =
  3. typeof relationOrIndex === 'number' ? `[${relationOrIndex}]` : `.${relationOrIndex.name}`;
  4. return dataPath ? `${dataPath}${token}` : token;
  5. }
  6. module.exports = {
  7. appendDataPath
  8. };