Ticket #412 (closed enhancement: fixed)
Include Array.prototype.map in core
| Reported by: | SaqImtiaz | Owned by: | SaqImtiaz |
|---|---|---|---|
| Priority: | minor | Milestone: | 2.3 |
| Component: | core | Version: | |
| Severity: | undefined | Keywords: | |
| Cc: |
Description
Firefox supports Array.prototype.map but not all browsers do. It is suggested to include it in the TiddlyWiki core, as it could be used to simplify a lot of 'for' loops in the core code, and is also very convenient for plugin writers.
Example:
var tiddlers = store.getTaggedTiddlers("task");
var titles = [];
for (var i=0; i<tiddlers.length; i++)
titles.push(tiddlers[i].title);
can be rewritten as
var tiddlers = store.getTaggedTiddlers("task");
var titles = tiddlers.map(function(t){ return t.title;});
The code in the attached path is compatible with the Firefox implementation
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

