src/app/lib/utilities/imageSrcHelpers/originCode.js

Summary

Maintainability
A
0 mins
Test Coverage
B
87%
const getOriginCode = path => {
  if (!path || path.indexOf('/') === -1) {
    return null;
  }

  const items = path.slice(1).split('/');
  const [originCode] = items;
  if (!originCode) {
    return null;
  }
  return originCode;
};

export default getOriginCode;