MCPcopy Create free account
hub / github.com/cujojs/poly / normalizePkgDescriptor

Function normalizePkgDescriptor

test/curl.js:56–69  ·  view source on GitHub ↗
(descriptor)

Source from the content-addressed store, hash-verified

54 }
55
56 function normalizePkgDescriptor (descriptor) {
57 var path, main;
58
59 path = descriptor.path = removeEndSlash(descriptor['path'] || descriptor['location'] || '');
60 main = descriptor['main'] || 'main';
61 descriptor.config = descriptor['config'];
62 descriptor.main = main.charAt(0) == '.' ?
63 // reduceLeadingDots expects a module id, not a path, so we add an
64 // extra slash to fool reduceLeadingDots:
65 removeEndSlash(reduceLeadingDots(main, path + '/')) :
66 joinPath(path, main);
67
68 return descriptor;
69 }
70
71 function joinPath (path, file) {
72 return removeEndSlash(path) + '/' + file;

Callers 1

fixAndPushPathsFunction · 0.85

Calls 3

removeEndSlashFunction · 0.85
reduceLeadingDotsFunction · 0.85
joinPathFunction · 0.85

Tested by

no test coverage detected