MCPcopy Create free account
hub / github.com/SoftwareBrothers/better-docs / addSignatureReturns

Function addSignatureReturns

publish.js:160–191  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

158}
159
160function addSignatureReturns(f) {
161 var attribs = []
162 var attribsString = ''
163 var returnTypes = []
164 var returnTypesString = ''
165 var source = f.yields || f.returns
166
167 // jam all the return-type attributes into an array. this could create odd results (for example,
168 // if there are both nullable and non-nullable return types), but let's assume that most people
169 // who use multiple @return tags aren't using Closure Compiler type annotations, and vice-versa.
170 if (source) {
171 source.forEach(function(item) {
172 helper.getAttribs(item).forEach(function(attrib) {
173 if (attribs.indexOf(attrib) === -1) {
174 attribs.push(attrib)
175 }
176 })
177 })
178
179 attribsString = buildAttribsString(attribs)
180 }
181
182 if (source) {
183 returnTypes = addNonParamAttributes(source)
184 }
185 if (returnTypes.length) {
186 returnTypesString = util.format( ' → %s{%s}', attribsString, returnTypes.join('|') )
187 }
188
189 f.signature = '<span class="signature">' + (f.signature || '') + '</span>' +
190 '<span class="type-signature">' + returnTypesString + '</span>'
191}
192
193function addSignatureTypes(f) {
194 var types = f.type ? buildItemTypeStrings(f) : []

Callers 1

publish.jsFile · 0.85

Calls 2

buildAttribsStringFunction · 0.85
addNonParamAttributesFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…