isbn3 2.0.5 → 2.0.7
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.
- package/CHANGELOG.md +31 -0
- package/bin/isbn +18 -9
- package/lib/groups.js +115 -33
- package/package.json +3 -2
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# CHANGELOG
|
|
2
|
+
*versions follow [SemVer](http://semver.org)*
|
|
3
|
+
|
|
4
|
+
## 2.0.0- 2025-11-04
|
|
5
|
+
**BREAKING CHANGES**:
|
|
6
|
+
* The [`audit`](https://github.com/inventaire/isbn3#audit) function output was changed to provide more details on the fixed ISBN candidate
|
|
7
|
+
|
|
8
|
+
## 1.2.0- 2024-09-16
|
|
9
|
+
* [`audit`](https://github.com/inventaire/isbn3#audit): more possibly recoverable cases added
|
|
10
|
+
|
|
11
|
+
## 1.1.0- 2020-04-24
|
|
12
|
+
* Add [`audit`](https://github.com/inventaire/isbn3#audit) function and corresponding [`isbn-audit`](https://github.com/inventaire/isbn3#isbn-audit) CLI command
|
|
13
|
+
* Add [`isbn-checksum`](https://github.com/inventaire/isbn3#isbn-checksum) CLI command
|
|
14
|
+
* Add dist files `./dist/isbn.js` and `./dist/isbn.min.js`, both being browserified ES5 versions of the module
|
|
15
|
+
|
|
16
|
+
## 1.0.0 - 2019-10-07
|
|
17
|
+
Fork from [isbn2](https://www.npmjs.com/package/isbn2)
|
|
18
|
+
|
|
19
|
+
**BREAKING CHANGES**
|
|
20
|
+
* accept approximately formatted ISBNs such as '978-4873113364' that would previously have return a `null` result
|
|
21
|
+
* functions are now directly exposed on the module object:
|
|
22
|
+
```js
|
|
23
|
+
require('isbn2').ISBN.parse('1933988037').codes.isbn13h // => '978-1-933988-03-0'
|
|
24
|
+
// becomes
|
|
25
|
+
require('isbn3').parse('1933988037').isbn13h // => '978-1-933988-03-0'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
** Added features**
|
|
29
|
+
* added a [command-line interface](https://github.com/inventaire/isbn3#CLI)
|
|
30
|
+
* [expose groups data on the module object](https://github.com/inventaire/isbn3#groups)
|
|
31
|
+
* recover common hyphenization mistake `979-1091146135`
|
package/bin/isbn
CHANGED
|
@@ -1,12 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
let [ isbn, format ] = process.argv.slice(2)
|
|
3
3
|
|
|
4
|
-
const output = (message, code = 0) => {
|
|
4
|
+
const output = (message = '', code = 0) => {
|
|
5
5
|
if (code === 0) process.stdout.write(message)
|
|
6
6
|
else process.stderr.write(message)
|
|
7
7
|
process.exit(code)
|
|
8
8
|
}
|
|
9
9
|
|
|
10
|
+
function outputFormatIfExisting (data, format) {
|
|
11
|
+
if (data[format] != null) {
|
|
12
|
+
output(data[format])
|
|
13
|
+
} else {
|
|
14
|
+
console.error(`${format} not found`, data)
|
|
15
|
+
process.exit(1)
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
10
19
|
if (!isbn || isbn.length === 0) {
|
|
11
20
|
output(`isbn <isbn> <format>
|
|
12
21
|
|
|
@@ -36,17 +45,17 @@ const parse = require('../lib/parse')
|
|
|
36
45
|
const audit = require('../lib/audit')
|
|
37
46
|
const data = parse(isbn)
|
|
38
47
|
if (data) {
|
|
39
|
-
if (format === '13')
|
|
40
|
-
else if (format === '10')
|
|
41
|
-
else if (format === '13h')
|
|
42
|
-
else if (format === '10h')
|
|
48
|
+
if (format === '13') outputFormatIfExisting(data, 'isbn13')
|
|
49
|
+
else if (format === '10') outputFormatIfExisting(data, 'isbn10')
|
|
50
|
+
else if (format === '13h') outputFormatIfExisting(data, 'isbn13h')
|
|
51
|
+
else if (format === '10h') outputFormatIfExisting(data, 'isbn10h')
|
|
43
52
|
else if (data[format]) output(data[format])
|
|
44
53
|
else if (format === 'h') {
|
|
45
|
-
if (data.isIsbn13)
|
|
46
|
-
else
|
|
54
|
+
if (data.isIsbn13) outputFormatIfExisting(data, 'isbn13h')
|
|
55
|
+
else outputFormatIfExisting(data, 'isbn10h')
|
|
47
56
|
} else if (format === 'n') {
|
|
48
|
-
if (data.isIsbn13)
|
|
49
|
-
else
|
|
57
|
+
if (data.isIsbn13) outputFormatIfExisting(data, 'isbn13')
|
|
58
|
+
else outputFormatIfExisting(data, 'isbn10')
|
|
50
59
|
} else if (format === 'data' || format === 'd') {
|
|
51
60
|
data.source = source
|
|
52
61
|
output(JSON.stringify(data, null, 2) + '\n')
|
package/lib/groups.js
CHANGED
|
@@ -120,6 +120,10 @@ module.exports = {
|
|
|
120
120
|
'05',
|
|
121
121
|
'05'
|
|
122
122
|
],
|
|
123
|
+
[
|
|
124
|
+
'0666000',
|
|
125
|
+
'0669999'
|
|
126
|
+
],
|
|
123
127
|
[
|
|
124
128
|
'0670000',
|
|
125
129
|
'0699999'
|
|
@@ -400,6 +404,14 @@ module.exports = {
|
|
|
400
404
|
],
|
|
401
405
|
[
|
|
402
406
|
'200',
|
|
407
|
+
'312'
|
|
408
|
+
],
|
|
409
|
+
[
|
|
410
|
+
'3130',
|
|
411
|
+
'3139'
|
|
412
|
+
],
|
|
413
|
+
[
|
|
414
|
+
'314',
|
|
403
415
|
'389'
|
|
404
416
|
],
|
|
405
417
|
[
|
|
@@ -1173,6 +1185,18 @@ module.exports = {
|
|
|
1173
1185
|
'1300',
|
|
1174
1186
|
'1799'
|
|
1175
1187
|
],
|
|
1188
|
+
[
|
|
1189
|
+
'180',
|
|
1190
|
+
'181'
|
|
1191
|
+
],
|
|
1192
|
+
[
|
|
1193
|
+
'1830',
|
|
1194
|
+
'1899'
|
|
1195
|
+
],
|
|
1196
|
+
[
|
|
1197
|
+
'19500',
|
|
1198
|
+
'19999'
|
|
1199
|
+
],
|
|
1176
1200
|
[
|
|
1177
1201
|
'200',
|
|
1178
1202
|
'459'
|
|
@@ -1345,7 +1369,7 @@ module.exports = {
|
|
|
1345
1369
|
'7999'
|
|
1346
1370
|
],
|
|
1347
1371
|
[
|
|
1348
|
-
'
|
|
1372
|
+
'92000',
|
|
1349
1373
|
'99999'
|
|
1350
1374
|
]
|
|
1351
1375
|
]
|
|
@@ -1427,7 +1451,7 @@ module.exports = {
|
|
|
1427
1451
|
ranges: [
|
|
1428
1452
|
[
|
|
1429
1453
|
'00',
|
|
1430
|
-
'
|
|
1454
|
+
'05'
|
|
1431
1455
|
],
|
|
1432
1456
|
[
|
|
1433
1457
|
'200',
|
|
@@ -1448,7 +1472,7 @@ module.exports = {
|
|
|
1448
1472
|
ranges: [
|
|
1449
1473
|
[
|
|
1450
1474
|
'00',
|
|
1451
|
-
'
|
|
1475
|
+
'02'
|
|
1452
1476
|
],
|
|
1453
1477
|
[
|
|
1454
1478
|
'250',
|
|
@@ -1460,14 +1484,14 @@ module.exports = {
|
|
|
1460
1484
|
],
|
|
1461
1485
|
[
|
|
1462
1486
|
'5000',
|
|
1463
|
-
'
|
|
1487
|
+
'6349'
|
|
1464
1488
|
],
|
|
1465
1489
|
[
|
|
1466
1490
|
'80000',
|
|
1467
1491
|
'81824'
|
|
1468
1492
|
],
|
|
1469
1493
|
[
|
|
1470
|
-
'
|
|
1494
|
+
'82000',
|
|
1471
1495
|
'89999'
|
|
1472
1496
|
],
|
|
1473
1497
|
[
|
|
@@ -1475,11 +1499,24 @@ module.exports = {
|
|
|
1475
1499
|
'902449'
|
|
1476
1500
|
],
|
|
1477
1501
|
[
|
|
1478
|
-
'
|
|
1502
|
+
'975500',
|
|
1479
1503
|
'999999'
|
|
1480
1504
|
]
|
|
1481
1505
|
]
|
|
1482
1506
|
},
|
|
1507
|
+
'978-69990': {
|
|
1508
|
+
name: 'Zambia registration group',
|
|
1509
|
+
ranges: [
|
|
1510
|
+
[
|
|
1511
|
+
'50',
|
|
1512
|
+
'50'
|
|
1513
|
+
],
|
|
1514
|
+
[
|
|
1515
|
+
'997',
|
|
1516
|
+
'999'
|
|
1517
|
+
]
|
|
1518
|
+
]
|
|
1519
|
+
},
|
|
1483
1520
|
'978-7': {
|
|
1484
1521
|
name: 'China, People\'s Republic',
|
|
1485
1522
|
ranges: [
|
|
@@ -1559,7 +1596,11 @@ module.exports = {
|
|
|
1559
1596
|
],
|
|
1560
1597
|
[
|
|
1561
1598
|
'200',
|
|
1562
|
-
'
|
|
1599
|
+
'684'
|
|
1600
|
+
],
|
|
1601
|
+
[
|
|
1602
|
+
'685000',
|
|
1603
|
+
'689999'
|
|
1563
1604
|
],
|
|
1564
1605
|
[
|
|
1565
1606
|
'69000',
|
|
@@ -2028,7 +2069,7 @@ module.exports = {
|
|
|
2028
2069
|
'649'
|
|
2029
2070
|
],
|
|
2030
2071
|
[
|
|
2031
|
-
'
|
|
2072
|
+
'6850',
|
|
2032
2073
|
'8199'
|
|
2033
2074
|
],
|
|
2034
2075
|
[
|
|
@@ -2075,7 +2116,11 @@ module.exports = {
|
|
|
2075
2116
|
ranges: [
|
|
2076
2117
|
[
|
|
2077
2118
|
'00',
|
|
2078
|
-
'
|
|
2119
|
+
'08'
|
|
2120
|
+
],
|
|
2121
|
+
[
|
|
2122
|
+
'0900',
|
|
2123
|
+
'0999'
|
|
2079
2124
|
],
|
|
2080
2125
|
[
|
|
2081
2126
|
'100',
|
|
@@ -4024,6 +4069,27 @@ module.exports = {
|
|
|
4024
4069
|
]
|
|
4025
4070
|
]
|
|
4026
4071
|
},
|
|
4072
|
+
'978-9905': {
|
|
4073
|
+
name: 'Nepal',
|
|
4074
|
+
ranges: [
|
|
4075
|
+
[
|
|
4076
|
+
'0',
|
|
4077
|
+
'0'
|
|
4078
|
+
],
|
|
4079
|
+
[
|
|
4080
|
+
'20',
|
|
4081
|
+
'23'
|
|
4082
|
+
],
|
|
4083
|
+
[
|
|
4084
|
+
'600',
|
|
4085
|
+
'624'
|
|
4086
|
+
],
|
|
4087
|
+
[
|
|
4088
|
+
'9900',
|
|
4089
|
+
'9999'
|
|
4090
|
+
]
|
|
4091
|
+
]
|
|
4092
|
+
},
|
|
4027
4093
|
'978-9906': {
|
|
4028
4094
|
name: 'Tajikistan',
|
|
4029
4095
|
ranges: [
|
|
@@ -4188,7 +4254,7 @@ module.exports = {
|
|
|
4188
4254
|
'799'
|
|
4189
4255
|
],
|
|
4190
4256
|
[
|
|
4191
|
-
'
|
|
4257
|
+
'9300',
|
|
4192
4258
|
'9999'
|
|
4193
4259
|
]
|
|
4194
4260
|
]
|
|
@@ -4313,6 +4379,14 @@ module.exports = {
|
|
|
4313
4379
|
'978-9920': {
|
|
4314
4380
|
name: 'Morocco',
|
|
4315
4381
|
ranges: [
|
|
4382
|
+
[
|
|
4383
|
+
'00',
|
|
4384
|
+
'02'
|
|
4385
|
+
],
|
|
4386
|
+
[
|
|
4387
|
+
'130',
|
|
4388
|
+
'199'
|
|
4389
|
+
],
|
|
4316
4390
|
[
|
|
4317
4391
|
'200',
|
|
4318
4392
|
'229'
|
|
@@ -4325,6 +4399,10 @@ module.exports = {
|
|
|
4325
4399
|
'430',
|
|
4326
4400
|
'799'
|
|
4327
4401
|
],
|
|
4402
|
+
[
|
|
4403
|
+
'8300',
|
|
4404
|
+
'8549'
|
|
4405
|
+
],
|
|
4328
4406
|
[
|
|
4329
4407
|
'8550',
|
|
4330
4408
|
'9999'
|
|
@@ -4359,12 +4437,16 @@ module.exports = {
|
|
|
4359
4437
|
'20',
|
|
4360
4438
|
'29'
|
|
4361
4439
|
],
|
|
4440
|
+
[
|
|
4441
|
+
'5500',
|
|
4442
|
+
'5999'
|
|
4443
|
+
],
|
|
4362
4444
|
[
|
|
4363
4445
|
'600',
|
|
4364
4446
|
'799'
|
|
4365
4447
|
],
|
|
4366
4448
|
[
|
|
4367
|
-
'
|
|
4449
|
+
'8000',
|
|
4368
4450
|
'9999'
|
|
4369
4451
|
]
|
|
4370
4452
|
]
|
|
@@ -4508,7 +4590,11 @@ module.exports = {
|
|
|
4508
4590
|
],
|
|
4509
4591
|
[
|
|
4510
4592
|
'8000',
|
|
4511
|
-
'
|
|
4593
|
+
'9799'
|
|
4594
|
+
],
|
|
4595
|
+
[
|
|
4596
|
+
'980',
|
|
4597
|
+
'999'
|
|
4512
4598
|
]
|
|
4513
4599
|
]
|
|
4514
4600
|
},
|
|
@@ -5492,14 +5578,14 @@ module.exports = {
|
|
|
5492
5578
|
ranges: [
|
|
5493
5579
|
[
|
|
5494
5580
|
'00',
|
|
5495
|
-
'
|
|
5581
|
+
'19'
|
|
5496
5582
|
],
|
|
5497
5583
|
[
|
|
5498
5584
|
'500',
|
|
5499
|
-
'
|
|
5585
|
+
'749'
|
|
5500
5586
|
],
|
|
5501
5587
|
[
|
|
5502
|
-
'
|
|
5588
|
+
'9300',
|
|
5503
5589
|
'9999'
|
|
5504
5590
|
]
|
|
5505
5591
|
]
|
|
@@ -7551,7 +7637,7 @@ module.exports = {
|
|
|
7551
7637
|
'69'
|
|
7552
7638
|
],
|
|
7553
7639
|
[
|
|
7554
|
-
'
|
|
7640
|
+
'850',
|
|
7555
7641
|
'999'
|
|
7556
7642
|
]
|
|
7557
7643
|
]
|
|
@@ -7714,7 +7800,7 @@ module.exports = {
|
|
|
7714
7800
|
ranges: [
|
|
7715
7801
|
[
|
|
7716
7802
|
'0',
|
|
7717
|
-
'
|
|
7803
|
+
'4'
|
|
7718
7804
|
],
|
|
7719
7805
|
[
|
|
7720
7806
|
'50',
|
|
@@ -7782,10 +7868,10 @@ module.exports = {
|
|
|
7782
7868
|
],
|
|
7783
7869
|
[
|
|
7784
7870
|
'40',
|
|
7785
|
-
'
|
|
7871
|
+
'61'
|
|
7786
7872
|
],
|
|
7787
7873
|
[
|
|
7788
|
-
'
|
|
7874
|
+
'920',
|
|
7789
7875
|
'999'
|
|
7790
7876
|
]
|
|
7791
7877
|
]
|
|
@@ -7903,11 +7989,11 @@ module.exports = {
|
|
|
7903
7989
|
name: 'United States',
|
|
7904
7990
|
ranges: [
|
|
7905
7991
|
[
|
|
7906
|
-
'
|
|
7907
|
-
'
|
|
7992
|
+
'1950',
|
|
7993
|
+
'1999'
|
|
7908
7994
|
],
|
|
7909
7995
|
[
|
|
7910
|
-
'
|
|
7996
|
+
'200',
|
|
7911
7997
|
'239'
|
|
7912
7998
|
],
|
|
7913
7999
|
[
|
|
@@ -7924,14 +8010,6 @@ module.exports = {
|
|
|
7924
8010
|
],
|
|
7925
8011
|
[
|
|
7926
8012
|
'3000',
|
|
7927
|
-
'3199'
|
|
7928
|
-
],
|
|
7929
|
-
[
|
|
7930
|
-
'3200',
|
|
7931
|
-
'3499'
|
|
7932
|
-
],
|
|
7933
|
-
[
|
|
7934
|
-
'3500',
|
|
7935
8013
|
'8849'
|
|
7936
8014
|
],
|
|
7937
8015
|
[
|
|
@@ -7943,17 +8021,21 @@ module.exports = {
|
|
|
7943
8021
|
'90999'
|
|
7944
8022
|
],
|
|
7945
8023
|
[
|
|
7946
|
-
'
|
|
7947
|
-
'
|
|
8024
|
+
'950000',
|
|
8025
|
+
'969999'
|
|
7948
8026
|
],
|
|
7949
8027
|
[
|
|
7950
|
-
'
|
|
8028
|
+
'9850000',
|
|
7951
8029
|
'9929999'
|
|
7952
8030
|
],
|
|
7953
8031
|
[
|
|
7954
8032
|
'9930000',
|
|
7955
8033
|
'9959999'
|
|
7956
8034
|
],
|
|
8035
|
+
[
|
|
8036
|
+
'9960000',
|
|
8037
|
+
'9984999'
|
|
8038
|
+
],
|
|
7957
8039
|
[
|
|
7958
8040
|
'9985000',
|
|
7959
8041
|
'9999999'
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isbn3",
|
|
3
3
|
"description": "ISBN utils: parse, validate, format, audit",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.7",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Hetappi <hetappi.pm@gmail.com>",
|
|
7
7
|
"Tadas S. <tadas@yoyo.lt>",
|
|
@@ -34,7 +34,8 @@
|
|
|
34
34
|
"isbn.d.ts",
|
|
35
35
|
"lib",
|
|
36
36
|
"bin",
|
|
37
|
-
"scripts"
|
|
37
|
+
"scripts",
|
|
38
|
+
"CHANGELOG.md"
|
|
38
39
|
],
|
|
39
40
|
"types": "isbn.d.ts",
|
|
40
41
|
"engines": {
|