-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
34 lines (32 loc) · 974 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
(function (alias) {
if (typeof exports === 'object') {
module.exports = alias;
} else if (window.R) {
alias(window.R);
} else {
// not a commonJS package and no ramda found... do something?
}
})(function (ramda) {
// deprecated method -> new method (alphabetical)
var ALIAS_MAP = {
foldl : 'reduce',
foldr : 'reduceRight',
foldlIndexed : 'reduceIndexed',
foldrIndexed : 'reduceRightIndexed',
lPartial : 'partial',
mapAccumL : 'mapAccum',
mapAccumR : 'mapAccumRight',
mixin : 'merge',
pCompose : 'composeP',
pPipe : 'pipeP',
rPartial : 'partialRight',
scanl : 'scan',
unfoldr : 'unfold'
};
// we don't really need to check if the new method is defined,
// as it will just eval to undefined anyways. Only reason would be
// to notify user that the alias is still missing?
for (var alias in ALIAS_MAP) {
ramda[alias] = ramda[alias] || ramda[ALIAS_MAP[alias]];
}
});