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.

13 lines
336 B
JavaScript

"use strict";
const Promise = require("bluebird");
const All = require("../graphql-interface/symbols/all");
module.exports = async function mapFromSource(source, ids, mapper) {
let results = (ids === All || ids == null)
? await source.load(All)
: await Promise.map(ids, (id) => source.load(id));
return results.map(mapper);
};