summaryrefslogtreecommitdiff
path: root/spec/frontend/diffs/find_interop_attributes.js
blob: d2266b20e160a68c08b508e69ef310d9f1cf6b25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
export const findInteropAttributes = (parent, sel) => {
  const target = sel ? parent.find(sel) : parent;

  if (!target.exists()) {
    return null;
  }

  const type = target.attributes('data-interop-type');

  if (!type) {
    return null;
  }

  return {
    type,
    line: target.attributes('data-interop-line'),
    oldLine: target.attributes('data-interop-old-line'),
    newLine: target.attributes('data-interop-new-line'),
  };
};