<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
body {
background: black;
color: white;
}
pre code {
font: 11pt/1.25 Monaco, monospace;
}
.debug { color: Snow; }
.info { color: LawnGreen; }
.warn { color: GoldenRod; }
.error { color: LightCoral; }
</style>
<script>console.clear()</script>
<script src="https://unpkg.com/systemjs@0.19.41/dist/system.src.js"></script>
<script>
SystemJS.config({
paths: {
"npm:": "//unpkg.com/",
"app/": "src/"
},
browserConfig: {
"baseURL": "."
},
devConfig: {
"map": {
"plugin-babel": "npm:systemjs-plugin-babel@0.0.17",
"systemjs-babel-build": "npm:systemjs-plugin-babel/systemjs-babel-browser.js"
}
},
transpiler: "plugin-babel",
packages: {
"app": {
"main": "app.js",
"meta": {
"*.js": {
"loader": "plugin-babel"
}
}
}
}
});
SystemJS.config({
map: {
"data.task": "npm:data.task@3.1.1",
"process": "npm:jspm-nodelibs-process@0.2.0",
"ramda": "npm:ramda"
},
packages: {
"ramda": {
"main": "index.js",
"format": "cjs",
"meta": {
"*.json": {
"format": "json"
},
"tmp-test-bundle.js": {
"cjsRequireDetection": false
}
}
},
"data.task": {
"main": "lib/index.js",
"format": "cjs",
"meta": {
"*": {
"globals": {
"process": "process"
}
},
"*.json": {
"format": "json"
}
},
"map": {
"./lib": "./lib/index.js"
}
}
}
});
</script>
</head>
<body>
<script>
System.import('app')
</script>
</body>
</html>
import console from './console'
const shouldBeTrue = [6, 3, 4, 5, 2, 1]
const shouldBeFalse = [3, 4, 5, 2, 1]
import { converge, equals, head, sort, descend, identity, compose } from 'ramda'
const biggestItem = compose(head, (sort(descend(identity))))
const isFirstBiggest = converge(
equals, [
head,
biggestItem
])
// xs =>
// xs[0] == xs.sort((a, b) => b - a)[0]
console.log(isFirstBiggest(shouldBeTrue))
console.log(isFirstBiggest(shouldBeFalse))
/**
* This pen allows you to use all your favourite console functions right in
* CodePen: `console.log`, `console.info`, `console.warn`, `console.error`,
* and `console.clear` are supported.
*
* To scroll the console to the bottom as messages are printed use the
* `console.follow` function.
*
* Made with love by @nullobject (http://joshbassett.info), 2014.
*/
export default (function() {
var following = false,
pre = document.createElement('pre'),
code = document.createElement('code');
pre.appendChild(code);
document.body.appendChild(pre);
return {
clear: clear,
follow: follow,
log: print.bind(this, 'debug'),
info: print.bind(this, 'info'),
warn: print.bind(this, 'warn'),
error: print.bind(this, 'error')
};
function clear() {
while (code.hasChildNodes()) {
code.removeChild(code.lastChild);
}
}
function follow() {
following = true;
}
function print(className, object) {
var s = (typeof object === 'string') ? object : JSON.stringify(object),
span = document.createElement('span'),
text = document.createTextNode(s + '\n');
span.setAttribute('class', className);
span.appendChild(text);
code.appendChild(span);
if (following) {
scrollToBottom();
}
}
function scrollToBottom() {
window.scrollTo(0, document.body.scrollHeight);
}
}());