eljeffeg/SmartCopy

what is #compountlastonoffswitch ?

Closed this issue · 4 comments

Hi,

great library and I would like to use the NameParse function.

But I am unsure how to replace the following for a stand-alone use ?

if ($('#compountlastonoffswitch').prop('checked') && this.is_compound_lastName(nameParts[j])) {
			                        lastName += " " + nameParts[j].toLowerCase();
			                    } else {
			                        lastName += " " + this.fix_case(nameParts[j]);
			                    }

The $('#compountlastonoffswitch').prop('checked') is an option I give the user to force the compound last name to lowercase as some countries do. For example, "van Nostrand" vs "Van Nostrand". You could either just remove it all and leave it as, producing Mixed Case:

lastName += " " + this.fix_case(nameParts[j]);

Set it to always do lowercase:

if (this.is_compound_lastName(nameParts[j])) {
    lastName += " " + nameParts[j].toLowerCase();
}

or give the user the option in the function similar to detectMiddleName.

if (lowercasecompound && this.is_compound_lastName(nameParts[j])) {
    lastName += " " + nameParts[j].toLowerCase();
} else {
    lastName += " " + this.fix_case(nameParts[j]);
}

Thank you for your quick help.
Last question: what is

!$('#adjustnameonoffswitch').prop('checked')

This is another option that auto-adjusts the name for Mixed Case. Defaulted to True

Excellent work ! Thank you !!