Skip to content

Commit eb9122c

Browse files
authored
feature: add function type handling
1 parent a25ac6f commit eb9122c

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

scripts/example-giver.js

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ function giveExamples(x) {
5454
}
5555
case 'symbol':
5656
return handleSymbol(x);
57+
case 'function':
58+
return handleFunction(x);
5759
default: {
58-
// TODO: "function"
59-
const message = `Not implemented for type ${type}.`;
60+
const message = `I'm surprised that we have ${type}! 😯😯😯`;
6061

6162
console.error(message, x);
6263
throw Error(message);
@@ -255,6 +256,17 @@ function handleSymbol(symbol) {
255256
};
256257
}
257258

259+
/**
260+
* @param {Function} fn
261+
* @returns {Example}
262+
*/
263+
function handleFunction(fn) {
264+
return {
265+
isInfinite: false,
266+
examples: [fn]
267+
};
268+
}
269+
258270
/**
259271
* @param {string} string
260272
* @return {undefined|number}

0 commit comments

Comments
 (0)