Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

List.js 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716
  1. // Generated by LiveScript 1.6.0
  2. var each, map, compact, filter, reject, remove, partition, find, head, first, tail, last, initial, empty, reverse, unique, uniqueBy, 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, maximumBy, minimumBy, scan, scanl, scan1, scanl1, scanr, scanr1, slice, take, drop, splitAt, takeWhile, dropWhile, span, breakList, zip, zipWith, zipAll, zipAllWith, at, elemIndex, elemIndices, findIndex, findIndices, toString$ = {}.toString;
  3. each = curry$(function(f, xs){
  4. var i$, len$, x;
  5. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  6. x = xs[i$];
  7. f(x);
  8. }
  9. return xs;
  10. });
  11. map = curry$(function(f, xs){
  12. var i$, len$, x, results$ = [];
  13. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  14. x = xs[i$];
  15. results$.push(f(x));
  16. }
  17. return results$;
  18. });
  19. compact = function(xs){
  20. var i$, len$, x, results$ = [];
  21. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  22. x = xs[i$];
  23. if (x) {
  24. results$.push(x);
  25. }
  26. }
  27. return results$;
  28. };
  29. filter = curry$(function(f, xs){
  30. var i$, len$, x, results$ = [];
  31. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  32. x = xs[i$];
  33. if (f(x)) {
  34. results$.push(x);
  35. }
  36. }
  37. return results$;
  38. });
  39. reject = curry$(function(f, xs){
  40. var i$, len$, x, results$ = [];
  41. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  42. x = xs[i$];
  43. if (!f(x)) {
  44. results$.push(x);
  45. }
  46. }
  47. return results$;
  48. });
  49. remove = curry$(function(el, xs){
  50. var i, x$;
  51. i = elemIndex(el, xs);
  52. x$ = xs.slice();
  53. if (i != null) {
  54. x$.splice(i, 1);
  55. }
  56. return x$;
  57. });
  58. partition = curry$(function(f, xs){
  59. var passed, failed, i$, len$, x;
  60. passed = [];
  61. failed = [];
  62. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  63. x = xs[i$];
  64. (f(x) ? passed : failed).push(x);
  65. }
  66. return [passed, failed];
  67. });
  68. find = curry$(function(f, xs){
  69. var i$, len$, x;
  70. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  71. x = xs[i$];
  72. if (f(x)) {
  73. return x;
  74. }
  75. }
  76. });
  77. head = first = function(xs){
  78. return xs[0];
  79. };
  80. tail = function(xs){
  81. if (!xs.length) {
  82. return;
  83. }
  84. return xs.slice(1);
  85. };
  86. last = function(xs){
  87. return xs[xs.length - 1];
  88. };
  89. initial = function(xs){
  90. if (!xs.length) {
  91. return;
  92. }
  93. return xs.slice(0, -1);
  94. };
  95. empty = function(xs){
  96. return !xs.length;
  97. };
  98. reverse = function(xs){
  99. return xs.concat().reverse();
  100. };
  101. unique = function(xs){
  102. var result, i$, len$, x;
  103. result = [];
  104. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  105. x = xs[i$];
  106. if (!in$(x, result)) {
  107. result.push(x);
  108. }
  109. }
  110. return result;
  111. };
  112. uniqueBy = curry$(function(f, xs){
  113. var seen, i$, len$, x, val, results$ = [];
  114. seen = [];
  115. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  116. x = xs[i$];
  117. val = f(x);
  118. if (in$(val, seen)) {
  119. continue;
  120. }
  121. seen.push(val);
  122. results$.push(x);
  123. }
  124. return results$;
  125. });
  126. fold = foldl = curry$(function(f, memo, xs){
  127. var i$, len$, x;
  128. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  129. x = xs[i$];
  130. memo = f(memo, x);
  131. }
  132. return memo;
  133. });
  134. fold1 = foldl1 = curry$(function(f, xs){
  135. return fold(f, xs[0], xs.slice(1));
  136. });
  137. foldr = curry$(function(f, memo, xs){
  138. var i$, x;
  139. for (i$ = xs.length - 1; i$ >= 0; --i$) {
  140. x = xs[i$];
  141. memo = f(x, memo);
  142. }
  143. return memo;
  144. });
  145. foldr1 = curry$(function(f, xs){
  146. return foldr(f, xs[xs.length - 1], xs.slice(0, -1));
  147. });
  148. unfoldr = curry$(function(f, b){
  149. var result, x, that;
  150. result = [];
  151. x = b;
  152. while ((that = f(x)) != null) {
  153. result.push(that[0]);
  154. x = that[1];
  155. }
  156. return result;
  157. });
  158. concat = function(xss){
  159. return [].concat.apply([], xss);
  160. };
  161. concatMap = curry$(function(f, xs){
  162. var x;
  163. return [].concat.apply([], (function(){
  164. var i$, ref$, len$, results$ = [];
  165. for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
  166. x = ref$[i$];
  167. results$.push(f(x));
  168. }
  169. return results$;
  170. }()));
  171. });
  172. flatten = function(xs){
  173. var x;
  174. return [].concat.apply([], (function(){
  175. var i$, ref$, len$, results$ = [];
  176. for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
  177. x = ref$[i$];
  178. if (toString$.call(x).slice(8, -1) === 'Array') {
  179. results$.push(flatten(x));
  180. } else {
  181. results$.push(x);
  182. }
  183. }
  184. return results$;
  185. }()));
  186. };
  187. difference = function(xs){
  188. var yss, res$, i$, to$, results, len$, x, j$, len1$, ys;
  189. res$ = [];
  190. for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
  191. res$.push(arguments[i$]);
  192. }
  193. yss = res$;
  194. results = [];
  195. outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  196. x = xs[i$];
  197. for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) {
  198. ys = yss[j$];
  199. if (in$(x, ys)) {
  200. continue outer;
  201. }
  202. }
  203. results.push(x);
  204. }
  205. return results;
  206. };
  207. intersection = function(xs){
  208. var yss, res$, i$, to$, results, len$, x, j$, len1$, ys;
  209. res$ = [];
  210. for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
  211. res$.push(arguments[i$]);
  212. }
  213. yss = res$;
  214. results = [];
  215. outer: for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  216. x = xs[i$];
  217. for (j$ = 0, len1$ = yss.length; j$ < len1$; ++j$) {
  218. ys = yss[j$];
  219. if (!in$(x, ys)) {
  220. continue outer;
  221. }
  222. }
  223. results.push(x);
  224. }
  225. return results;
  226. };
  227. union = function(){
  228. var xss, res$, i$, to$, results, len$, xs, j$, len1$, x;
  229. res$ = [];
  230. for (i$ = 0, to$ = arguments.length; i$ < to$; ++i$) {
  231. res$.push(arguments[i$]);
  232. }
  233. xss = res$;
  234. results = [];
  235. for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
  236. xs = xss[i$];
  237. for (j$ = 0, len1$ = xs.length; j$ < len1$; ++j$) {
  238. x = xs[j$];
  239. if (!in$(x, results)) {
  240. results.push(x);
  241. }
  242. }
  243. }
  244. return results;
  245. };
  246. countBy = curry$(function(f, xs){
  247. var results, i$, len$, x, key;
  248. results = {};
  249. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  250. x = xs[i$];
  251. key = f(x);
  252. if (key in results) {
  253. results[key] += 1;
  254. } else {
  255. results[key] = 1;
  256. }
  257. }
  258. return results;
  259. });
  260. groupBy = curry$(function(f, xs){
  261. var results, i$, len$, x, key;
  262. results = {};
  263. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  264. x = xs[i$];
  265. key = f(x);
  266. if (key in results) {
  267. results[key].push(x);
  268. } else {
  269. results[key] = [x];
  270. }
  271. }
  272. return results;
  273. });
  274. andList = function(xs){
  275. var i$, len$, x;
  276. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  277. x = xs[i$];
  278. if (!x) {
  279. return false;
  280. }
  281. }
  282. return true;
  283. };
  284. orList = function(xs){
  285. var i$, len$, x;
  286. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  287. x = xs[i$];
  288. if (x) {
  289. return true;
  290. }
  291. }
  292. return false;
  293. };
  294. any = curry$(function(f, xs){
  295. var i$, len$, x;
  296. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  297. x = xs[i$];
  298. if (f(x)) {
  299. return true;
  300. }
  301. }
  302. return false;
  303. });
  304. all = curry$(function(f, xs){
  305. var i$, len$, x;
  306. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  307. x = xs[i$];
  308. if (!f(x)) {
  309. return false;
  310. }
  311. }
  312. return true;
  313. });
  314. sort = function(xs){
  315. return xs.concat().sort(function(x, y){
  316. if (x > y) {
  317. return 1;
  318. } else if (x < y) {
  319. return -1;
  320. } else {
  321. return 0;
  322. }
  323. });
  324. };
  325. sortWith = curry$(function(f, xs){
  326. return xs.concat().sort(f);
  327. });
  328. sortBy = curry$(function(f, xs){
  329. return xs.concat().sort(function(x, y){
  330. if (f(x) > f(y)) {
  331. return 1;
  332. } else if (f(x) < f(y)) {
  333. return -1;
  334. } else {
  335. return 0;
  336. }
  337. });
  338. });
  339. sum = function(xs){
  340. var result, i$, len$, x;
  341. result = 0;
  342. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  343. x = xs[i$];
  344. result += x;
  345. }
  346. return result;
  347. };
  348. product = function(xs){
  349. var result, i$, len$, x;
  350. result = 1;
  351. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  352. x = xs[i$];
  353. result *= x;
  354. }
  355. return result;
  356. };
  357. mean = average = function(xs){
  358. var sum, i$, len$, x;
  359. sum = 0;
  360. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  361. x = xs[i$];
  362. sum += x;
  363. }
  364. return sum / xs.length;
  365. };
  366. maximum = function(xs){
  367. var max, i$, ref$, len$, x;
  368. max = xs[0];
  369. for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
  370. x = ref$[i$];
  371. if (x > max) {
  372. max = x;
  373. }
  374. }
  375. return max;
  376. };
  377. minimum = function(xs){
  378. var min, i$, ref$, len$, x;
  379. min = xs[0];
  380. for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
  381. x = ref$[i$];
  382. if (x < min) {
  383. min = x;
  384. }
  385. }
  386. return min;
  387. };
  388. maximumBy = curry$(function(f, xs){
  389. var max, i$, ref$, len$, x;
  390. max = xs[0];
  391. for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
  392. x = ref$[i$];
  393. if (f(x) > f(max)) {
  394. max = x;
  395. }
  396. }
  397. return max;
  398. });
  399. minimumBy = curry$(function(f, xs){
  400. var min, i$, ref$, len$, x;
  401. min = xs[0];
  402. for (i$ = 0, len$ = (ref$ = xs.slice(1)).length; i$ < len$; ++i$) {
  403. x = ref$[i$];
  404. if (f(x) < f(min)) {
  405. min = x;
  406. }
  407. }
  408. return min;
  409. });
  410. scan = scanl = curry$(function(f, memo, xs){
  411. var last, x;
  412. last = memo;
  413. return [memo].concat((function(){
  414. var i$, ref$, len$, results$ = [];
  415. for (i$ = 0, len$ = (ref$ = xs).length; i$ < len$; ++i$) {
  416. x = ref$[i$];
  417. results$.push(last = f(last, x));
  418. }
  419. return results$;
  420. }()));
  421. });
  422. scan1 = scanl1 = curry$(function(f, xs){
  423. if (!xs.length) {
  424. return;
  425. }
  426. return scan(f, xs[0], xs.slice(1));
  427. });
  428. scanr = curry$(function(f, memo, xs){
  429. xs = xs.concat().reverse();
  430. return scan(f, memo, xs).reverse();
  431. });
  432. scanr1 = curry$(function(f, xs){
  433. if (!xs.length) {
  434. return;
  435. }
  436. xs = xs.concat().reverse();
  437. return scan(f, xs[0], xs.slice(1)).reverse();
  438. });
  439. slice = curry$(function(x, y, xs){
  440. return xs.slice(x, y);
  441. });
  442. take = curry$(function(n, xs){
  443. if (n <= 0) {
  444. return xs.slice(0, 0);
  445. } else {
  446. return xs.slice(0, n);
  447. }
  448. });
  449. drop = curry$(function(n, xs){
  450. if (n <= 0) {
  451. return xs;
  452. } else {
  453. return xs.slice(n);
  454. }
  455. });
  456. splitAt = curry$(function(n, xs){
  457. return [take(n, xs), drop(n, xs)];
  458. });
  459. takeWhile = curry$(function(p, xs){
  460. var len, i;
  461. len = xs.length;
  462. if (!len) {
  463. return xs;
  464. }
  465. i = 0;
  466. while (i < len && p(xs[i])) {
  467. i += 1;
  468. }
  469. return xs.slice(0, i);
  470. });
  471. dropWhile = curry$(function(p, xs){
  472. var len, i;
  473. len = xs.length;
  474. if (!len) {
  475. return xs;
  476. }
  477. i = 0;
  478. while (i < len && p(xs[i])) {
  479. i += 1;
  480. }
  481. return xs.slice(i);
  482. });
  483. span = curry$(function(p, xs){
  484. return [takeWhile(p, xs), dropWhile(p, xs)];
  485. });
  486. breakList = curry$(function(p, xs){
  487. return span(compose$(p, not$), xs);
  488. });
  489. zip = curry$(function(xs, ys){
  490. var result, len, i$, len$, i, x;
  491. result = [];
  492. len = ys.length;
  493. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  494. i = i$;
  495. x = xs[i$];
  496. if (i === len) {
  497. break;
  498. }
  499. result.push([x, ys[i]]);
  500. }
  501. return result;
  502. });
  503. zipWith = curry$(function(f, xs, ys){
  504. var result, len, i$, len$, i, x;
  505. result = [];
  506. len = ys.length;
  507. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  508. i = i$;
  509. x = xs[i$];
  510. if (i === len) {
  511. break;
  512. }
  513. result.push(f(x, ys[i]));
  514. }
  515. return result;
  516. });
  517. zipAll = function(){
  518. var xss, res$, i$, to$, minLength, len$, xs, ref$, i, lresult$, j$, results$ = [];
  519. res$ = [];
  520. for (i$ = 0, to$ = arguments.length; i$ < to$; ++i$) {
  521. res$.push(arguments[i$]);
  522. }
  523. xss = res$;
  524. minLength = undefined;
  525. for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
  526. xs = xss[i$];
  527. minLength <= (ref$ = xs.length) || (minLength = ref$);
  528. }
  529. for (i$ = 0; i$ < minLength; ++i$) {
  530. i = i$;
  531. lresult$ = [];
  532. for (j$ = 0, len$ = xss.length; j$ < len$; ++j$) {
  533. xs = xss[j$];
  534. lresult$.push(xs[i]);
  535. }
  536. results$.push(lresult$);
  537. }
  538. return results$;
  539. };
  540. zipAllWith = function(f){
  541. var xss, res$, i$, to$, minLength, len$, xs, ref$, i, results$ = [];
  542. res$ = [];
  543. for (i$ = 1, to$ = arguments.length; i$ < to$; ++i$) {
  544. res$.push(arguments[i$]);
  545. }
  546. xss = res$;
  547. minLength = undefined;
  548. for (i$ = 0, len$ = xss.length; i$ < len$; ++i$) {
  549. xs = xss[i$];
  550. minLength <= (ref$ = xs.length) || (minLength = ref$);
  551. }
  552. for (i$ = 0; i$ < minLength; ++i$) {
  553. i = i$;
  554. results$.push(f.apply(null, (fn$())));
  555. }
  556. return results$;
  557. function fn$(){
  558. var i$, ref$, len$, results$ = [];
  559. for (i$ = 0, len$ = (ref$ = xss).length; i$ < len$; ++i$) {
  560. xs = ref$[i$];
  561. results$.push(xs[i]);
  562. }
  563. return results$;
  564. }
  565. };
  566. at = curry$(function(n, xs){
  567. if (n < 0) {
  568. return xs[xs.length + n];
  569. } else {
  570. return xs[n];
  571. }
  572. });
  573. elemIndex = curry$(function(el, xs){
  574. var i$, len$, i, x;
  575. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  576. i = i$;
  577. x = xs[i$];
  578. if (x === el) {
  579. return i;
  580. }
  581. }
  582. });
  583. elemIndices = curry$(function(el, xs){
  584. var i$, len$, i, x, results$ = [];
  585. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  586. i = i$;
  587. x = xs[i$];
  588. if (x === el) {
  589. results$.push(i);
  590. }
  591. }
  592. return results$;
  593. });
  594. findIndex = curry$(function(f, xs){
  595. var i$, len$, i, x;
  596. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  597. i = i$;
  598. x = xs[i$];
  599. if (f(x)) {
  600. return i;
  601. }
  602. }
  603. });
  604. findIndices = curry$(function(f, xs){
  605. var i$, len$, i, x, results$ = [];
  606. for (i$ = 0, len$ = xs.length; i$ < len$; ++i$) {
  607. i = i$;
  608. x = xs[i$];
  609. if (f(x)) {
  610. results$.push(i);
  611. }
  612. }
  613. return results$;
  614. });
  615. module.exports = {
  616. each: each,
  617. map: map,
  618. filter: filter,
  619. compact: compact,
  620. reject: reject,
  621. remove: remove,
  622. partition: partition,
  623. find: find,
  624. head: head,
  625. first: first,
  626. tail: tail,
  627. last: last,
  628. initial: initial,
  629. empty: empty,
  630. reverse: reverse,
  631. difference: difference,
  632. intersection: intersection,
  633. union: union,
  634. countBy: countBy,
  635. groupBy: groupBy,
  636. fold: fold,
  637. fold1: fold1,
  638. foldl: foldl,
  639. foldl1: foldl1,
  640. foldr: foldr,
  641. foldr1: foldr1,
  642. unfoldr: unfoldr,
  643. andList: andList,
  644. orList: orList,
  645. any: any,
  646. all: all,
  647. unique: unique,
  648. uniqueBy: uniqueBy,
  649. sort: sort,
  650. sortWith: sortWith,
  651. sortBy: sortBy,
  652. sum: sum,
  653. product: product,
  654. mean: mean,
  655. average: average,
  656. concat: concat,
  657. concatMap: concatMap,
  658. flatten: flatten,
  659. maximum: maximum,
  660. minimum: minimum,
  661. maximumBy: maximumBy,
  662. minimumBy: minimumBy,
  663. scan: scan,
  664. scan1: scan1,
  665. scanl: scanl,
  666. scanl1: scanl1,
  667. scanr: scanr,
  668. scanr1: scanr1,
  669. slice: slice,
  670. take: take,
  671. drop: drop,
  672. splitAt: splitAt,
  673. takeWhile: takeWhile,
  674. dropWhile: dropWhile,
  675. span: span,
  676. breakList: breakList,
  677. zip: zip,
  678. zipWith: zipWith,
  679. zipAll: zipAll,
  680. zipAllWith: zipAllWith,
  681. at: at,
  682. elemIndex: elemIndex,
  683. elemIndices: elemIndices,
  684. findIndex: findIndex,
  685. findIndices: findIndices
  686. };
  687. function curry$(f, bound){
  688. var context,
  689. _curry = function(args) {
  690. return f.length > 1 ? function(){
  691. var params = args ? args.concat() : [];
  692. context = bound ? context || this : this;
  693. return params.push.apply(params, arguments) <
  694. f.length && arguments.length ?
  695. _curry.call(context, params) : f.apply(context, params);
  696. } : f;
  697. };
  698. return _curry();
  699. }
  700. function in$(x, xs){
  701. var i = -1, l = xs.length >>> 0;
  702. while (++i < l) if (x === xs[i]) return true;
  703. return false;
  704. }
  705. function compose$() {
  706. var functions = arguments;
  707. return function() {
  708. var i, result;
  709. result = functions[0].apply(this, arguments);
  710. for (i = 1; i < functions.length; ++i) {
  711. result = functions[i](result);
  712. }
  713. return result;
  714. };
  715. }
  716. function not$(x){ return !x; }