Skip to content

Instantly share code, notes, and snippets.

@Giorgiosaud
Last active July 15, 2019 10:53
Show Gist options
  • Select an option

  • Save Giorgiosaud/08c33e8d3cc51ae0f62eeff1d69aebf9 to your computer and use it in GitHub Desktop.

Select an option

Save Giorgiosaud/08c33e8d3cc51ae0f62eeff1d69aebf9 to your computer and use it in GitHub Desktop.
Ultra Simple Rut Validator Js
export default function(rut){
const toValidate=rut.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