MCPcopy Create free account
hub / github.com/ampproject/amphtml / simpleArrayFrom

Function simpleArrayFrom

third_party/react-dates/index.js:7–21  ·  view source on GitHub ↗
(arrayLike)

Source from the content-addressed store, hash-verified

5// to avoid needing to use a full 3p implementation
6if (!Array.from) {
7 function simpleArrayFrom(arrayLike) {
8 if (!arrayLike) {
9 return [];
10 }
11
12 if (!arrayLike.length) {
13 return [];
14 }
15
16 const result = [];
17 for (let i = 0; i < arrayLike.length; i++) {
18 result[i] = arrayLike[i];
19 }
20 return result;
21 }
22
23 Object.defineProperty(Array, 'from', {
24 writable: true,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected