TiddlyWiki.org

Ticket #412 (closed enhancement: fixed)

Opened 10 months ago

Last modified 9 months ago

Include Array.prototype.map in core

Reported by: SaqImtiaz Assigned to: 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 (492 bytes) - added by SaqImtiaz on 12/11/07 17:44:57.

Change History

12/11/07 17:44:57 changed by SaqImtiaz

  • attachment Ticket412.patch added.

12/11/07 17:45:15 changed by SaqImtiaz

  • status changed from new to assigned.

12/11/07 17:57:37 changed by SaqImtiaz

  • type changed from defect to enhancement.

26/11/07 10:26:23 changed by JeremyRuston

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

Fixed in changeset:2970