Currying Up More Examples

A few weeks ago, I wrote an example page on for using the curry function to easily add prototypal functions to the String object. As I was playing around with jPaq, I thought of a few more examples:

// Returns an array of all of the characters in the string.
String.prototype.toCharArray = String.prototype.split.curry("");

// Returns an array of all of the lines in the string.
String.prototype.splitLines = String.prototype.split.curry(/\r?\n|\r/);

// Sorts the array so that numbers are correctly ordered.
Array.prototype.sortNumbers = Array.prototype.sort.curry(function(a, b) {
  return a - b;

All of those examples will work with jPaq 1.0 or higher. If you think of other cool examples, let me know.