[Vitaliy Akimov] Simpler Transducers for JavaScript
[Vitaliy Akimov] Decouple Business Logic using Async Generators
[Joel Thoms] Function Composition For Every Day Use
const tag = t => contents => `<${t}>${contents}</${t}>`
tag('b')('this is bold!')
[Joel Thoms] Ramda - partial application
import curry from 'ramda/src/curry'
import __ from 'ramda/src/__' // Special Placeholder
import fs from 'fs'
// curry fs.readFile to add the magic
const readFile = curry(fs.readFile)
const outputUtf8File = readFile(__, 'utf8', output)
outputUtf8File('README.md')
[Yazeed Bzadough] higher-order-duck
const testArray = [
{ id: 1, name: "one", },
{ id: 2, name: "two", },
{ id: 3, name: "three", },
{ id: 4, name: "four", },
]
const findItemById = id => item => item.id === id
function removeById(array, id) {
return array.filter(item => !findItemById(id)(item))
}
function updateById(array, { oldItem, newItem, }) {
return array.map(item => (findItemById(oldItem.id)(item) ? newItem : item))
}
console.log(removeById(testArray, 2))
const oldItem = { id: 1, }
const newItem = { id: 1, name: "one one", }
console.log(updateById(testArray, { oldItem, newItem, }))