Last active
August 30, 2021 14:01
-
-
Save Giorgiosaud/07bfacf10214145ada0d9b3096062f9e 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
| const validator = { | |
| getMessage(field, args) { | |
| return `The field ${field} is not a valid RUT`; | |
| }, | |
| validate(value, args) { | |
| const toValidate=value.slice(-1).toUpperCase(); | |
| let validador=11-rut.toString().split('').reverse().reduce((sum,el,i)=>sum+=el*(i%6+2),0)%11; | |
| validador==10?'K':validador; | |
| return validador===toValidate; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment