What's each method call in this function doing?
export const capitalize = (string: string): string =>
	string
		.replace(/([A-Z]+)/g, " $1")
		.replace(/([A-Z][a-z])/g, " $1")
		.split(/([\s-])/g)
		.map((str) => (str?.[0]?.toUpperCase() || "") + (str.slice(1)?.toLowerCase() || ""))
		.join(" ");
system
is fnction main prayek vidhi kya kol kar rahi he?
export cast capitalise = (string: string): string =>
dori
.replace (/([a-z]+)/g, "$ 1")
.replace (/([a-z] [a-z])/g, "$ 1")
.split (/([[\ s-])/g)
.map ((str) => (str.: [0].
.jodna(" ");
user
is fnction main pehali vidhi kol string#kaa upyog karti he, jo bade aksharon ke kisi bhi anukram se pehle ek sthaan daalane ke liye jagah daalati he.yah tab string#ko kol karata he, jo kisi bhi capital letters ke baad ek loarkes letters ke baad ek sthaan daalane ke liye phir se badalen.iske baad, yah ek whotspes charitra yaa - charitra ke prayek udhaaharan par utpaadit string ko ek sarani main vibhajit karne ke liye string#split kaa upyog karata he.utpaadit sarani ko map kiya jaataa he, prayek string main sarani main iskaa pehla akshar capital kiya jaataa he or baaki ko loarkes main badal diya jaataa he.yah sarani tab prayek tatv ke bich ek sthaan ke saath ek string main shaamil ho jaati he.
assistant
<|system|>
</s>
<|user|>
is fnction main prayek vidhi kya kol kar rahi he?
export cast capitalise = (string: string): string =>
dori
.replace (/([a-z]+)/g, "$ 1")
.replace (/([a-z] [a-z])/g, "$ 1")
.split (/([[\ s-])/g)
.map ((str) => (str.: [0].
.jodna(" ");</s>
<|assistant|>
is fnction main pehali vidhi kol string#kaa upyog karti he, jo bade aksharon ke kisi bhi anukram se pehle ek sthaan daalane ke liye jagah daalati he.yah tab string#ko kol karata he, jo kisi bhi capital letters ke baad ek loarkes letters ke baad ek sthaan daalane ke liye phir se badalen.iske baad, yah ek whotspes charitra yaa - charitra ke prayek udhaaharan par utpaadit string ko ek sarani main vibhajit karne ke liye string#split kaa upyog karata he.utpaadit sarani ko map kiya jaataa he, prayek string main sarani main iskaa pehla akshar capital kiya jaataa he or baaki ko loarkes main badal diya jaataa he.yah sarani tab prayek tatv ke bich ek sthaan ke saath ek string main shaamil ho jaati he.</s>
