Last active
January 21, 2016 04:26
-
-
Save NekoTashi/fd5f362d8755712e4a81 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| results = [{ | |
| "pk": 10, | |
| "cliente": 437, | |
| "factura": 13592, | |
| "monto_pagado": 1000, | |
| "tipo_pago": "1", | |
| "comentario": "wea", | |
| "create_date": "2016-01-20T21:36:03.743930Z", | |
| "fecha_pago": null, | |
| "patente": "abcd14" | |
| }, { | |
| "pk": 11, | |
| "cliente": 669, | |
| "factura": 13599, | |
| "monto_pagado": 12000, | |
| "tipo_pago": "Depana", | |
| "comentario": "dasfa", | |
| "create_date": "2016-01-20T21:39:49.183992Z", | |
| "fecha_pago": null, | |
| "patente": "1234ab" | |
| }, { | |
| "pk": 12, | |
| "cliente": null, | |
| "factura": null, | |
| "monto_pagado": 0, | |
| "tipo_pago": "", | |
| "comentario": "", | |
| "create_date": "2016-01-20T21:46:08.690859Z", | |
| "fecha_pago": null, | |
| "patente": null | |
| }, { | |
| "pk": 13, | |
| "cliente": null, | |
| "factura": null, | |
| "monto_pagado": 0, | |
| "tipo_pago": "", | |
| "comentario": "", | |
| "create_date": "2016-01-20T21:46:18.906972Z", | |
| "fecha_pago": null, | |
| "patente": null | |
| }, { | |
| "pk": 14, | |
| "cliente": 437, | |
| "factura": 13599, | |
| "monto_pagado": 1000, | |
| "tipo_pago": "1", | |
| "comentario": "sdf", | |
| "create_date": "2016-01-20T22:04:31.634131Z", | |
| "fecha_pago": "2016-01-21", | |
| "patente": "hcdd26" | |
| }, { | |
| "pk": 15, | |
| "cliente": 553, | |
| "factura": 13585, | |
| "monto_pagado": 122333, | |
| "tipo_pago": "2", | |
| "comentario": "total pagado", | |
| "create_date": "2016-01-21T03:57:49.799527Z", | |
| "fecha_pago": "2016-01-21", | |
| "patente": "hcdd26" | |
| }, { | |
| "pk": 16, | |
| "cliente": 574, | |
| "factura": 13588, | |
| "monto_pagado": 1777, | |
| "tipo_pago": "3", | |
| "comentario": "vale vista", | |
| "create_date": "2016-01-21T04:00:22.146736Z", | |
| "fecha_pago": "2016-01-21", | |
| "patente": "1234ab" | |
| }]; | |
| var patentes = results.map(function(item) { | |
| return item.patente; | |
| }); | |
| patentes = patentes.filter(function(item, index, array) { | |
| return array.indexOf(item) === index && item !== null; | |
| }); | |
| patentes = patentes.map(function(item) { | |
| return {'patente': item}; | |
| }); | |
| console.log(patentes); | |
| // [ { patente: 'abcd14' }, | |
| // { patente: '1234ab' }, | |
| // { patente: 'hcdd26' } ] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment