DEV Community

Discussion on: VS Code Extension that Generates Documentation Using AI

Collapse
 
pengeszikra profile image
Peter Vivo

Half success, don't recognise the arrow function return value

/**
 * Given two intervals, return the union of the two intervals.
 * @returns None
 */
export const union = ([Vm, VM], [Bm, BM]) => [ Math.max(Vm, Bm), Math.min(VM, BM)];

/**
 * Given a viewport and a bounding box, return the part of the bounding box that is visible in the
 * viewport.
 * @param view - the viewport, a 2-element array of the form [x, y]
 * @param box - the box to clip against
 * @param [] - `view` is the viewport, which is a box with two numbers.
 * @returns None
 */
export const clip = ( view, box, [a, b] = union(view, box)) => b > a ? [a, b] : false;
Enter fullscreen mode Exit fullscreen mode