44// the @ts -check directive. It will give you helpful autocompletion when
55// implementing this exercise.
66
7+ /**
8+ * @typedef {function (number, number): [number, number] } CallbackType
9+ */
10+
711/**
812 * Create a function that returns a function making use of a closure to
913 * perform a repeatable 2d translation of a coordinate pair.
1014 *
1115 * @param {number } dx the translate x component
1216 * @param {number } dy the translate y component
1317 *
14- * @returns {function } a function which takes an x, y parameter, returns the
18+ * @returns {CallbackType } a function which takes an x, y parameter, returns the
1519 * translated coordinate pair in the form [x, y]
1620 */
1721export function translate2d ( dx , dy ) {
@@ -25,7 +29,7 @@ export function translate2d(dx, dy) {
2529 * @param {number } sx the amount to scale the x component
2630 * @param {number } sy the amount to scale the y component
2731 *
28- * @returns {function } a function which takes an x, y parameter, returns the
32+ * @returns {CallbackType } a function which takes an x, y parameter, returns the
2933 * scaled coordinate pair in the form [x, y]
3034 */
3135export function scale2d ( sx , sy ) {
@@ -39,7 +43,7 @@ export function scale2d(sx, sy) {
3943 * @param {function } f the first function to apply
4044 * @param {function } g the second function to apply
4145 *
42- * @returns {function } a function which takes an x, y parameter, returns the
46+ * @returns {CallbackType } a function which takes an x, y parameter, returns the
4347 * transformed coordinate pair in the form [x, y]
4448 */
4549export function composeTransform ( f , g ) {
@@ -52,7 +56,7 @@ export function composeTransform(f, g) {
5256 *
5357 * @param {function } f the transformation function to memoize, assumes takes two arguments 'x' and 'y'
5458 *
55- * @returns {function } a function which takes x and y arguments, and will either return the saved result
59+ * @returns {CallbackType } a function which takes x and y arguments, and will either return the saved result
5660 * if the arguments are the same on subsequent calls, or compute a new result if they are different.
5761 */
5862export function memoizeTransform ( f ) {
0 commit comments