0.0.6 • Published 6 years ago

ramda-polyfill v0.0.6

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

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, ...rest]) => {
      if (!frame) return false;
      try { // for CORS blocked exception.
        return [
          $(frame.frameElement).is(':visible') ? frame : null,
          rest.concat(R.map(w => 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.

Precautions

  • 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.
0.0.6

6 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago