Instantly share code, notes, and snippets.

🎯
Focusing

# Krzysztof NowakKMNowak

🎯
Focusing
• Sort options
Created Dec 13, 2019
 // Write a function that receives two sequences: // A and B of integers and returns one sequence C. // Sequence C should contain all elements from sequence A (maintaining the order) // except those, that are present in sequence B p times, where p is a prime number. // Example: // A=[2,3,9,2,5,1,3,7,10] // B=[2,1,3,4,3,10,6,6,1,7,10,10,10] // C=[2,9,2,5,7,10]
Created Oct 20, 2019
View medium-function-composition-3.js
 const applyPlusOne = anotherFunction => prop => { console.log(`In applyPlusOne, prop: \${prop}`) return anotherFunction(prop + 1) } const applyMultiplyByTen = anotherFunction => prop => { console.log(`In applyMultiplyByTen, prop: \${prop}`) return anotherFunction(prop * 10)
Last active Oct 19, 2019
View medium-function-composition-2.js
 const addTwo = prop => { console.log(`In addTwo, prop: \${prop}`) return prop + 2 } const addTen = prop => { console.log(`In addTen, prop: \${prop}`) return prop + 10 }
Last active Oct 19, 2019
Medium composition
View medium-function-composition-1.ts
 const addTwo = prop => { console.log(`In addTwo, prop: \${prop}`) return prop + 2 } const addTen = prop => { console.log(`In addTen, prop: \${prop}`) return prop + 10 }
Created Oct 10, 2017
Resolving array of promises
View promiseArrayResolve.js
 const getProductImagesByIds = productImagesIds => Promise.all(productImagesIds.map(PROMISE_TO_SOLVE_WITH_ID_FROM_ARRAY)) .then(results => Array.isArray(results) ? results.reduce((acc, row) => [...acc, row.url], []) : [results] ) .catch(e => { throw new Error(e) })
You can’t perform that action at this time.