Geen omschrijving
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

helpers.js 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. const uid = function(){
  2. return Date.now().toString(36) + Math.random().toString(36).substr(2);
  3. }
  4. function shuffleArray(array) {
  5. for (let i = array.length - 1; i > 0; i--) {
  6. const j = Math.floor(Math.random() * (i + 1));
  7. [array[i], array[j]] = [array[j], array[i]];
  8. }
  9. }
  10. function getCurrencySymbol(value=0) {
  11. let type = 'INR'
  12. if (type) {
  13. const ans = new Intl.NumberFormat('en-IN', { style: 'currency', currency: type }).format(value);;
  14. const res = ans.split(/(\D+)/);
  15. const currencySymbol = res[1];
  16. const amount = res.slice(2,res.length).join('')
  17. return [currencySymbol,amount]
  18. } else {
  19. console.log("errrrrrrrrrrrrrrrrrrrrrrrrr",type);
  20. return ['',0];
  21. }
  22. }
  23. function toasterHelper(type,message){
  24. // toasterOpts()
  25. Command: toastr[type](message);
  26. function toasterOpts(){
  27. toastr.options = {
  28. "closeButton": true,
  29. "debug": false,
  30. "newestOnTop": true,
  31. "progressBar": true,
  32. "positionClass": "toast-top-center",
  33. "preventDuplicates": true,
  34. "onclick": null,
  35. "showDuration": "300",
  36. "hideDuration": "1000",
  37. "timeOut": "5000",
  38. "extendedTimeOut": "1000",
  39. "showEasing": "swing",
  40. "hideEasing": "linear",
  41. "showMethod": "fadeIn",
  42. "hideMethod": "fadeOut"
  43. }
  44. }
  45. }