Syntax for Levenberg Marquardt curve-fitting


I have gone through the documentation for the LM-curvefit, but do not know how it can be used/called. Is this how it can be called? It’s not as explicit as ml-levenberg-marquardt documentation [ ]. Please I will appreciate your assistance.

Example: The goal is to obtain the parameters p[0] and p[1] in the relationship between Y (dependent) and X(independent variable).
var ML = require(“my-ml-curve-fitting”)
const A = [1000,2000,3000,4000,5000];
const B = [90,85,75,66,57];
const C = [89,95,98,104,120];
const Y = [300,350,400,405,500];
const X = [800,850,1200,2500,4505];
const pint = [0.465,1.2];
var fun = function(t,p,c){
for (let j=0; j<5;j++){
return y

p_fit = ML.optimize(fun,pint,X,Y)

This is the error I received: