Re: Binary data (ByteArray/ByteVector) proposal on public-script-coord

On Fri, Nov 6, 2009 at 4:39 PM, Alex Russell <alex@dojotoolkit.org> wrote:
> On Nov 6, 2009, at 11:30 AM, Maciej Stachowiak wrote:
>> ES5 does have bracket index access to the individual characters. But it
>> does not make String inherit from Array.prototype, or add all of the Array
>> methods. To make it more concrete, have you ever wished you could use
>> methods like map(), filter(), reduce() or join() on a String?
>
> join's an oddball since it's effectively a no-op, but map() and filter(),
> absolutely.

I've used join too (though not with an empty separator, indeed), and
map/filter for various string pack and encode operations, but I don't
think that I would mind too much having to say

Array.join(strOrDataThing, "\n");

instead of

strOrData.filter(function (v) { return v.charCodeAt(0) < 128; });

Mike

Received on Friday, 6 November 2009 21:44:13 UTC