isbn3 2.0.7 → 2.0.9
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/bin/isbn-audit +7 -3
- package/lib/groups.js +48 -11
- package/package.json +1 -1
package/bin/isbn-audit
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const [ source ] = process.argv.slice(2)
|
|
3
3
|
const audit = require('../lib/audit')
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function outputIsbnsWithClues (isbns) {
|
|
6
6
|
const isbnsWithClues = isbns
|
|
7
7
|
.map(isbn => audit(isbn))
|
|
8
8
|
.filter(auditData => auditData.clues.length > 0)
|
|
@@ -11,6 +11,10 @@ const outputIsbnsWithClues = isbns => {
|
|
|
11
11
|
if (isbnsWithClues.length > 0) process.stdout.write(isbnsWithClues + '\n')
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
+
function parseIsbn (str) {
|
|
15
|
+
return str.match(/[\dX-]{10,17}/g)
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
// Prevent logging an EPIPE error when piping the output
|
|
15
19
|
// cf https://github.com/maxlath/wikidata-cli/issues/7
|
|
16
20
|
process.stdout.on('error', err => {
|
|
@@ -18,14 +22,14 @@ process.stdout.on('error', err => {
|
|
|
18
22
|
})
|
|
19
23
|
|
|
20
24
|
if (source != null) {
|
|
21
|
-
const data = audit(source)
|
|
25
|
+
const data = audit(parseIsbn(source)?.[0])
|
|
22
26
|
console.log(JSON.stringify(data))
|
|
23
27
|
} else {
|
|
24
28
|
let remaining = ''
|
|
25
29
|
process.stdin
|
|
26
30
|
.on('data', buf => {
|
|
27
31
|
const parts = (remaining + buf.toString()).split('\n')
|
|
28
|
-
const isbns = parts.slice(0, -1)
|
|
32
|
+
const isbns = parseIsbn(parts.slice(0, -1))
|
|
29
33
|
remaining = parts.slice(-1)[0]
|
|
30
34
|
outputIsbnsWithClues(isbns)
|
|
31
35
|
})
|
package/lib/groups.js
CHANGED
|
@@ -110,6 +110,14 @@ module.exports = {
|
|
|
110
110
|
],
|
|
111
111
|
[
|
|
112
112
|
'040',
|
|
113
|
+
'045'
|
|
114
|
+
],
|
|
115
|
+
[
|
|
116
|
+
'0460',
|
|
117
|
+
'0469'
|
|
118
|
+
],
|
|
119
|
+
[
|
|
120
|
+
'047',
|
|
113
121
|
'047'
|
|
114
122
|
],
|
|
115
123
|
[
|
|
@@ -1187,12 +1195,16 @@ module.exports = {
|
|
|
1187
1195
|
],
|
|
1188
1196
|
[
|
|
1189
1197
|
'180',
|
|
1190
|
-
'
|
|
1198
|
+
'182'
|
|
1191
1199
|
],
|
|
1192
1200
|
[
|
|
1193
1201
|
'1830',
|
|
1194
1202
|
'1899'
|
|
1195
1203
|
],
|
|
1204
|
+
[
|
|
1205
|
+
'190',
|
|
1206
|
+
'194'
|
|
1207
|
+
],
|
|
1196
1208
|
[
|
|
1197
1209
|
'19500',
|
|
1198
1210
|
'19999'
|
|
@@ -1302,7 +1314,7 @@ module.exports = {
|
|
|
1302
1314
|
'499'
|
|
1303
1315
|
],
|
|
1304
1316
|
[
|
|
1305
|
-
'
|
|
1317
|
+
'6500',
|
|
1306
1318
|
'7999'
|
|
1307
1319
|
],
|
|
1308
1320
|
[
|
|
@@ -1504,6 +1516,15 @@ module.exports = {
|
|
|
1504
1516
|
]
|
|
1505
1517
|
]
|
|
1506
1518
|
},
|
|
1519
|
+
'978-66': {
|
|
1520
|
+
name: 'Federated Panel',
|
|
1521
|
+
ranges: [
|
|
1522
|
+
[
|
|
1523
|
+
'30',
|
|
1524
|
+
'30'
|
|
1525
|
+
]
|
|
1526
|
+
]
|
|
1527
|
+
},
|
|
1507
1528
|
'978-69990': {
|
|
1508
1529
|
name: 'Zambia registration group',
|
|
1509
1530
|
ranges: [
|
|
@@ -1512,7 +1533,7 @@ module.exports = {
|
|
|
1512
1533
|
'50'
|
|
1513
1534
|
],
|
|
1514
1535
|
[
|
|
1515
|
-
'
|
|
1536
|
+
'994',
|
|
1516
1537
|
'999'
|
|
1517
1538
|
]
|
|
1518
1539
|
]
|
|
@@ -1596,7 +1617,15 @@ module.exports = {
|
|
|
1596
1617
|
],
|
|
1597
1618
|
[
|
|
1598
1619
|
'200',
|
|
1599
|
-
'
|
|
1620
|
+
'669'
|
|
1621
|
+
],
|
|
1622
|
+
[
|
|
1623
|
+
'6700',
|
|
1624
|
+
'6799'
|
|
1625
|
+
],
|
|
1626
|
+
[
|
|
1627
|
+
'68000',
|
|
1628
|
+
'68499'
|
|
1600
1629
|
],
|
|
1601
1630
|
[
|
|
1602
1631
|
'685000',
|
|
@@ -4095,7 +4124,7 @@ module.exports = {
|
|
|
4095
4124
|
ranges: [
|
|
4096
4125
|
[
|
|
4097
4126
|
'20',
|
|
4098
|
-
'
|
|
4127
|
+
'22'
|
|
4099
4128
|
],
|
|
4100
4129
|
[
|
|
4101
4130
|
'700',
|
|
@@ -4136,7 +4165,7 @@ module.exports = {
|
|
|
4136
4165
|
'1'
|
|
4137
4166
|
],
|
|
4138
4167
|
[
|
|
4139
|
-
'
|
|
4168
|
+
'40',
|
|
4140
4169
|
'69'
|
|
4141
4170
|
],
|
|
4142
4171
|
[
|
|
@@ -4254,7 +4283,7 @@ module.exports = {
|
|
|
4254
4283
|
'799'
|
|
4255
4284
|
],
|
|
4256
4285
|
[
|
|
4257
|
-
'
|
|
4286
|
+
'9200',
|
|
4258
4287
|
'9999'
|
|
4259
4288
|
]
|
|
4260
4289
|
]
|
|
@@ -7566,11 +7595,11 @@ module.exports = {
|
|
|
7566
7595
|
'0'
|
|
7567
7596
|
],
|
|
7568
7597
|
[
|
|
7569
|
-
'
|
|
7598
|
+
'25',
|
|
7570
7599
|
'64'
|
|
7571
7600
|
],
|
|
7572
7601
|
[
|
|
7573
|
-
'
|
|
7602
|
+
'670',
|
|
7574
7603
|
'999'
|
|
7575
7604
|
]
|
|
7576
7605
|
]
|
|
@@ -7915,10 +7944,14 @@ module.exports = {
|
|
|
7915
7944
|
ranges: [
|
|
7916
7945
|
[
|
|
7917
7946
|
'00',
|
|
7918
|
-
'
|
|
7947
|
+
'21'
|
|
7948
|
+
],
|
|
7949
|
+
[
|
|
7950
|
+
'220000',
|
|
7951
|
+
'229999'
|
|
7919
7952
|
],
|
|
7920
7953
|
[
|
|
7921
|
-
'
|
|
7954
|
+
'23000',
|
|
7922
7955
|
'24999'
|
|
7923
7956
|
],
|
|
7924
7957
|
[
|
|
@@ -7988,6 +8021,10 @@ module.exports = {
|
|
|
7988
8021
|
'979-8': {
|
|
7989
8022
|
name: 'United States',
|
|
7990
8023
|
ranges: [
|
|
8024
|
+
[
|
|
8025
|
+
'1800',
|
|
8026
|
+
'1949'
|
|
8027
|
+
],
|
|
7991
8028
|
[
|
|
7992
8029
|
'1950',
|
|
7993
8030
|
'1999'
|