department-of-veterans-affairs/vets-website

View on GitHub
src/platform/utilities/data/checkValidPath.js

Summary

Maintainability
A
50 mins
Test Coverage
/**
 * If the path contains invalid segments, throws an error.
 */
export default function checkValidPath(arrayPath) {
  if (arrayPath.some(e => e === undefined && e === null)) {
    throw new Error(
      "Path is invalid; please make sure it doesn't contain undefined or null segments",
    );
  }
}