This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ES5 | |
| function generateTemplate(template) { | |
| const NAME_PLACEHOLDER = "{{ name }}"; | |
| const GREETING_PLACEHOLDER = "{{ greeting }}"; | |
| return function (greeting) { | |
| return function (name) { | |
| return template | |
| .replace(GREETING_PLACEHOLDER, greeting) | |
| .replace(NAME_PLACEHOLDER, name); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const compose = (...fns) => (value) => | |
| fns.reduceRight((acc, fn) => fn(acc), value); | |
| Math.sqrt(Math.round(parseFloat("143.7"))); | |
| const sqrtUltra = compose( | |
| (value) => `We earned: ${value}`, | |
| (value) => value ** 3, | |
| Math.sqrt, | |
| Math.round, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const fibanachi = (min, max) => Array(max - min).fill(0) | |
| .reduce((acc, _, index) => [...acc, ...(!index ? [min] : (index !== max - min - 1 ? [acc[index - 1] + 1] : [acc[index - 1] + 1, max])) ], []) | |
| .reduce((acc, num, index) => [...acc, !index ? num : acc[index - 1] + num], []); | |
| console.log(fibanachi(10, 13)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "info": { | |
| "title": "Threshold Internal API", | |
| "description": "The API is exclusively for internal purposes", | |
| "version": "1.0.0" | |
| }, | |
| "openapi": "3.0.3", | |
| "servers": [ | |
| { | |
| "url": "/internal" |
OlderNewer