js diffata functional