How to use the esprima.Syntax.BinaryExpression function in esprima

To help you get started, we’ve selected a few esprima examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github stryker-mutator / stryker / packages / stryker / src / mutators / BinaryOperatorMutator.ts View on Github external
import { Syntax } from 'esprima';
import * as estree from 'estree';
import NodeMutator from './NodeMutator';
import { IdentifiedNode } from './IdentifiedNode';

export default class BinaryOperatorMutator implements NodeMutator {
  public name = 'BinaryOperator';
  private readonly type = Syntax.BinaryExpression;
  private readonly operators: { [targetedOperator: string]: estree.BinaryOperator | estree.BinaryOperator[] } = {
    '!=': '==',
    '!==': '===',
    '%': '*',
    '*': '/',
    '+': '-',
    '-': '+',
    '/': '*',
    '<': ['<=', '>='],
    '<=': ['<', '>'],
    '==': '!=',
    '===': '!==',
    '>': ['>=', '<='],
    '>=': ['>', '<']
  };
github stryker-mutator / stryker / src / mutators / ConditionalBoundaryMutator.ts View on Github external
constructor() {
    super('ConditionalBoundary', [Syntax.BinaryExpression], {
      '<': '<=',
      '<=': '<',
      '>': '>=',
      '>=': '>'
    });
  }
github stryker-mutator / stryker / src / mutators / MathMutator.ts View on Github external
constructor () {
   super('Math', [Syntax.BinaryExpression], {
      '+': '-',
      '-': '+',
      '*': '/',
      '/': '*',
      '%': '*'});
  }