Record Something important with pictures!
function debounce(fn){
var timer;
return function(){
if(timer)
clearTimeout(timer);
timer=setTimeout(()=>fn.call(this,arguments),1000);
}
}
function throttle(fn){
let timer;
return function(){
if(timer)
return;
timer=setTimeout(()=>{fn.call(this,arguments);console.log(arguments);timer=null;},1000);
}
}
map "v:1" to "version:1.0.0"
var objectMap=o=>keyMap=>valueMap=>{
var newObject={};
Object.keys(o).forEach(key => {
newObject[keyMap[key]] =valueMap[o[key]];
});
return newObject
}
let o ={v:'1'} ;
objectMap(o)({v:'version'})({'1':'1.0.0'});