in packages/babel-plugin-idx/src/babel-plugin-idx.js [126:152]
function makeChain(node, state, inside) {
if (t.isMemberExpression(node)) {
return makeChain(
node.object,
state,
makeCondition(
t.MemberExpression(state.temp, node.property, node.computed),
state,
inside,
),
);
} else if (t.isIdentifier(node)) {
if (node.name !== state.base.name) {
throw state.file.buildCodeFrameError(
node,
'The parameter of the arrow function supplied to `idx` must match ' +
'the base of the body expression.',
);
}
return makeCondition(state.input, state, inside);
} else {
throw state.file.buildCodeFrameError(
node,
'idx callbacks may only access properties on the callback parameter.',
);
}
}