jPaq Example - Currying Up String Functions
You ever wonder how libraries such as jPaq and Prototype add prototype functions to different classes? At for jPaq, it isn't by relying on the curry function. Perhaps it should be though. The following example shows that you can use the curry function to produce
surroundWith, each with just one line of code. In the example, I also added two casing functions with minimal effort to the string prototype. Execute the code below and see the result of running these functions:
At times, you may want to call a function a number of times, but you may notice that the first few arguments are always the…
- Flatten Arrays
One of the nice functions that is provided in Prototype is Array.prototype.flatten(). It gives you the ability to turn arrays such as…
- Compacting Arrays
© 2013 - Site by Chris West. Powered by jQuery and jPaq.