conjur-asset-ui 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.git-hooks/pre_commit/ensure_livescript_compiled.rb +31 -0
- data/.git-hooks/pre_commit/trailing_whitespace.rb +26 -0
- data/.gitignore +20 -0
- data/.overcommit.yml +5 -0
- data/.project +18 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +8 -0
- data/LICENSE.txt +22 -0
- data/README.md +41 -0
- data/Rakefile +3 -0
- data/compile_ls +6 -0
- data/conjur-asset-ui.gemspec +37 -0
- data/lib/conjur/command/ui.rb +46 -0
- data/lib/conjur/webserver/api_proxy.rb +94 -0
- data/lib/conjur/webserver/authorize.rb +28 -0
- data/lib/conjur/webserver/conjur_info.rb +33 -0
- data/lib/conjur/webserver/home.rb +42 -0
- data/lib/conjur/webserver/login.rb +57 -0
- data/lib/conjur/webserver/renderer.rb +34 -0
- data/lib/conjur/webserver/server.rb +113 -0
- data/lib/conjur-asset-ui-version.rb +7 -0
- data/lib/conjur-asset-ui.rb +7 -0
- data/livescript/views/audit.ls +136 -0
- data/public/_client_code.html +42 -0
- data/public/_client_libs.html +24 -0
- data/public/css/bootstrap.css +7 -0
- data/public/css/styles.less +461 -0
- data/public/fonts/glyphicons-halflings-regular.eot +0 -0
- data/public/fonts/glyphicons-halflings-regular.svg +229 -0
- data/public/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/public/fonts/glyphicons-halflings-regular.woff +0 -0
- data/public/images/conjur-logo.svg +26 -0
- data/public/images/icon-client-pc.svg +12 -0
- data/public/images/icon-environment.png +0 -0
- data/public/images/icon-person.svg +12 -0
- data/public/images/icon-policy.png +0 -0
- data/public/images/icon-resource.png +0 -0
- data/public/images/icon-service-dots.svg +13 -0
- data/public/images/icon-variable.png +0 -0
- data/public/index.html.erb +62 -0
- data/public/js/init.js +107 -0
- data/public/js/lib/JSXTransformer.js +10862 -0
- data/public/js/lib/async.js +958 -0
- data/public/js/lib/backbone.js +2 -0
- data/public/js/lib/bootstrap.js +6 -0
- data/public/js/lib/date.extensions.js +141 -0
- data/public/js/lib/less.js +16 -0
- data/public/js/lib/moment.js +7768 -0
- data/public/js/lib/pace.js +2 -0
- data/public/js/lib/prelude-browser-min.js +1 -0
- data/public/js/lib/react-bootstrap.js +5346 -0
- data/public/js/lib/react-bootstrap.min.js +4 -0
- data/public/js/lib/sorted-set.no-require.js +1170 -0
- data/public/js/lib/sorted-set.no-require.js.txt +6 -0
- data/public/js/lib/underscore-min.js +6 -0
- data/public/js/lib/underscore.string.min.js +1 -0
- data/public/js/main.js +57 -0
- data/public/js/models/groupRecord.js +70 -0
- data/public/js/models/hostRecord.js +55 -0
- data/public/js/models/layerRecord.js +77 -0
- data/public/js/models/namespace.js +10 -0
- data/public/js/models/policyList.js +14 -0
- data/public/js/models/policyRecord.js +54 -0
- data/public/js/models/record.js +85 -0
- data/public/js/models/resourceList.js +69 -0
- data/public/js/models/userList.js +20 -0
- data/public/js/models/userRecord.js +70 -0
- data/public/js/models/variableList.js +16 -0
- data/public/js/models/variableRecord.js +73 -0
- data/public/js/routers.js +205 -0
- data/public/js/views/annotations.js +36 -0
- data/public/js/views/audit.js +363 -0
- data/public/js/views/dashboard.js +67 -0
- data/public/js/views/generic.js +115 -0
- data/public/js/views/group.js +61 -0
- data/public/js/views/groups.js +30 -0
- data/public/js/views/host.js +64 -0
- data/public/js/views/hosts.js +30 -0
- data/public/js/views/layer.js +92 -0
- data/public/js/views/layers.js +30 -0
- data/public/js/views/mixins/search.js +15 -0
- data/public/js/views/mixins/tabs.js +114 -0
- data/public/js/views/namespaces.js +40 -0
- data/public/js/views/navSearch.js +25 -0
- data/public/js/views/owned.js +178 -0
- data/public/js/views/permissions.js +188 -0
- data/public/js/views/policies.js +28 -0
- data/public/js/views/policy.js +43 -0
- data/public/js/views/resource.js +39 -0
- data/public/js/views/role.js +41 -0
- data/public/js/views/searchResults.js +145 -0
- data/public/js/views/time.js +14 -0
- data/public/js/views/user.js +68 -0
- data/public/js/views/users.js +31 -0
- data/public/js/views/variable.js +70 -0
- data/public/js/views/variables.js +30 -0
- data/spec/javascripts/helpers/.gitkeep +0 -0
- data/spec/javascripts/support/jasmine.yml +112 -0
- data/spec/javascripts/support/jasmine_helper.rb +22 -0
- data/spec/javascripts/support/run.html.erb +23 -0
- data/spec/javascripts/views/AuditSpec.js +22 -0
- data/spec/javascripts/views/AuditSpec.ls +18 -0
- data/vendor/prelude-ls/.gitignore +2 -0
- data/vendor/prelude-ls/.travis.yml +3 -0
- data/vendor/prelude-ls/CHANGELOG.md +81 -0
- data/vendor/prelude-ls/LICENSE +22 -0
- data/vendor/prelude-ls/Makefile +50 -0
- data/vendor/prelude-ls/README.md +15 -0
- data/vendor/prelude-ls/browser/prelude-browser-min.js +1 -0
- data/vendor/prelude-ls/browser/prelude-browser.js +1172 -0
- data/vendor/prelude-ls/lib/Func.js +40 -0
- data/vendor/prelude-ls/lib/List.js +602 -0
- data/vendor/prelude-ls/lib/Num.js +129 -0
- data/vendor/prelude-ls/lib/Obj.js +153 -0
- data/vendor/prelude-ls/lib/Str.js +68 -0
- data/vendor/prelude-ls/lib/index.js +164 -0
- data/vendor/prelude-ls/package.json +50 -0
- data/vendor/prelude-ls/package.ls +46 -0
- data/vendor/prelude-ls/src/Func.ls +17 -0
- data/vendor/prelude-ls/src/List.ls +299 -0
- data/vendor/prelude-ls/src/Num.ls +83 -0
- data/vendor/prelude-ls/src/Obj.ls +61 -0
- data/vendor/prelude-ls/src/Str.ls +32 -0
- data/vendor/prelude-ls/src/index.ls +56 -0
- data/vendor/prelude-ls/test/Func.ls +36 -0
- data/vendor/prelude-ls/test/List.ls +751 -0
- data/vendor/prelude-ls/test/Num.ls +258 -0
- data/vendor/prelude-ls/test/Obj.ls +145 -0
- data/vendor/prelude-ls/test/Prelude.ls +49 -0
- data/vendor/prelude-ls/test/Str.ls +208 -0
- data/vendor/prelude-ls/test/browser.html +5 -0
- metadata +369 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
var curry, flip, fix, apply;
|
2
|
+
curry = function(f){
|
3
|
+
return curry$(f);
|
4
|
+
};
|
5
|
+
flip = curry$(function(f, x, y){
|
6
|
+
return f(y, x);
|
7
|
+
});
|
8
|
+
fix = function(f){
|
9
|
+
return function(g, x){
|
10
|
+
return function(){
|
11
|
+
return f(g(g)).apply(null, arguments);
|
12
|
+
};
|
13
|
+
}(function(g, x){
|
14
|
+
return function(){
|
15
|
+
return f(g(g)).apply(null, arguments);
|
16
|
+
};
|
17
|
+
});
|
18
|
+
};
|
19
|
+
apply = curry$(function(f, list){
|
20
|
+
return f.apply(null, list);
|
21
|
+
});
|
22
|
+
module.exports = {
|
23
|
+
curry: curry,
|
24
|
+
flip: flip,
|
25
|
+
fix: fix,
|
26
|
+
apply: apply
|
27
|
+
};
|
28
|
+
function curry$(f, bound){
|
29
|
+
var context,
|
30
|
+
_curry = function(args) {
|
31
|
+
return f.length > 1 ? function(){
|
32
|
+
var params = args ? args.concat() : [];
|
33
|
+
context = bound ? context || this : this;
|
34
|
+
return params.push.apply(params, arguments) <
|
35
|
+
f.length && arguments.length ?
|
36
|
+
_curry.call(context, params) : f.apply(context, params);
|
37
|
+
} : f;
|
38
|
+
};
|
39
|
+
return _curry();
|
40
|
+
}
|
@@ -0,0 +1,602 @@
|
|
1
|
+
var each, map, compact, filter, reject, partition, find, head, first, tail, last, initial, empty, reverse, unique, fold, foldl, fold1, foldl1, foldr, foldr1, unfoldr, concat, concatMap, flatten, difference, intersection, union, countBy, groupBy, andList, orList, any, all, sort, sortWith, sortBy, sum, product, mean, average, maximum, minimum, scan, scanl, scan1, scanl1, scanr, scanr1, slice, take, drop, splitAt, takeWhile, dropWhile, span, breakList, zip, zipWith, zipAll, zipAllWith, toString$ = {}.toString, slice$ = [].slice;
|
2
|
+
each = curry$(function(f, xs){
|
3
|
+
var i$, len$, x;
|
4
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
5
|
+
x = xs[i$];
|
6
|
+
f(x);
|
7
|
+
}
|
8
|
+
return xs;
|
9
|
+
});
|
10
|
+
map = curry$(function(f, xs){
|
11
|
+
var i$, len$, x, results$ = [];
|
12
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
13
|
+
x = xs[i$];
|
14
|
+
results$.push(f(x));
|
15
|
+
}
|
16
|
+
return results$;
|
17
|
+
});
|
18
|
+
compact = curry$(function(xs){
|
19
|
+
var i$, len$, x, results$ = [];
|
20
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
21
|
+
x = xs[i$];
|
22
|
+
if (x) {
|
23
|
+
results$.push(x);
|
24
|
+
}
|
25
|
+
}
|
26
|
+
return results$;
|
27
|
+
});
|
28
|
+
filter = curry$(function(f, xs){
|
29
|
+
var i$, len$, x, results$ = [];
|
30
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
31
|
+
x = xs[i$];
|
32
|
+
if (f(x)) {
|
33
|
+
results$.push(x);
|
34
|
+
}
|
35
|
+
}
|
36
|
+
return results$;
|
37
|
+
});
|
38
|
+
reject = curry$(function(f, xs){
|
39
|
+
var i$, len$, x, results$ = [];
|
40
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
41
|
+
x = xs[i$];
|
42
|
+
if (!f(x)) {
|
43
|
+
results$.push(x);
|
44
|
+
}
|
45
|
+
}
|
46
|
+
return results$;
|
47
|
+
});
|
48
|
+
partition = curry$(function(f, xs){
|
49
|
+
var passed, failed, i$, len$, x;
|
50
|
+
passed = [];
|
51
|
+
failed = [];
|
52
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
53
|
+
x = xs[i$];
|
54
|
+
(f(x) ? passed : failed).push(x);
|
55
|
+
}
|
56
|
+
return [passed, failed];
|
57
|
+
});
|
58
|
+
find = curry$(function(f, xs){
|
59
|
+
var i$, len$, x;
|
60
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
61
|
+
x = xs[i$];
|
62
|
+
if (f(x)) {
|
63
|
+
return x;
|
64
|
+
}
|
65
|
+
}
|
66
|
+
});
|
67
|
+
head = first = function(xs){
|
68
|
+
if (!xs.length) {
|
69
|
+
return;
|
70
|
+
}
|
71
|
+
return xs[0];
|
72
|
+
};
|
73
|
+
tail = function(xs){
|
74
|
+
if (!xs.length) {
|
75
|
+
return;
|
76
|
+
}
|
77
|
+
return xs.slice(1);
|
78
|
+
};
|
79
|
+
last = function(xs){
|
80
|
+
if (!xs.length) {
|
81
|
+
return;
|
82
|
+
}
|
83
|
+
return xs[xs.length - 1];
|
84
|
+
};
|
85
|
+
initial = function(xs){
|
86
|
+
var len;
|
87
|
+
len = xs.length;
|
88
|
+
if (!len) {
|
89
|
+
return;
|
90
|
+
}
|
91
|
+
return xs.slice(0, len - 1);
|
92
|
+
};
|
93
|
+
empty = function(xs){
|
94
|
+
return !xs.length;
|
95
|
+
};
|
96
|
+
reverse = function(xs){
|
97
|
+
return xs.concat().reverse();
|
98
|
+
};
|
99
|
+
unique = function(xs){
|
100
|
+
var result, i$, len$, x;
|
101
|
+
result = [];
|
102
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
103
|
+
x = xs[i$];
|
104
|
+
if (!in$(x, result)) {
|
105
|
+
result.push(x);
|
106
|
+
}
|
107
|
+
}
|
108
|
+
return result;
|
109
|
+
};
|
110
|
+
fold = foldl = curry$(function(f, memo, xs){
|
111
|
+
var i$, len$, x;
|
112
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
113
|
+
x = xs[i$];
|
114
|
+
memo = f(memo, x);
|
115
|
+
}
|
116
|
+
return memo;
|
117
|
+
});
|
118
|
+
fold1 = foldl1 = curry$(function(f, xs){
|
119
|
+
return fold(f, xs[0], xs.slice(1));
|
120
|
+
});
|
121
|
+
foldr = curry$(function(f, memo, xs){
|
122
|
+
return fold(f, memo, xs.concat().reverse());
|
123
|
+
});
|
124
|
+
foldr1 = curry$(function(f, xs){
|
125
|
+
var ys;
|
126
|
+
ys = xs.concat().reverse();
|
127
|
+
return fold(f, ys[0], ys.slice(1));
|
128
|
+
});
|
129
|
+
unfoldr = curry$(function(f, b){
|
130
|
+
var result, x, that;
|
131
|
+
result = [];
|
132
|
+
x = b;
|
133
|
+
while ((that = f(x)) != null) {
|
134
|
+
result.push(that[0]);
|
135
|
+
x = that[1];
|
136
|
+
}
|
137
|
+
return result;
|
138
|
+
});
|
139
|
+
concat = function(xss){
|
140
|
+
return [].concat.apply([], xss);
|
141
|
+
};
|
142
|
+
concatMap = curry$(function(f, xs){
|
143
|
+
var x;
|
144
|
+
return [].concat.apply([], (function(){
|
145
|
+
var i$, ref$, len$, results$ = [];
|
146
|
+
for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
|
147
|
+
x = ref$[i$];
|
148
|
+
results$.push(f(x));
|
149
|
+
}
|
150
|
+
return results$;
|
151
|
+
}()));
|
152
|
+
});
|
153
|
+
flatten = curry$(function(xs){
|
154
|
+
var x;
|
155
|
+
return [].concat.apply([], (function(){
|
156
|
+
var i$, ref$, len$, results$ = [];
|
157
|
+
for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
|
158
|
+
x = ref$[i$];
|
159
|
+
if (toString$.call(x).slice(8, -1) === 'Array') {
|
160
|
+
results$.push(flatten(x));
|
161
|
+
} else {
|
162
|
+
results$.push(x);
|
163
|
+
}
|
164
|
+
}
|
165
|
+
return results$;
|
166
|
+
}()));
|
167
|
+
});
|
168
|
+
difference = function(xs){
|
169
|
+
var yss, results, i$, len$, x, j$, len1$, ys;
|
170
|
+
yss = slice$.call(arguments, 1);
|
171
|
+
results = [];
|
172
|
+
outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
173
|
+
x = xs[i$];
|
174
|
+
for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) {
|
175
|
+
ys = yss[j$];
|
176
|
+
if (in$(x, ys)) {
|
177
|
+
continue outer;
|
178
|
+
}
|
179
|
+
}
|
180
|
+
results.push(x);
|
181
|
+
}
|
182
|
+
return results;
|
183
|
+
};
|
184
|
+
intersection = function(xs){
|
185
|
+
var yss, results, i$, len$, x, j$, len1$, ys;
|
186
|
+
yss = slice$.call(arguments, 1);
|
187
|
+
results = [];
|
188
|
+
outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
189
|
+
x = xs[i$];
|
190
|
+
for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) {
|
191
|
+
ys = yss[j$];
|
192
|
+
if (!in$(x, ys)) {
|
193
|
+
continue outer;
|
194
|
+
}
|
195
|
+
}
|
196
|
+
results.push(x);
|
197
|
+
}
|
198
|
+
return results;
|
199
|
+
};
|
200
|
+
union = function(){
|
201
|
+
var xss, results, i$, len$, xs, j$, len1$, x;
|
202
|
+
xss = slice$.call(arguments);
|
203
|
+
results = [];
|
204
|
+
for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
|
205
|
+
xs = xss[i$];
|
206
|
+
for (j$ = 0, len1$ = xs.length; j$ < len1$; ++j$) {
|
207
|
+
x = xs[j$];
|
208
|
+
if (!in$(x, results)) {
|
209
|
+
results.push(x);
|
210
|
+
}
|
211
|
+
}
|
212
|
+
}
|
213
|
+
return results;
|
214
|
+
};
|
215
|
+
countBy = curry$(function(f, xs){
|
216
|
+
var results, i$, len$, x, key;
|
217
|
+
results = {};
|
218
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
219
|
+
x = xs[i$];
|
220
|
+
key = f(x);
|
221
|
+
if (key in results) {
|
222
|
+
results[key] += 1;
|
223
|
+
} else {
|
224
|
+
results[key] = 1;
|
225
|
+
}
|
226
|
+
}
|
227
|
+
return results;
|
228
|
+
});
|
229
|
+
groupBy = curry$(function(f, xs){
|
230
|
+
var results, i$, len$, x, key;
|
231
|
+
results = {};
|
232
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
233
|
+
x = xs[i$];
|
234
|
+
key = f(x);
|
235
|
+
if (key in results) {
|
236
|
+
results[key].push(x);
|
237
|
+
} else {
|
238
|
+
results[key] = [x];
|
239
|
+
}
|
240
|
+
}
|
241
|
+
return results;
|
242
|
+
});
|
243
|
+
andList = function(xs){
|
244
|
+
var i$, len$, x;
|
245
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
246
|
+
x = xs[i$];
|
247
|
+
if (!x) {
|
248
|
+
return false;
|
249
|
+
}
|
250
|
+
}
|
251
|
+
return true;
|
252
|
+
};
|
253
|
+
orList = function(xs){
|
254
|
+
var i$, len$, x;
|
255
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
256
|
+
x = xs[i$];
|
257
|
+
if (x) {
|
258
|
+
return true;
|
259
|
+
}
|
260
|
+
}
|
261
|
+
return false;
|
262
|
+
};
|
263
|
+
any = curry$(function(f, xs){
|
264
|
+
var i$, len$, x;
|
265
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
266
|
+
x = xs[i$];
|
267
|
+
if (f(x)) {
|
268
|
+
return true;
|
269
|
+
}
|
270
|
+
}
|
271
|
+
return false;
|
272
|
+
});
|
273
|
+
all = curry$(function(f, xs){
|
274
|
+
var i$, len$, x;
|
275
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
276
|
+
x = xs[i$];
|
277
|
+
if (!f(x)) {
|
278
|
+
return false;
|
279
|
+
}
|
280
|
+
}
|
281
|
+
return true;
|
282
|
+
});
|
283
|
+
sort = function(xs){
|
284
|
+
return xs.concat().sort(function(x, y){
|
285
|
+
if (x > y) {
|
286
|
+
return 1;
|
287
|
+
} else if (x < y) {
|
288
|
+
return -1;
|
289
|
+
} else {
|
290
|
+
return 0;
|
291
|
+
}
|
292
|
+
});
|
293
|
+
};
|
294
|
+
sortWith = curry$(function(f, xs){
|
295
|
+
if (!xs.length) {
|
296
|
+
return [];
|
297
|
+
}
|
298
|
+
return xs.concat().sort(f);
|
299
|
+
});
|
300
|
+
sortBy = curry$(function(f, xs){
|
301
|
+
if (!xs.length) {
|
302
|
+
return [];
|
303
|
+
}
|
304
|
+
return xs.concat().sort(function(x, y){
|
305
|
+
if (f(x) > f(y)) {
|
306
|
+
return 1;
|
307
|
+
} else if (f(x) < f(y)) {
|
308
|
+
return -1;
|
309
|
+
} else {
|
310
|
+
return 0;
|
311
|
+
}
|
312
|
+
});
|
313
|
+
});
|
314
|
+
sum = function(xs){
|
315
|
+
var result, i$, len$, x;
|
316
|
+
result = 0;
|
317
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
318
|
+
x = xs[i$];
|
319
|
+
result += x;
|
320
|
+
}
|
321
|
+
return result;
|
322
|
+
};
|
323
|
+
product = function(xs){
|
324
|
+
var result, i$, len$, x;
|
325
|
+
result = 1;
|
326
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
327
|
+
x = xs[i$];
|
328
|
+
result *= x;
|
329
|
+
}
|
330
|
+
return result;
|
331
|
+
};
|
332
|
+
mean = average = function(xs){
|
333
|
+
var sum, len, i$, i;
|
334
|
+
sum = 0;
|
335
|
+
len = xs.length;
|
336
|
+
for (i$ = 0; i$ < len; ++i$) {
|
337
|
+
i = i$;
|
338
|
+
sum += xs[i];
|
339
|
+
}
|
340
|
+
return sum / len;
|
341
|
+
};
|
342
|
+
maximum = function(xs){
|
343
|
+
var max, i$, ref$, len$, x;
|
344
|
+
max = xs[0];
|
345
|
+
for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
|
346
|
+
x = ref$[i$];
|
347
|
+
if (x > max) {
|
348
|
+
max = x;
|
349
|
+
}
|
350
|
+
}
|
351
|
+
return max;
|
352
|
+
};
|
353
|
+
minimum = function(xs){
|
354
|
+
var min, i$, ref$, len$, x;
|
355
|
+
min = xs[0];
|
356
|
+
for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
|
357
|
+
x = ref$[i$];
|
358
|
+
if (x < min) {
|
359
|
+
min = x;
|
360
|
+
}
|
361
|
+
}
|
362
|
+
return min;
|
363
|
+
};
|
364
|
+
scan = scanl = curry$(function(f, memo, xs){
|
365
|
+
var last, x;
|
366
|
+
last = memo;
|
367
|
+
return [memo].concat((function(){
|
368
|
+
var i$, ref$, len$, results$ = [];
|
369
|
+
for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
|
370
|
+
x = ref$[i$];
|
371
|
+
results$.push(last = f(last, x));
|
372
|
+
}
|
373
|
+
return results$;
|
374
|
+
}()));
|
375
|
+
});
|
376
|
+
scan1 = scanl1 = curry$(function(f, xs){
|
377
|
+
if (!xs.length) {
|
378
|
+
return;
|
379
|
+
}
|
380
|
+
return scan(f, xs[0], xs.slice(1));
|
381
|
+
});
|
382
|
+
scanr = curry$(function(f, memo, xs){
|
383
|
+
xs = xs.concat().reverse();
|
384
|
+
return scan(f, memo, xs).reverse();
|
385
|
+
});
|
386
|
+
scanr1 = curry$(function(f, xs){
|
387
|
+
if (!xs.length) {
|
388
|
+
return;
|
389
|
+
}
|
390
|
+
xs = xs.concat().reverse();
|
391
|
+
return scan(f, xs[0], xs.slice(1)).reverse();
|
392
|
+
});
|
393
|
+
slice = curry$(function(x, y, xs){
|
394
|
+
return xs.slice(x, y);
|
395
|
+
});
|
396
|
+
take = curry$(function(n, xs){
|
397
|
+
if (n <= 0) {
|
398
|
+
return xs.slice(0, 0);
|
399
|
+
} else if (!xs.length) {
|
400
|
+
return xs;
|
401
|
+
} else {
|
402
|
+
return xs.slice(0, n);
|
403
|
+
}
|
404
|
+
});
|
405
|
+
drop = curry$(function(n, xs){
|
406
|
+
if (n <= 0 || !xs.length) {
|
407
|
+
return xs;
|
408
|
+
} else {
|
409
|
+
return xs.slice(n);
|
410
|
+
}
|
411
|
+
});
|
412
|
+
splitAt = curry$(function(n, xs){
|
413
|
+
return [take(n, xs), drop(n, xs)];
|
414
|
+
});
|
415
|
+
takeWhile = curry$(function(p, xs){
|
416
|
+
var len, i;
|
417
|
+
len = xs.length;
|
418
|
+
if (!len) {
|
419
|
+
return xs;
|
420
|
+
}
|
421
|
+
i = 0;
|
422
|
+
while (i < len && p(xs[i])) {
|
423
|
+
i += 1;
|
424
|
+
}
|
425
|
+
return xs.slice(0, i);
|
426
|
+
});
|
427
|
+
dropWhile = curry$(function(p, xs){
|
428
|
+
var len, i;
|
429
|
+
len = xs.length;
|
430
|
+
if (!len) {
|
431
|
+
return xs;
|
432
|
+
}
|
433
|
+
i = 0;
|
434
|
+
while (i < len && p(xs[i])) {
|
435
|
+
i += 1;
|
436
|
+
}
|
437
|
+
return xs.slice(i);
|
438
|
+
});
|
439
|
+
span = curry$(function(p, xs){
|
440
|
+
return [takeWhile(p, xs), dropWhile(p, xs)];
|
441
|
+
});
|
442
|
+
breakList = curry$(function(p, xs){
|
443
|
+
return span(compose$([not$, p]), xs);
|
444
|
+
});
|
445
|
+
zip = curry$(function(xs, ys){
|
446
|
+
var result, len, i$, len$, i, x;
|
447
|
+
result = [];
|
448
|
+
len = ys.length;
|
449
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
450
|
+
i = i$;
|
451
|
+
x = xs[i$];
|
452
|
+
if (i === len) {
|
453
|
+
break;
|
454
|
+
}
|
455
|
+
result.push([x, ys[i]]);
|
456
|
+
}
|
457
|
+
return result;
|
458
|
+
});
|
459
|
+
zipWith = curry$(function(f, xs, ys){
|
460
|
+
var result, len, i$, len$, i, x;
|
461
|
+
result = [];
|
462
|
+
len = ys.length;
|
463
|
+
for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
|
464
|
+
i = i$;
|
465
|
+
x = xs[i$];
|
466
|
+
if (i === len) {
|
467
|
+
break;
|
468
|
+
}
|
469
|
+
result.push(f(x, ys[i]));
|
470
|
+
}
|
471
|
+
return result;
|
472
|
+
});
|
473
|
+
zipAll = function(){
|
474
|
+
var xss, minLength, i$, len$, xs, ref$, i, lresult$, j$, results$ = [];
|
475
|
+
xss = slice$.call(arguments);
|
476
|
+
minLength = 9e9;
|
477
|
+
for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
|
478
|
+
xs = xss[i$];
|
479
|
+
minLength <= (ref$ = xs.length) || (minLength = ref$);
|
480
|
+
}
|
481
|
+
for (i$ = 0; i$ < minLength; ++i$) {
|
482
|
+
i = i$;
|
483
|
+
lresult$ = [];
|
484
|
+
for (j$ = 0, len$ = xss.length; j$ < len$; ++j$) {
|
485
|
+
xs = xss[j$];
|
486
|
+
lresult$.push(xs[i]);
|
487
|
+
}
|
488
|
+
results$.push(lresult$);
|
489
|
+
}
|
490
|
+
return results$;
|
491
|
+
};
|
492
|
+
zipAllWith = function(f){
|
493
|
+
var xss, minLength, i$, len$, xs, ref$, i, results$ = [];
|
494
|
+
xss = slice$.call(arguments, 1);
|
495
|
+
minLength = 9e9;
|
496
|
+
for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
|
497
|
+
xs = xss[i$];
|
498
|
+
minLength <= (ref$ = xs.length) || (minLength = ref$);
|
499
|
+
}
|
500
|
+
for (i$ = 0; i$ < minLength; ++i$) {
|
501
|
+
i = i$;
|
502
|
+
results$.push(f.apply(null, (fn$())));
|
503
|
+
}
|
504
|
+
return results$;
|
505
|
+
function fn$(){
|
506
|
+
var i$, ref$, len$, results$ = [];
|
507
|
+
for (i$ = 0, len$ = (ref$ = xss).length; i$ < len$; ++i$) {
|
508
|
+
xs = ref$[i$];
|
509
|
+
results$.push(xs[i]);
|
510
|
+
}
|
511
|
+
return results$;
|
512
|
+
}
|
513
|
+
};
|
514
|
+
module.exports = {
|
515
|
+
each: each,
|
516
|
+
map: map,
|
517
|
+
filter: filter,
|
518
|
+
compact: compact,
|
519
|
+
reject: reject,
|
520
|
+
partition: partition,
|
521
|
+
find: find,
|
522
|
+
head: head,
|
523
|
+
first: first,
|
524
|
+
tail: tail,
|
525
|
+
last: last,
|
526
|
+
initial: initial,
|
527
|
+
empty: empty,
|
528
|
+
reverse: reverse,
|
529
|
+
difference: difference,
|
530
|
+
intersection: intersection,
|
531
|
+
union: union,
|
532
|
+
countBy: countBy,
|
533
|
+
groupBy: groupBy,
|
534
|
+
fold: fold,
|
535
|
+
fold1: fold1,
|
536
|
+
foldl: foldl,
|
537
|
+
foldl1: foldl1,
|
538
|
+
foldr: foldr,
|
539
|
+
foldr1: foldr1,
|
540
|
+
unfoldr: unfoldr,
|
541
|
+
andList: andList,
|
542
|
+
orList: orList,
|
543
|
+
any: any,
|
544
|
+
all: all,
|
545
|
+
unique: unique,
|
546
|
+
sort: sort,
|
547
|
+
sortWith: sortWith,
|
548
|
+
sortBy: sortBy,
|
549
|
+
sum: sum,
|
550
|
+
product: product,
|
551
|
+
mean: mean,
|
552
|
+
average: average,
|
553
|
+
concat: concat,
|
554
|
+
concatMap: concatMap,
|
555
|
+
flatten: flatten,
|
556
|
+
maximum: maximum,
|
557
|
+
minimum: minimum,
|
558
|
+
scan: scan,
|
559
|
+
scan1: scan1,
|
560
|
+
scanl: scanl,
|
561
|
+
scanl1: scanl1,
|
562
|
+
scanr: scanr,
|
563
|
+
scanr1: scanr1,
|
564
|
+
slice: slice,
|
565
|
+
take: take,
|
566
|
+
drop: drop,
|
567
|
+
splitAt: splitAt,
|
568
|
+
takeWhile: takeWhile,
|
569
|
+
dropWhile: dropWhile,
|
570
|
+
span: span,
|
571
|
+
breakList: breakList,
|
572
|
+
zip: zip,
|
573
|
+
zipWith: zipWith,
|
574
|
+
zipAll: zipAll,
|
575
|
+
zipAllWith: zipAllWith
|
576
|
+
};
|
577
|
+
function curry$(f, bound){
|
578
|
+
var context,
|
579
|
+
_curry = function(args) {
|
580
|
+
return f.length > 1 ? function(){
|
581
|
+
var params = args ? args.concat() : [];
|
582
|
+
context = bound ? context || this : this;
|
583
|
+
return params.push.apply(params, arguments) <
|
584
|
+
f.length && arguments.length ?
|
585
|
+
_curry.call(context, params) : f.apply(context, params);
|
586
|
+
} : f;
|
587
|
+
};
|
588
|
+
return _curry();
|
589
|
+
}
|
590
|
+
function in$(x, arr){
|
591
|
+
var i = -1, l = arr.length >>> 0;
|
592
|
+
while (++i < l) if (x === arr[i] && i in arr) return true;
|
593
|
+
return false;
|
594
|
+
}
|
595
|
+
function compose$(fs){
|
596
|
+
return function(){
|
597
|
+
var i, args = arguments;
|
598
|
+
for (i = fs.length; i > 0; --i) { args = [fs[i-1].apply(this, args)]; }
|
599
|
+
return args[0];
|
600
|
+
};
|
601
|
+
}
|
602
|
+
function not$(x){ return !x; }
|