Ticket #412 (closed enhancement: fixed)

Opened 6 years ago

Last modified 6 years ago

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

Ticket412.patch Download (492 bytes) - added by SaqImtiaz 6 years ago.

Change History

Changed 6 years ago by SaqImtiaz

Changed 6 years ago by SaqImtiaz

  • status changed from new to assigned

Changed 6 years ago by SaqImtiaz

  • type changed from defect to enhancement

Changed 6 years ago by JeremyRuston

  • status changed from assigned to closed
  • resolution set to fixed

Fixed in changeset:2970

Note: See TracTickets for help on using tickets.