@kpi4me/golden-layout
Version:
A multi-screen javascript Layout manager https://golden-layout.com
156 lines (155 loc) • 3.38 kB
JavaScript
// Generated by CoffeeScript 2.0.0-beta8
var concat, foldl, map, nub, span;
this.any = function (list, fn) {
var e;
for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) {
e = list[i$];
if (fn(e))
return true;
}
return false;
};
this.all = function (list, fn) {
var e;
for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) {
e = list[i$];
if (!fn(e))
return false;
}
return true;
};
this.foldl = foldl = function (memo, list, fn) {
var i;
for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) {
i = list[i$];
memo = fn(memo, i);
}
return memo;
};
this.foldl1 = function (list, fn) {
return foldl(list[0], list.slice(1), fn);
};
this.map = map = function (list, fn) {
var e;
return function (accum$) {
for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) {
e = list[i$];
accum$.push(fn(e));
}
return accum$;
}.call(this, []);
};
this.concat = concat = function (list) {
var cache$;
return (cache$ = []).concat.apply(cache$, [].slice.call(list));
};
this.concatMap = function (list, fn) {
return concat(map(list, fn));
};
this.intersect = function (listA, listB) {
var a;
return function (accum$) {
for (var i$ = 0, length$ = listA.length; i$ < length$; ++i$) {
a = listA[i$];
if (!in$(a, listB))
continue;
accum$.push(a);
}
return accum$;
}.call(this, []);
};
this.difference = function (listA, listB) {
var a;
return function (accum$) {
for (var i$ = 0, length$ = listA.length; i$ < length$; ++i$) {
a = listA[i$];
if (!!in$(a, listB))
continue;
accum$.push(a);
}
return accum$;
}.call(this, []);
};
this.nub = nub = function (list) {
var i, result;
result = [];
for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) {
i = list[i$];
if (!!in$(i, result))
continue;
result.push(i);
}
return result;
};
this.union = function (listA, listB) {
var b;
return listA.concat(function (accum$) {
for (var cache$ = nub(listB), i$ = 0, length$ = cache$.length; i$ < length$; ++i$) {
b = cache$[i$];
if (!!in$(b, listA))
continue;
accum$.push(b);
}
return accum$;
}.call(this, []));
};
this.flip = function (fn) {
return function (b, a) {
return fn.call(this, a, b);
};
};
this.owns = function (hop) {
return function (a, b) {
return hop.call(a, b);
};
}({}.hasOwnProperty);
this.span = span = function (list, f) {
var cache$, ys, zs;
if (list.length === 0) {
return [
[],
[]
];
} else if (f(list[0])) {
cache$ = span(list.slice(1), f);
ys = cache$[0];
zs = cache$[1];
return [
[list[0]].concat([].slice.call(ys)),
zs
];
} else {
return [
[],
list
];
}
};
this.divMod = function (a, b) {
var c, div, mod;
c = a % b;
mod = c < 0 ? c + b : c;
div = Math.floor(a / b);
return [
div,
mod
];
};
this.partition = function (list, fn) {
var item, result;
result = [
[],
[]
];
for (var i$ = 0, length$ = list.length; i$ < length$; ++i$) {
item = list[i$];
result[+!fn(item)].push(item);
}
return result;
};
function in$(member, list) {
for (var i = 0, length = list.length; i < length; ++i)
if (i in list && list[i] === member)
return true;
return false;
}