Skip to content

Instantly share code, notes, and snippets.

@wmaurer
Created December 17, 2019 12:28
Show Gist options
  • Save wmaurer/a1f2592a8e15b3a85c383f6077617b13 to your computer and use it in GitHub Desktop.
Save wmaurer/a1f2592a8e15b3a85c383f6077617b13 to your computer and use it in GitHub Desktop.
tree-shaking-test fp-ts build output
!(function(n) {
var t = {};
function r(e) {
if (t[e]) return t[e].exports;
var u = (t[e] = { i: e, l: !1, exports: {} });
return n[e].call(u.exports, u, u.exports, r), (u.l = !0), u.exports;
}
(r.m = n),
(r.c = t),
(r.d = function(n, t, e) {
r.o(n, t) || Object.defineProperty(n, t, { enumerable: !0, get: e });
}),
(r.r = function(n) {
"undefined" != typeof Symbol &&
Symbol.toStringTag &&
Object.defineProperty(n, Symbol.toStringTag, { value: "Module" }),
Object.defineProperty(n, "__esModule", { value: !0 });
}),
(r.t = function(n, t) {
if ((1 & t && (n = r(n)), 8 & t)) return n;
if (4 & t && "object" == typeof n && n && n.__esModule) return n;
var e = Object.create(null);
if (
(r.r(e),
Object.defineProperty(e, "default", { enumerable: !0, value: n }),
2 & t && "string" != typeof n)
)
for (var u in n)
r.d(
e,
u,
function(t) {
return n[t];
}.bind(null, u)
);
return e;
}),
(r.n = function(n) {
var t =
n && n.__esModule
? function() {
return n.default;
}
: function() {
return n;
};
return r.d(t, "a", t), t;
}),
(r.o = function(n, t) {
return Object.prototype.hasOwnProperty.call(n, t);
}),
(r.p = ""),
r((r.s = 0));
})([
function(n, t, r) {
"use strict";
function e(n) {
return n;
}
r.r(t);
var u = function(n) {
return "function" == typeof n.map;
},
i = function(n) {
return "function" == typeof n.contramap;
},
o = function(n) {
return "function" == typeof n.mapWithIndex;
},
f = function(n) {
return "function" == typeof n.ap;
},
c = function(n) {
return "function" == typeof n.chain;
},
a = function(n) {
return "function" == typeof n.bimap;
},
p = function(n) {
return "function" == typeof n.extend;
},
l = function(n) {
return "function" == typeof n.reduce;
},
d = function(n) {
return "function" == typeof n.reduceWithIndex;
},
h = function(n) {
return "function" == typeof n.alt;
},
m = function(n) {
return "function" == typeof n.compact;
},
v = function(n) {
return "function" == typeof n.filter;
},
x = function(n) {
return "function" == typeof n.filterWithIndex;
},
s = function(n) {
return "function" == typeof n.promap;
},
y = function(n) {
return "function" == typeof n.compose;
},
g = function(n) {
return "function" == typeof n.throwError;
};
var M = { _tag: "None" };
function I(n) {
return { _tag: "Some", value: n };
}
function W(n) {
return "None" === n._tag;
}
function b(n) {
return null == n ? M : I(n);
}
function _(n) {
return "Right" === n._tag ? M : I(n.left);
}
function O(n) {
return "Left" === n._tag ? M : I(n.right);
}
var w = { left: M, right: M },
E = function(n) {
return n;
},
R = {
URI: "Option",
map: function(n, t) {
return W(n) ? M : I(t(n.value));
},
of: I,
ap: function(n, t) {
return W(n) ? M : W(t) ? M : I(n.value(t.value));
},
chain: function(n, t) {
return W(n) ? M : t(n.value);
},
reduce: function(n, t, r) {
return W(n) ? t : r(t, n.value);
},
foldMap: function(n) {
return function(t, r) {
return W(t) ? n.empty : r(t.value);
};
},
reduceRight: function(n, t, r) {
return W(n) ? t : r(n.value, t);
},
traverse: function(n) {
return function(t, r) {
return W(t) ? n.of(M) : n.map(r(t.value), I);
};
},
sequence: function(n) {
return function(t) {
return W(t) ? n.of(M) : n.map(t.value, I);
};
},
zero: function() {
return M;
},
alt: function(n, t) {
return W(n) ? t() : n;
},
extend: function(n, t) {
return W(n) ? M : I(t(n));
},
compact: function(n) {
return R.chain(n, E);
},
separate: function(n) {
var t = R.map(n, function(n) {
return { left: _(n), right: O(n) };
});
return W(t) ? w : t.value;
},
filter: function(n, t) {
return W(n) ? M : t(n.value) ? n : M;
},
filterMap: function(n, t) {
return W(n) ? M : t(n.value);
},
partition: function(n, t) {
return {
left: R.filter(n, function(n) {
return !t(n);
}),
right: R.filter(n, t)
};
},
partitionMap: function(n, t) {
return R.separate(R.map(n, t));
},
wither: function(n) {
return function(t, r) {
return W(t) ? n.of(M) : r(t.value);
};
},
wilt: function(n) {
return function(t, r) {
var e = R.map(t, function(t) {
return n.map(r(t), function(n) {
return { left: _(n), right: O(n) };
});
});
return W(e) ? n.of({ left: M, right: M }) : e.value;
};
},
throwError: function() {
return M;
}
},
S = (function(n) {
var t = {};
if (u(n)) {
t.map = function(t) {
return function(r) {
return n.map(r, t);
};
};
}
if (i(n)) {
t.contramap = function(t) {
return function(r) {
return n.contramap(r, t);
};
};
}
if (o(n)) {
t.mapWithIndex = function(t) {
return function(r) {
return n.mapWithIndex(r, t);
};
};
}
if (f(n)) {
(t.ap = function(t) {
return function(r) {
return n.ap(r, t);
};
}),
(t.apFirst = function(t) {
return function(r) {
return n.ap(
n.map(r, function(n) {
return function() {
return n;
};
}),
t
);
};
}),
(t.apSecond = function(t) {
return function(r) {
return n.ap(
n.map(r, function() {
return function(n) {
return n;
};
}),
t
);
};
});
}
if (c(n)) {
(t.chain = function(t) {
return function(r) {
return n.chain(r, t);
};
}),
(t.chainFirst = function(t) {
return function(r) {
return n.chain(r, function(r) {
return n.map(t(r), function() {
return r;
});
});
};
}),
(t.flatten = function(t) {
return n.chain(t, e);
});
}
if (a(n)) {
(t.bimap = function(t, r) {
return function(e) {
return n.bimap(e, t, r);
};
}),
(t.mapLeft = function(t) {
return function(r) {
return n.mapLeft(r, t);
};
});
}
if (p(n)) {
(t.extend = function(t) {
return function(r) {
return n.extend(r, t);
};
}),
(t.duplicate = function(t) {
return n.extend(t, e);
});
}
if (l(n)) {
(t.reduce = function(t, r) {
return function(e) {
return n.reduce(e, t, r);
};
}),
(t.foldMap = function(t) {
var r = n.foldMap(t);
return function(n) {
return function(t) {
return r(t, n);
};
};
}),
(t.reduceRight = function(t, r) {
return function(e) {
return n.reduceRight(e, t, r);
};
});
}
if (d(n)) {
(t.reduceWithIndex = function(t, r) {
return function(e) {
return n.reduceWithIndex(e, t, r);
};
}),
(t.foldMapWithIndex = function(t) {
var r = n.foldMapWithIndex(t);
return function(n) {
return function(t) {
return r(t, n);
};
};
}),
(t.reduceRightWithIndex = function(t, r) {
return function(e) {
return n.reduceRightWithIndex(e, t, r);
};
});
}
if (h(n)) {
t.alt = function(t) {
return function(r) {
return n.alt(r, t);
};
};
}
if (
(m(n) && ((t.compact = n.compact), (t.separate = n.separate)), v(n))
) {
(t.filter = function(t) {
return function(r) {
return n.filter(r, t);
};
}),
(t.filterMap = function(t) {
return function(r) {
return n.filterMap(r, t);
};
}),
(t.partition = function(t) {
return function(r) {
return n.partition(r, t);
};
}),
(t.partitionMap = function(t) {
return function(r) {
return n.partitionMap(r, t);
};
});
}
if (x(n)) {
(t.filterWithIndex = function(t) {
return function(r) {
return n.filterWithIndex(r, t);
};
}),
(t.filterMapWithIndex = function(t) {
return function(r) {
return n.filterMapWithIndex(r, t);
};
}),
(t.partitionWithIndex = function(t) {
return function(r) {
return n.partitionWithIndex(r, t);
};
}),
(t.partitionMapWithIndex = function(t) {
return function(r) {
return n.partitionMapWithIndex(r, t);
};
});
}
if (s(n)) {
t.promap = function(t, r) {
return function(e) {
return n.promap(e, t, r);
};
};
}
if (y(n)) {
t.compose = function(t) {
return function(r) {
return n.compose(r, t);
};
};
}
if (g(n)) {
(t.fromOption = function(t) {
return function(r) {
return "None" === r._tag ? n.throwError(t()) : n.of(r.value);
};
}),
(t.fromEither = function(t) {
return "Left" === t._tag ? n.throwError(t.left) : n.of(t.right);
}),
(t.fromPredicate = function(t, r) {
return function(e) {
return t(e) ? n.of(e) : n.throwError(r(e));
};
}),
(t.filterOrElse = function(t, r) {
return function(e) {
return n.chain(e, function(e) {
return t(e) ? n.of(e) : n.throwError(r(e));
});
};
});
}
return t;
})(R);
S.alt,
S.ap,
S.apFirst,
S.apSecond,
S.chain,
S.chainFirst,
S.duplicate,
S.extend,
S.filter,
S.filterMap,
S.flatten,
S.foldMap,
S.map,
S.partition,
S.partitionMap,
S.reduce,
S.reduceRight,
S.compact,
S.separate,
S.fromEither;
console.log(b(1));
}
]);
//# sourceMappingURL=index.js.map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment