# All files / src/generator assignment.js

100% Statements 8/8
100% Branches 0/0
100% Functions 1/1
100% Lines 8/8

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    22x
    22x
    22x

    22x
    31x
    31x

    31x

    31x

     // @flow
    import mapSyntax from "./map-syntax";
    import { setInScope } from "./utils";
    import mergeBlock from "./merge-block";
    import type { GeneratorType } from "./flow/types";

    const generateAssignment: GeneratorType = node => {
      const [target, value] = node.params;
      const block = [value].map(mapSyntax(null)).reduce(mergeBlock, []);

      block.push(setInScope(target));

      return block;
    };

    export default generateAssignment;