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

Function $w

src/prototype/lang/array.js:95–99  ·  view source on GitHub ↗

section: Language, related to: Array * $w(String) -> Array * * Splits a string into an [[Array]], treating all whitespace as delimiters. Equivalent * to Ruby's `%w{foo bar}` or Perl's `qw(foo bar)`. * * This is one of those life-savers for people who just hate commas in literal arrays :-)

(string)

Source from the content-addressed store, hash-verified

93**/
94
95function $w(string) {
96 if (!Object.isString(string)) return [];
97 string = string.strip();
98 return string ? string.split(/\s+/) : [];
99}
100
101/** alias of: $A
102 * Array.from(iterable) -> Array

Callers 13

string.test.jsFile · 0.85
enumerable.test.jsFile · 0.85
hash.test.jsFile · 0.85
function.test.jsFile · 0.85
number.test.jsFile · 0.85
array.test.jsFile · 0.85
layout.test.jsFile · 0.85
dom.test.jsFile · 0.85
form.test.jsFile · 0.85
deprecated.jsFile · 0.85
dom.jsFile · 0.85
layout.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected