Sha256: 49021e8e03b2908d9ff672d388f3e9877242338d82d893ecc8f84f068b5809af

Contents?: true

Size: 1.36 KB

Versions: 69

Compression:

Stored size: 1.36 KB

Contents

var toString = require('../lang/toString');
    /**
    * Replaces all accented chars with regular ones
    */
    function replaceAccents(str){
        str = toString(str);

        // verifies if the String has accents and replace them
        if (str.search(/[\xC0-\xFF]/g) > -1) {
            str = str
                    .replace(/[\xC0-\xC5]/g, "A")
                    .replace(/[\xC6]/g, "AE")
                    .replace(/[\xC7]/g, "C")
                    .replace(/[\xC8-\xCB]/g, "E")
                    .replace(/[\xCC-\xCF]/g, "I")
                    .replace(/[\xD0]/g, "D")
                    .replace(/[\xD1]/g, "N")
                    .replace(/[\xD2-\xD6\xD8]/g, "O")
                    .replace(/[\xD9-\xDC]/g, "U")
                    .replace(/[\xDD]/g, "Y")
                    .replace(/[\xDE]/g, "P")
                    .replace(/[\xE0-\xE5]/g, "a")
                    .replace(/[\xE6]/g, "ae")
                    .replace(/[\xE7]/g, "c")
                    .replace(/[\xE8-\xEB]/g, "e")
                    .replace(/[\xEC-\xEF]/g, "i")
                    .replace(/[\xF1]/g, "n")
                    .replace(/[\xF2-\xF6\xF8]/g, "o")
                    .replace(/[\xF9-\xFC]/g, "u")
                    .replace(/[\xFE]/g, "p")
                    .replace(/[\xFD\xFF]/g, "y");
        }
        return str;
    }
    module.exports = replaceAccents;

Version data entries

69 entries across 69 versions & 2 rubygems

Version Path
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.18 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.17 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.16 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.15 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.14 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.13 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.12 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.11 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.10 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.9 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.8 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.7 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.6 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.5 node_modules/bower/node_modules/mout/string/replaceAccents.js
trusty-festivity-extension-2.5.4 node_modules/bower/node_modules/mout/string/replaceAccents.js