This repository has been archived by the owner on Jan 31, 2020. It is now read-only.
forked from gkz/prelude-ls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.ls
59 lines (51 loc) · 1.53 KB
/
index.ls
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
require! [
'./Func.js'
'./List.js'
'./Obj.js'
'./Str.js'
'./Num.js'
]
id = (x) -> x
is-type = (type, x) --> typeof! x is type
replicate = (n, x) -->
[x for til n]
Str <<< List{
empty, slice, take, drop, split-at, take-while, drop-while, span, break-str: break-list
}
prelude = {
Func, List, Obj, Str, Num,
id, is-type
replicate,
}
prelude <<< List{
each, map, filter, compact, reject, partition, find,
head, first, tail, last, initial, empty,
reverse, difference, intersection, union, count-by, group-by,
fold, foldl, fold1, foldl1, foldr, foldr1, unfoldr, and-list, or-list,
any, all, unique, unique-by, sort, sort-with, sort-by, sum, product, mean, average,
concat, concat-map, flatten,
maximum, minimum, maximum-by, minimum-by,
scan, scanl, scan1, scanl1, scanr, scanr1,
slice, take, drop, split-at, take-while, drop-while, span, break-list,
zip, zip-with, zip-all, zip-all-with,
at, elem-index, elem-indices, find-index, find-indices,
}
prelude <<< Func{
apply, curry, flip, fix, over,
}
prelude <<< Str{
split, join, lines, unlines, words, unwords, chars, unchars,
repeat, capitalize, camelize, dasherize,
}
# not importing all of Obj's functions
prelude <<< Obj{
values, keys,
pairs-to-obj, obj-to-pairs, lists-to-obj, obj-to-lists,
}
prelude <<< Num{
max, min, negate, abs, signum, quot, rem, div, mod, recip,
pi, tau, exp, sqrt, ln, pow, sin, tan, cos, acos, asin, atan, atan2,
truncate, round, ceiling, floor, is-it-NaN, even, odd, gcd, lcm,
}
prelude.VERSION = '1.1.2'
module.exports = prelude