我有一个小的代码示例,使用ramda时可以按预期运行,但是我尝试将此代码移植到保护区的尝试失败。
<div id='root'>
<div class='flex-fill flex-col'>
<div><h1>main title</h1></div>
<div class="flex-col">
<div class='flex-col'>
<div><h2>subtitle</h2></div>
<div class="flex-row">
<div>...left side nav list...</div>
<div class='flex-col'>
<div>...data header...</div>
<!--Now Scrolls-->
<div class="scrolling-div">
...scrolling data list...<br />
...scrolling data list...<br />
...scrolling data list...<br />
...scrolling data list...<br />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
问题是ramda版本按预期运行,但避难所版本因该错误而退出,可以有人解释其原因。
const IO = require('fantasy-io');
const S = require('sanctuary');
const R = require('ramda');
const url = 'http://localhost:8010?param1=arg1¶m2=arg2';
const io = IO.of(url);
// Works as expected:
const r = R.map(R.split('?'), io);
console.dir(r.unsafePerform());
// -> [ 'http://localhost:8010', 'param1=arg1¶m2=arg2' ]
// Fails:
const s = S.map (S.splitOn('?')) (io);
console.dir(s.unsafePerform());
答案 0 :(得分:0)
仅发布了一个Fantasy-io版本:
exports.getCountByBranch = async function (req, res) {
let docs;
let request = new EndpointRequestController(req, res);
try {
docs = await request.aggregate(staffmember, [{
$lookup: {
from: "branches",
localField: "branch",
foreignField: "_id",
as: "branch"
}
},
{
$group: {
_id: "$branch",
count: {
$sum: 1
}
}
}]);
} catch (err) {
return request.sendError("An error occurred while trying to find existing records.", err);
}
request.documentCount = docs.length;
request.sendResponse(docs);
它针对的是非常旧版本的Fantasy Land,因此不支持prefixed method names。
该项目已被放弃。我建议寻找替代方案。我推荐Fluture,它是成熟且维护良好的。在Sanctuary中也可以很好地工作。