Skip to content

Instantly share code, notes, and snippets.

View htndev's full-sized avatar
💭
400 Bad repositories.

Oleksandr Vanilchuk htndev

💭
400 Bad repositories.
View GitHub Profile
// 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);
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,
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));
{
"info": {
"title": "Threshold Internal API",
"description": "The API is exclusively for internal purposes",
"version": "1.0.0"
},
"openapi": "3.0.3",
"servers": [
{
"url": "/internal"