MCPcopy Index your code
hub / github.com/stdlib-js/stdlib / addSignatureReturns

Function addSignatureReturns

tools/docs/jsdoc/templates/html/publish.js:143–173  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

141}
142
143function addSignatureReturns(f) {
144 var attribs = [];
145 var attribsString = '';
146 var returnTypes = [];
147 var returnTypesString = '';
148
149 // jam all the return-type attributes into an array. this could create odd results (for example,
150 // if there are both nullable and non-nullable return types), but let's assume that most people
151 // who use multiple @return tags aren't using Closure Compiler type annotations, and vice-versa.
152 if (f.returns) {
153 f.returns.forEach(function(item) {
154 helper.getAttribs(item).forEach(function(attrib) {
155 if (attribs.indexOf(attrib) === -1) {
156 attribs.push(attrib);
157 }
158 });
159 });
160
161 attribsString = buildAttribsString(attribs);
162 }
163
164 if (f.returns) {
165 returnTypes = addNonParamAttributes(f.returns);
166 }
167 if (returnTypes.length) {
168 returnTypesString = util.format( ' → %s{%s}', attribsString, returnTypes.join('|') );
169 }
170
171 f.signature = '<span class="signature">' + (f.signature || '') + '</span>' +
172 '<span class="type-signature">' + returnTypesString + '</span>';
173}
174
175function addSignatureTypes(f) {
176 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…