# All files / utils index.js

100% Statements 15/15
100% Branches 7/7
100% Functions 3/3
100% Lines 15/15

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    3026x
    11x

    1x

    1x

    9x
    27x
    27x
    27x
    27x
    27x

    26x
    11x

    7x

    1x

    3x

     const getCircles = (n, offset = 0) => {
      switch (n) {
        case 0:
          return [];
        case 1:
          return [[0, 0]];
        default:
          return [...Array(n).keys()].map((i) => {
            const fraccion = (parseFloat(i) / parseFloat(n));
            const rads = (fraccion * 2 * Math.PI) + offset;
            const x = Math.cos(rads);
            const y = Math.sin(rads);
            return [x, y];
          });
      }
    };

    const niceCircles = (n) => {
      switch (n) {
        case 3:
          return getCircles(n, -Math.PI / 2);
        case 4:
          return getCircles(n, -Math.PI / 4);
        default:
          return getCircles(n);
      }
    };

    export { niceCircles };