Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom phone types #2

Open
ethan1701 opened this issue Oct 2, 2018 · 1 comment
Open

Custom phone types #2

ethan1701 opened this issue Oct 2, 2018 · 1 comment

Comments

@ethan1701
Copy link

The vCard specification allows for custom phone and email types, prefaced with an X-

I built on your code, and added the following:


 * @param vCard.customPhone {array|object} - custom phone
 * @param vCard.customPhone.type {string} - custom phone type
 * @param vCard.customPhone.number {string} - custom phone number

    if (vCard.customPhone) {
        if (!Array.isArray(vCard.customPhone)) {
            vCard.customPhone = new Array(vCard.customPhone);
        }
        vCard.customPhone.forEach(
            function (customPhone) {
                if (majorVersion >= 4) {
                    formattedVCardString += 'TEL;VALUE=uri;TYPE="voice,X-' + e(customPhone.type) + ':tel:' + e(customPhone.number) + nl();

                } else {
                    formattedVCardString += 'TEL;TYPE=X-' + e(customPhone.type) + ':' + e(customPhone.number) + nl();
                }
            }
        );
    }

Would you want to merge this into your truly helpful code?

-Ethan

@konstantin-nizhinskiy
Copy link
Owner

Yes, add your change, I will test and make pull request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants