Respostas
Resposta:
A programação funcional, possui mais vantagens sobre a imperativa
Explicação:
import { curry } from 'ramda'
const getUidAuthorFromTopic = (db, uid, _) => {
// logic function on here
}
module.exports = curry(getUidAuthorFromTopic)
// acceptOrder module
const acceptOrder = (data, db, uidAuthorFromTopic) => {
// logic function on here
}
module.exports = curry(acceptOrder)
// on index.js
import getUidAuthorFromTopic from './getUidAuthorFromTopic'
import acceptOrder from './acceptOrder'
import canCreateCard from './canCreateCard'
const createCard = (data, db) => {
return canCreateCard(db, data.uid_author, data.uid_topic)
.then(getUidAuthorFromTopic(db, data.uid_topic))
.then(acceptOrder(data, db))
.catch(console.error)import { curry } from 'ramda'
const getUidAuthorFromTopic = (db, uid, _) => {
// logic function on here
}
module.exports = curry(getUidAuthorFromTopic)
// acceptOrder module
const acceptOrder = (data, db, uidAuthorFromTopic) => {
// logic function on here
}
module.exports = curry(acceptOrder)
// on index.js
import import { curry } from 'ramda'
const getUidAuthorFromTopic = (db, uid, _) => {
// logic function on here
}
module.exports = curry(getUidAuthorFromTopic)
// acceptOrder module
const acceptOrder = (data, db, uidAuthorFromTopic) => {
// logic function on here
}
module.exports = curry(acceptOrder)
// on index.js
import getUidAuthorFromTopic from './getUidAuthorFromTopic'
import acceptOrder from './acceptOrder'
import canCreateCard from './canCreateCard'
const createCard = (data, db) => {
return canCreateCard(db, data.uid_author, data.uid_topic)
.then(getUidAuthorFromTopic(db, data.uid_topic))
.then(acceptOrder(data, db))
.catch(console.error) from './getUidAuthorFromTopic'
import acceptOrder from './acceptOrder'
import canCreateCard from './canCreateCard'
const createCard = (data, db) => {
return canCreateCard(db, data.uid_author, data.uid_topic)
.then(getUidAuthorFromTopic(db, data.uid_topic))
.then(acceptOrder(data, db))
.catch(console.error)vv