Jump to content

Talk:Z17639

From Wikifunctions

I made a js implementation that cover all exceptions, but there's an error when uploading.

The error says "invalid json".

here's the code:

function Z17639 (Z17639K1) {
    const removeDiacritic = (p) => {
        p = p.replace("á", "a");
        p = p.replace("é", "e");
        p = p.replace("í", "i");
        p = p.replace("ó", "o");
        p = p.replace("ú", "u");
        p = p.replace("ǘ", "u");
        p = p.replace("ý", "y");
        return p;
    }
    if(/[áéíóúǘý](?=$|\w$)/i.test(Z17639K1)) {
        if(/[l|r|n|d|j|s|x|ch]$/i.test(Z17639K1)) {
            return  removeDiacritic(Z17639K1) + "es";
        }
        if(/[í|ú]$/i.test(Z17639K1)) {
            return Z17639K1 + "es";
        }
        else {
            return Z17639K1 + "s";
        }
    }
    else {
        if(/[í|ú|l|r|n|d|j|ch]$/i.test(Z17639K1)) {
            return Z17639K1 + "es";
        }
        else if(/z$/i.test(Z17639K1)) {
            return Z17639K1.replace(/z$/i, "") + "ces";
        }
        else if(/s$/i.test(Z17639K1)) {
            if(Z17639K1.length >= 4) {
                return Z17639K1;
            }
            else {
                return Z17639K1 + "es";
            }
        }
        else if (/x$/i.test(Z17639K1)) {
            if(/[aeiouüy]x$/i.test(Z17639K1)) {
                return Z17639K1;
            }
            else {
                return Z17639K1 + "es";
            }
        }
        else {
            return Z17639K1 + "s";
        }
    }
}

Rai282 (talk) 17:58, 26 July 2025 (UTC)Reply

@Rai282 It's just a bug when creating a new implementation. In these situations, you just have to create a new implementation with empty code. Then modify it inserting the right code.
I've already done it for you. Dv103 (talk) 18:17, 26 July 2025 (UTC)Reply