const compose = (...fns) =>
fns.reduceRight((prevFn, nextFn) =>
(...args) => nextFn(prevFn(...args)),
value => value
);
This file contains 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) => fns.reduce((f, g) => (...args) => f(g(...args))) | |
// Usage : compose functions right to left | |
// compose(minus8, add10, multiply10)(4) === 42 | |
// | |
// The resulting function can accept as many arguments as the first function does | |
// compose(add2, multiply)(4, 10) === 42 |
This file contains 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
/** set up our navbar, and position it fixed so there is no white gap above the CS content **/ | |
.x-navbar { | |
border: none; | |
box-shadow: none; | |
transition: background 0.7s ease-out; | |
background: transparent!important; | |
position: fixed; | |
z-index: 1030; | |
top: 0; |
See also:
Service | Type | Storage | Limitations |
---|---|---|---|
Amazon DynamoDB | 25 GB | ||
Amazon RDS | |||
Azure SQL Database | MS SQL Server | ||
👉 Clever Cloud | PostgreSQL, MySQL, MongoDB, Redis | 256 MB (PostgreSQL) | Max 5 connections (PostgreSQL) |
This file contains 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
exports.deleteUser = async (req, res, next) { | |
const session = await mongoose.startSession(); | |
try { | |
const { id } = req.params; | |
// Start session | |
await session.startTransaction(); | |
// deleteMany in this session | |
const [errorOp, result] = await toAll([App.deleteMany({ user: id }).session(session), UserModel.findByIdAndRemove(id).session(session)]); | |
if (errorOp) { | |
throw new ErrorRequest(STATUS_CODE.UNPROCESSABLE, errorOp.message); |
- Instalaciones:
yarn add --dev jest babel-jest @babel/preset-env @babel/preset-react
yarn add --dev @testing-library/react @types/jest jest-environment-jsdom
npm install --dev jest babel-jest @babel/preset-env @babel/preset-react