PageSourceSearch

https://www.sarii-app.toyota/js/checkdigit.js

js sarii-app.toyota collected 2026-10-08 02:50:45 UTC 1,028 bytes, 34 lines download raw bytes

1function checkDigit(vin){
2    if(typeof vin !== 'string'){
3        return false
4    }
5    if(vin.length != 17){
6        return false
7    }
8    const regex = /^[0-9A-HJ-NPR-Z]*$/;
9    if(!regex.test(vin)){
10        return false
11    }
12    const vinArr = [...vin]
13    const codeMapping = {"A":1,"B":2,"C":3,"D":4,"E":5,"F":6,"G":7,"H":8,"J":1,"K":2,"L":3,"M":4,"N":5,"P":7,"R":9,"S":2,"T":3,"U":4,"V":5,"W":6,"X":7,"Y":8,"Z":9}
14    const weightValue = [8,7,6,5,4,3,2,10,0,9,8,7,6,5,4,3,2]
15    const replaceVinArr = vinArr.map((v)=>{
16        if(isNaN(v)){
17            return codeMapping[v]
18        } else {
19            return Number(v)
20        }
21    })
22    const productValue = replaceVinArr.map((v,index)=>{
23        return v*weightValue[index]
24    })
25    const reduceValue = productValue.reduce(function(sum, v){
26        return sum + v;
27      }, 0)
28      if ((reduceValue % 11) == 10){
29        if(vinArr[8]='X'){
30            return true
31        }
32      }
33    return (reduceValue % 11) == vinArr[8]
34}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.