Skip to content

Instantly share code, notes, and snippets.

View tkheyfets's full-sized avatar
🥴

Timur Kheyfets tkheyfets

🥴
View GitHub Profile
function memoize(fn) {
var slice = Array.prototype.slice,
cache = [];
return function () {
var args = slice.call(arguments),
result = cache[args];
if (!result) {
result = cache[args] = fn.apply(this, args);
}
var uniqID = (function () {
var _uniq = new Date().getTime();
return function () {
return (_uniq++).toString(36);
};
})()
function toArray(args) {
return Array.prototype.slice.call(args);
}