MCPcopy
hub / github.com/meteor/meteor / PkgImplies

Function PkgImplies

tools/cli/commands-packages-query.js:264–289  ·  view source on GitHub ↗
(pkgDeps)

Source from the content-addressed store, hash-verified

262// Stores implies for a given package and returns them to the caller in a given
263// format. Takes in the dependencies from the package.
264var PkgImplies = function (pkgDeps) {
265 var self = this;
266 self.data = [];
267 // Go through all the package dependencies. If a dependency has any implied
268 // references, add it to the list.
269 _.each(pkgDeps, function (ref, name) {
270 var architectures = [];
271 // We want to select the references that are implied (instead of just used)
272 // and save their architectures. Also, we want to replace 'os' with
273 // 'server', as with exports.
274 _.each(ref.references, function (r) {
275 if (! r.implied) {
276 return;
277 }
278 var archName = (r.arch === "os") ? "server" : r.arch;
279 architectures.push(archName);
280 });
281 // Sort architecures alphabetically.
282 architectures.sort();
283 if (! _.isEmpty(architectures)) {
284 self.data.push({ name: name, architectures: architectures });
285 }
286 });
287 // Sort by name.
288 self.data = _.sortBy(self.data, "name");
289};
290
291// Extend BasePkgDatum.
292PkgImplies.prototype = new BasePkgDatum();

Callers

nothing calls this directly

Calls 2

eachMethod · 0.80
isEmptyMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…