node package manager


ramda-polyfill npm version

ramda.js Object prototype polyfill library.

It inserts ramda functions to Object's prototype. Maybe not suitable for production.

So what you can do with this is

function getAccessibleVisibleFramesSizeDesc(win) {
  return win
    .mapR(w => w) // .toArray() 
    // for ease of processing recursive frame. 
    .unfoldR(([frame = null,]) => {
      if (!frame) return false;
      try { // for CORS blocked exception. 
        return [
          $(frame.frameElement).is(':visible') ? frame : null,
          rest.concat( => w, frame))
      } catch (e) {
        return [null, rest];
    .filter(w => w) // filter out blocked or invisible frame. 
    // size descending sort. 
    .sortByR(({ frameElement: x }) => -x.clientWidth * x.clientHeight)
    .prependR(win); // include itself. 

See test/test.js for more examples.


  • Due to name collision, 'R' is appended to name. e.g. anyR
  • It uses 'this' as last regular argument.
  • Unary function is evaluated without call parenthesis.
  • It imports side effects by default and can toggle features by specific function.