MCPcopy Index your code
hub / github.com/prototypejs/prototype / $A

Function $A

src/prototype/lang/array.js:60–68  ·  view source on GitHub ↗

section: Language, related to: Array * $A(iterable) -> Array * * Accepts an array-like collection (anything with numeric indices) and returns * its equivalent as an actual [[Array]] object. This method is a convenience * alias of [[Array.from]], but is the preferred way of casting to an [[A

(iterable)

Source from the content-addressed store, hash-verified

58**/
59
60function $A(iterable) {
61 if (!iterable) return [];
62 // Safari <2.0.4 crashes when accessing property of a node list with property accessor.
63 // It nevertheless works fine with `in` operator, which is why we use it here
64 if ('toArray' in Object(iterable)) return iterable.toArray();
65 var length = iterable.length || 0, results = new Array(length);
66 while (length--) results[length] = iterable[length];
67 return results;
68}
69
70/** section: Language, related to: Array
71 * $w(String) -> Array

Callers 15

buildMessageFunction · 0.85
assertions.jsFile · 0.85
buildMessageFunction · 0.85
test_helpers.jsFile · 0.85
methodWithArgumentsFunction · 0.85
delayedFunctionWithArgsFunction · 0.85
selector.test.jsFile · 0.85
array.test.jsFile · 0.85
toArrayOnArgumentsFunction · 0.85
dom.test.jsFile · 0.85
deprecated.jsFile · 0.85
selector.jsFile · 0.85

Calls

no outgoing calls

Tested by 3

methodWithArgumentsFunction · 0.68
delayedFunctionWithArgsFunction · 0.68
toArrayOnArgumentsFunction · 0.68