@stbmoz-onboarding/core 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -189,15 +189,19 @@ export function isPDF(filedata) {
189
189
  export function isValidNuit(nuit) {
190
190
  try {
191
191
  //Split the inserted nuit
192
- let a = parseInt(nuit.substr(0, 1))
193
- let b = parseInt(nuit.substr(1, 1))
194
- let c = parseInt(nuit.substr(2, 1))
195
- let d = parseInt(nuit.substr(3, 1))
196
- let e = parseInt(nuit.substr(4, 1))
197
- let f = parseInt(nuit.substr(5, 1))
198
- let g = parseInt(nuit.substr(6, 1))
199
- let h = parseInt(nuit.substr(7, 1))
200
- let checkDigit = parseInt(nuit.substr(8, 1))
192
+ const length = nuit.toString().length
193
+ if(length != 9){
194
+ return false
195
+ }
196
+ const a = parseInt(nuit.substr(0, 1))
197
+ const b = parseInt(nuit.substr(1, 1))
198
+ const c = parseInt(nuit.substr(2, 1))
199
+ const d = parseInt(nuit.substr(3, 1))
200
+ const e = parseInt(nuit.substr(4, 1))
201
+ const f = parseInt(nuit.substr(5, 1))
202
+ const g = parseInt(nuit.substr(6, 1))
203
+ const h = parseInt(nuit.substr(7, 1))
204
+ const checkDigit = parseInt(nuit.substr(8, 1))
201
205
 
202
206
  a = a * 3
203
207
  b = b * 2
@@ -208,8 +212,8 @@ export function isValidNuit(nuit) {
208
212
  g = g * 3
209
213
  h = h * 2
210
214
 
211
- let digitsSum = a + b + c + d + e + f + g + h
212
- let digitsMOD = digitsSum % 11
215
+ const digitsSum = a + b + c + d + e + f + g + h
216
+ const digitsMOD = digitsSum % 11
213
217
 
214
218
  if (digitsMOD == 0 || digitsMOD == 1) {
215
219
 
@@ -217,7 +221,7 @@ export function isValidNuit(nuit) {
217
221
  return true
218
222
  }
219
223
  } else {
220
- let result = 11 - digitsMOD
224
+ const result = 11 - digitsMOD
221
225
  if (result == checkDigit) {
222
226
  return true
223
227
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stbmoz-onboarding/core",
3
3
  "type": "module",
4
- "version": "1.0.12",
4
+ "version": "1.0.13",
5
5
  "description": "\"core module\"",
6
6
  "main": "index.js",
7
7
  "scripts": {