@hipay/hipay-material-ui 2.0.0-beta.42 → 2.0.0-beta.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/utils/helpers.js CHANGED
@@ -17,6 +17,7 @@ exports.formatNumber = formatNumber;
17
17
  exports.formatCurrencyAmount = formatCurrencyAmount;
18
18
  exports.formatRate = formatRate;
19
19
  exports.getNextItemSelectable = getNextItemSelectable;
20
+ exports.foldAccents = foldAccents;
20
21
 
21
22
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
22
23
 
@@ -298,4 +299,27 @@ function getNextItemSelectable(node, direction) {
298
299
  }
299
300
 
300
301
  return node.previousSibling;
302
+ }
303
+ /**
304
+ * Retourne la chaîne de caractères passée en entrée sans les accents
305
+ * @param toFold
306
+ * @returns {*}
307
+ */
308
+
309
+
310
+ function foldAccents(toFold) {
311
+ return toFold.replace(/([àáâãäå])|([ç])|([èéêë])|([ìíîï])|([ñ])|([òóôõöø])|([ß])|([ùúûü])|([ÿ])|([æ])|([œ])/g, function (str, a, c, e, i, n, o, s, u, y, ae, oe) {
312
+ if (a) return 'a';
313
+ if (c) return 'c';
314
+ if (e) return 'e';
315
+ if (i) return 'i';
316
+ if (n) return 'n';
317
+ if (o) return 'o';
318
+ if (s) return 's';
319
+ if (u) return 'u';
320
+ if (y) return 'y';
321
+ if (ae) return 'ae';
322
+ if (oe) return 'oe';
323
+ return str;
324
+ });
301
325
  }