Skip to content

Commit c3494e5

Browse files
author
Dmitry Ovsyanko
committed
OKPO10
1 parent 9bccc4e commit c3494e5

File tree

3 files changed

+18
-3
lines changed

3 files changed

+18
-3
lines changed

__tests__/isOKPO10.js

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const {isOKPO10, randomOKPO10} = require ('..')
2+
3+
test ('basic', () => {
4+
5+
expect (() => isOKPO8 ('1194265277')).toThrow ()
6+
expect (() => isOKPO8 ('194265277')).toThrow ()
7+
8+
expect (isOKPO10 ('0194265277')).toBeUndefined ()
9+
10+
expect (isOKPO10 (randomOKPO10 ())).toBeUndefined ()
11+
12+
})

index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const Check = require ('./lib/Check')
22
const {OGRN_13, OGRN_15} = require ('./lib/Horner')
33
const {INN_10, INN_12_2, INN_12_1} = require ('./lib/INN')
44
const SNILS = require ('./lib/SNILS')
5-
const {OKPO_8} = require ('./lib/OKPO')
5+
const {OKPO_8, OKPO_10} = require ('./lib/OKPO')
66
class KPP extends Check {constructor () {super (9)}}
77

88
module.exports = {
@@ -25,6 +25,9 @@ module.exports = {
2525
isOKPO8 : str => new OKPO_8 ().verify (str),
2626
randomOKPO8: () => new OKPO_8 ().random (),
2727

28+
isOKPO10 : str => new OKPO_10 ().verify (str),
29+
randomOKPO10: () => new OKPO_10 ().random (),
30+
2831
isINN12: str => {
2932
new INN_12_1 ().verify (str.slice (0, 11))
3033
new INN_12_2 ().verify (str)

lib/OKPO.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ class OKPO extends ScalarProduct {
2424

2525
}
2626

27-
2827
const okpo = valueLength => class extends OKPO {constructor () {super (valueLength)}}
2928

3029
module.exports = {
3130

32-
OKPO_8 : okpo (7),
31+
OKPO_8 : okpo (7),
32+
OKPO_10 : okpo (9),
3333

3434
}

0 commit comments

Comments
 (0)