MCPcopy Index your code
hub / github.com/RandomAPI/Randomuser.me-Node / checkSIN

Function checkSIN

api/1.4/data/CA/inject.js:10–24  ·  view source on GitHub ↗
(sin)

Source from the content-addressed store, hash-verified

8 include(inc, contents, 'cell', random(4, 1) + random(3, 2) + ' ' + random(4, 1) + random(3, 2) + '-' + random(3, 4));
9 include(inc, contents, 'id', () => {
10 const checkSIN = (sin) => {
11 const check = '121212121';
12 const result = sin
13 .split('')
14 .map((num, index) => {
15 let res = num * check[index];
16 if (res >= 10) {
17 res = String(res).split('').reduce((a,b) => +a + +b);
18 }
19 return res
20 })
21 .reduce((a, b) => a + b);
22
23 return result % 10 === 0;
24 };
25 const genSIN = () => {
26 let sin = random(3, 9);
27 while(!checkSIN(sin)){

Callers 1

genSINFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected