MCPcopy Create free account
hub / github.com/breck7/scroll / _normalize

Function _normalize

external/.datatables.js:1238–1250  ·  view source on GitHub ↗
(str, both)

Source from the content-addressed store, hash-verified

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

Callers 3

.datatables.jsFile · 0.85
_fnFilterCreateSearchFunction · 0.85
_filterStringFunction · 0.85

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected