Skip to content

Instantly share code, notes, and snippets.

@dungsaga
Last active January 16, 2020 04:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dungsaga/7828bb041e10e671ebea879ed80a7e14 to your computer and use it in GitHub Desktop.
Save dungsaga/7828bb041e10e671ebea879ed80a7e14 to your computer and use it in GitHub Desktop.
Calculate NIR for French user at http://marlot.org/util/calcul-de-la-cle-nir.php
// use the web page at http://marlot.org/util/calcul-de-la-cle-nir.php
// when you input the data, it will calculate the check digits (Clé de contrôle)
// ref: https://en.wikipedia.org/wiki/INSEE_code
// run this in console to get the NIR string:
v=ids=>ids.split(',').map(id=>(e=document.getElementById(id),e.value||e.textContent)).join(' ');
v('sexe,annee,mois,dept,commune,ordre,cle');
// or, patch function CalculerCleNir in http://marlot.org/util/js/global.js
// line 149: cle.innerHTML=calculCle;
cle.innerHTML=numero+calculCle;
// we will see the NIR string in the web page everytime the input was changed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment