is-left-hand-side.js 420 B

12345678910111213
  1. 'use strict';
  2. // Keep logic sync with `../selector/not-left-hand-side.js`
  3. const isLeftHandSide = node =>
  4. (node.parent.type === 'AssignmentExpression' && node.parent.left === node)
  5. || (node.parent.type === 'UpdateExpression' && node.parent.argument === node)
  6. || (
  7. node.parent.type === 'UnaryExpression'
  8. && node.parent.operator === 'delete'
  9. && node.parent.argument === node
  10. );
  11. module.exports = isLeftHandSide;