You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

21 lines
481 B
JavaScript

"use strict";
const mapAsync = require("../map-async");
const All = require("../dlayer-symbol-all");
module.exports = function evaluateSingle({ command, selectResult }) {
return function (ids) {
return mapAsync(ids, async (id) => {
if (id === All) {
throw new Error(`This data source does not support fetching all entries`);
} else {
let result = await command(id);
return (selectResult != null)
? selectResult(result)
: result;
}
});
};
};