typicaljoe/taffydb — pull request #67 by Alsciende (2013-10-25 13:05:03+00:00)
Title: added intl option to order and sort using utf8-aware comparision

That's my first ever pull request. I hope I'm not doing anything wrong.

My solution to add an internationalized sort & order to taffydb. I didn't want to change the existing sorting modes (logical & asec) to avoid regressions (and because I don't understand 'logical' well enough)), so I created a new one: intl.

Impact on existing usage: I try to create an instance of Intl.Collator every time a sort() or order() function is called. It should be negligible, but it can be avoided if necessary. Instancing one Intl.Collator should be more efficient than doing many localeCompare calls (if the array is big enough).

If 'intl' mode is chosen but Intl.Collator is not available, it reverts to 'logical' mode.

'intl' is ascending only, and case-insensitive. Addind descending and case-sensitive modes should be straight-forward.