Skip to content

Commit e4a6dfe

Browse files
committed
Fix.
Reviewed by @tolmasky.
1 parent 6cdf6c4 commit e4a6dfe

10 files changed

Lines changed: 618 additions & 261 deletions

0.24.1/docs/dist/ramda.js

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Ramda v0.24.0
1+
// Ramda v0.24.1
22
// https://github.com/ramda/ramda
33
// (c) 2013-2017 Scott Sauyet, Michael Hurley, and David Chambers
44
// Ramda may be freely distributed under the MIT license.
@@ -559,6 +559,23 @@
559559
};
560560
};
561561

562+
/**
563+
* Tests whether or not an object is similar to an array.
564+
*
565+
* @private
566+
* @category Type
567+
* @category List
568+
* @sig * -> Boolean
569+
* @param {*} x The object to test.
570+
* @return {Boolean} `true` if `x` has a numeric length property and extreme indices defined; `false` otherwise.
571+
* @example
572+
*
573+
* _isArrayLike([]); //=> true
574+
* _isArrayLike(true); //=> false
575+
* _isArrayLike({}); //=> false
576+
* _isArrayLike({length: 10}); //=> false
577+
* _isArrayLike({0: 'zero', 9: 'nine', length: 10}); //=> true
578+
*/
562579
var _isArrayLike = _curry1(function isArrayLike(x) {
563580
if (_isArray(x)) {
564581
return true;
@@ -6801,7 +6818,7 @@
68016818
* @memberOf R
68026819
* @since v0.12.0
68036820
* @category List
6804-
* @sig (c -> c) -> (a,b -> a) -> a -> [b] -> a
6821+
* @sig (c -> c) -> ((a, b) -> a) -> a -> [b] -> a
68056822
* @param {Function} xf The transducer function. Receives a transformer and returns a transformer.
68066823
* @param {Function} fn The iterator function. Receives two values, the accumulator and the
68076824
* current element from the array. Wrapped as transformer, if necessary, and used to
@@ -6814,8 +6831,11 @@
68146831
*
68156832
* var numbers = [1, 2, 3, 4];
68166833
* var transducer = R.compose(R.map(R.add(1)), R.take(2));
6817-
*
68186834
* R.transduce(transducer, R.flip(R.append), [], numbers); //=> [2, 3]
6835+
*
6836+
* var isOdd = (x) => x % 2 === 1;
6837+
* var firstOddTransducer = R.compose(R.filter(isOdd), R.take(1));
6838+
* R.transduce(firstOddTransducer, R.flip(R.append), [], R.range(0, 100)); //=> [1]
68196839
*/
68206840
var transduce = curryN(4, function transduce(xf, fn, acc, list) {
68216841
return _reduce(xf(typeof fn === 'function' ? _xwrap(fn) : fn), acc, list);
@@ -8882,7 +8902,9 @@
88828902
* factorial(5); //=> 120
88838903
* count; //=> 1
88848904
*/
8885-
var memoize = memoizeWith(toString);
8905+
var memoize = memoizeWith(function () {
8906+
return toString(arguments);
8907+
});
88868908

88878909
/**
88888910
* Splits a string into an array of strings based on the given

0.24.1/docs/index.html

Lines changed: 252 additions & 248 deletions
Large diffs are not rendered by default.

0.24.1/docs/index.html.handlebars

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,12 +153,13 @@
153153
{{/if}}
154154

155155
{{#if example}}
156-
<pre><button class="try-repl" data-ramda-version="{{@root.version}}">Try in REPL</button><code class="hljs javascript">{{{example}}}</code></pre>
156+
<pre><div class = "try-repl" ><button class = "send-repl" data-ramda-version="{{@root.version}}">Send to REPL</button><button class = "run-here" data-ramda-version="{{@root.version}}">Run it here</button></div><code class="hljs javascript">{{{example}}}</code></pre>
157157
{{/if}}
158158
</section>
159159
{{/each}}
160160
</main>
161161
<script src="dist/ramda.js"></script>
162162
<script src="main.js"></script>
163+
<script src = "https://embed.runkit.com"></script>
163164
</body>
164165
</html>

0.24.1/docs/main.js

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,15 +98,57 @@
9898
}
9999

100100
function tryInREPL(event) {
101-
if (!event.target.matches('.try-repl')) {
101+
var target = event.target;
102+
var isREPL = target.matches('.send-repl');
103+
var isRun = target.matches('.run-here');
104+
105+
if (!isREPL && !isRun) {
102106
return;
103107
}
104-
var version = event.target.dataset && event.target.dataset.ramdaVersion;
105-
var versionParam = version ? '?v=' + version : '';
106-
var code = event.target.nextElementSibling.textContent;
107-
var encoded = fixedEncodeURIComponent(code);
108-
location.assign(location.origin + '/repl/' +
109-
versionParam + '#;' + encoded);
108+
109+
if (isREPL || !window.RunKit) {
110+
var version = event.target.dataset && event.target.dataset.ramdaVersion;
111+
var versionParam = version ? '?v=' + version : '';
112+
var code = event.target.nextElementSibling.textContent;
113+
var encoded = fixedEncodeURIComponent(code);
114+
115+
return window.open(location.origin + '/repl/' +
116+
versionParam + '#;' + encoded);
117+
}
118+
119+
var parent = target.parentNode.parentNode;
120+
var ramdaVersion = target.dataset && "@" + target.dataset.ramdaVersion || "";
121+
var codeElement = target.parentNode.nextElementSibling;
122+
123+
parent.style.background = "transparent";
124+
parent.style.overflow = "hidden";
125+
126+
var container = document.createElement("div");
127+
128+
container.style.width = "1px";
129+
container.style.height = "1px";
130+
131+
parent.appendChild(container);
132+
133+
RunKit.createNotebook({
134+
element: container,
135+
nodeVersion: '*',
136+
preamble: 'var R = require("ramda' + ramdaVersion + '")',
137+
source: codeElement.textContent,
138+
syntaxTheme: 'atom-dark-syntax',
139+
minHeight: "52px",
140+
onLoad: function(notebook) {
141+
parent.removeChild(codeElement);
142+
parent.removeChild(target.parentNode);
143+
144+
container.style.cssText = "";
145+
146+
var iframe = container.lastElementChild;
147+
iframe.style.cssText = 'height:' + iframe.style.height;
148+
iframe.classList.add('repl');
149+
notebook.evaluate()
150+
}
151+
});
110152
}
111153

112154

19.7 KB
Binary file not shown.

0 commit comments

Comments
 (0)