In XPages we write Javascript in server side. We use "the same" client side language. However in client side we can use a lot of cool libraries like jQuery, Dojo and Underscore.
I've used server side custom functions like, the each method:
Object.prototype.each = function (callback) {
    for (var x in this) {
        if (this.hasOwnProperty(x)) {
            callback.call(this, this[x]);
        }
    }
}
But these client side libraries already provide helpers like this and a lot more. If I tried to use these libraries in server side XPages they fail for several reasons like:
- Dom manipulation
 - Global variables
 - Window object
 - The SSJS XPage wierd error: Error calling method 'call(Object)' on an object of type 'function [JavaScript Object]'
 
Anybody has a server side library like that? Maybe frontend Node.js developers has already solved this.
Anybody uses methods like:
- each
 - map
 - reduce
 - reduceRight
 - find
 - filter
 - where
 - findWhere
 - reject
 - every
 - some
 - contains
 - invoke
 - pluck
 - max
 - min
 - sortBy
 - groupBy
 - indexBy
 - countBy
 - shuffle
 - sample
 - toArray
 - size
 - first
 - initial
 - last
 - rest
 - compact
 - flatten
 - without
 - union
 - intersection
 - difference
 - uniq
 - zip
 - object
 - indexOf
 - lastIndexOf
 - sortedIndex
 - range
 - bind
 - bindAll
 - partial
 - memoize
 - delay
 - defer
 - throttle
 - debounce
 - once
 - after
 - wrap
 - compose
 
These are some Underscore features. I found this link about Underscore in server side js but I failed with the mentioned SSJS XPage wierd error: Error calling method 'call(Object)' on an object of type 'function [JavaScript Object]'