MCPcopy Create free account
hub / github.com/nodejs/node / ls

Method ls

deps/npm/lib/commands/org.js:118–145  ·  view source on GitHub ↗
(org, user, opts)

Source from the content-addressed store, hash-verified

116 }
117
118 async ls (org, user, opts) {
119 if (!org) {
120 throw new Error('First argument `orgname` is required.')
121 }
122
123 let roster = await liborg.ls(org, opts)
124 if (user) {
125 const newRoster = {}
126 if (roster[user]) {
127 newRoster[user] = roster[user]
128 }
129
130 roster = newRoster
131 }
132 if (opts.json) {
133 output.buffer(roster)
134 } else if (opts.parseable) {
135 output.standard(['user', 'role'].join('\t'))
136 Object.keys(roster).forEach(u => {
137 output.standard([u, roster[u]].join('\t'))
138 })
139 } else if (!this.npm.silent) {
140 const chalk = this.npm.chalk
141 for (const u of Object.keys(roster).sort()) {
142 output.standard(`${u} - ${chalk.cyan(roster[u])}`)
143 }
144 }
145 }
146}
147
148module.exports = Org

Callers 2

execMethod · 0.95
rmMethod · 0.45

Calls 5

sortMethod · 0.80
forEachMethod · 0.65
keysMethod · 0.65
bufferMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected