Commit 3107b1c4c329b12043bdf929a2f32df453d149ac
1 parent
322b0c9d11
Exists in
master
ok uglify
Showing
1 changed file
with
6 additions
and
2 deletions
Show diff stats
src/js/app.js
| 1 | angular.module('focaFiltros', []) | 1 | angular.module('focaFiltros', []) |
| 2 | .filter('comprobante', function() { | 2 | .filter('comprobante', function() { |
| 3 | return function(valores) { | 3 | return function(valores) { |
| 4 | return (Array(4).join('0') + valores[0]).slice(-4) + '-' + | 4 | return (Array(4).join('0') + valores[0]).slice(-4) + '-' + |
| 5 | (Array(8).join('0') + valores[1]).slice(-8); | 5 | (Array(8).join('0') + valores[1]).slice(-8); |
| 6 | }; | 6 | }; |
| 7 | }) | 7 | }) |
| 8 | .filter('rellenarDigitos', function() { | 8 | .filter('rellenarDigitos', function() { |
| 9 | return function(valor, cantidad, caracter = 0) { | 9 | return function(valor, cantidad, caracter) { |
| 10 | var ceros = ''; | 10 | var ceros = ''; |
| 11 | for (var i = 0; i < cantidad; i++) { | 11 | |
| 12 | if(!caracter) { | ||
| 13 | caracter = 0; | ||
| 14 | } | ||
| 15 | for(var i = 0; i < cantidad; i++) { | ||
| 12 | ceros += caracter; | 16 | ceros += caracter; |
| 13 | } | 17 | } |
| 14 | return (ceros + valor).slice(cantidad * -1); | 18 | return (ceros + valor).slice(cantidad * -1); |
| 15 | }; | 19 | }; |
| 16 | }); | 20 | }); |
| 17 | 21 |