MCPcopy
hub / github.com/ampproject/amphtml / stringify

Method stringify

src/core/dom/srcset.js:231–248  ·  view source on GitHub ↗

* Reconstructs the string expression for this srcset. * @param {function(string):string=} opt_mapper * @return {string}

(opt_mapper)

Source from the content-addressed store, hash-verified

229 * @return {string}
230 */
231 stringify(opt_mapper) {
232 const res = [];
233 const sources = this.sources_;
234 for (let i = 0; i < sources.length; i++) {
235 const source = sources[i];
236 let src = source.url;
237 if (opt_mapper) {
238 src = opt_mapper(src);
239 }
240 if (this.widthBased_) {
241 src += ` ${/** @type {WidthSourceDef} */ (source).width}w`;
242 } else {
243 src += ` ${/** @type {DprSourceDef} */ (source).dpr}x`;
244 }
245 res.push(src);
246 }
247 return res.join(', ');
248 }
249}
250
251/**

Callers 15

createIncidentFunction · 0.80
updateIncidentFunction · 0.80
addCommentFunction · 0.80
stringifyValueFunction · 0.80
index.jsFile · 0.80
bundles.config.jsFile · 0.80
debugFunction · 0.80
shouldUseFunction · 0.80
hoistPropertiesFunction · 0.80
checkFileFunction · 0.80
writeCssBinariesFunction · 0.80
helpers.jsFile · 0.80

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected