MCPcopy Index your code
hub / github.com/ampproject/amphtml / pushLimit

Function pushLimit

src/error-reporting.js:93–98  ·  view source on GitHub ↗

* Pushes element into array, keeping at most the most recent limit elements * * @param {!Array } array * @param {T} element * @param {number} limit * @template T

(array, element, limit)

Source from the content-addressed store, hash-verified

91 * @template T
92 */
93function pushLimit(array, element, limit) {
94 if (array.length >= limit) {
95 array.splice(0, array.length - limit + 1);
96 }
97 array.push(element);
98}
99
100/**
101 * A wrapper around our exponentialBackoff, to lazy initialize it to avoid an

Callers 1

getErrorReportDataFunction · 0.85

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected