(str, both)
| 1236 | // Remove diacritics from a string by decomposing it and then removing |
| 1237 | // non-ascii characters |
| 1238 | var _normalize = function (str, both) { |
| 1239 | if (typeof str !== "string") { |
| 1240 | return str |
| 1241 | } |
| 1242 | |
| 1243 | // It is faster to just run `normalize` than it is to check if |
| 1244 | // we need to with a regex! (Check as it isn't available in old |
| 1245 | // Safari) |
| 1246 | var res = str.normalize ? str.normalize("NFD") : str |
| 1247 | |
| 1248 | // Equally, here we check if a regex is needed or not |
| 1249 | return res.length !== str.length ? (both === true ? str + " " : "") + res.replace(/[\u0300-\u036f]/g, "") : res |
| 1250 | } |
| 1251 | |
| 1252 | /** |
| 1253 | * Determine if all values in the array are unique. This means we can short |
no test coverage detected