isbn3 2.0.7 → 2.0.8
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 +27 -6
- 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
|
@@ -1187,7 +1187,7 @@ module.exports = {
|
|
|
1187
1187
|
],
|
|
1188
1188
|
[
|
|
1189
1189
|
'180',
|
|
1190
|
-
'
|
|
1190
|
+
'182'
|
|
1191
1191
|
],
|
|
1192
1192
|
[
|
|
1193
1193
|
'1830',
|
|
@@ -1302,7 +1302,7 @@ module.exports = {
|
|
|
1302
1302
|
'499'
|
|
1303
1303
|
],
|
|
1304
1304
|
[
|
|
1305
|
-
'
|
|
1305
|
+
'6500',
|
|
1306
1306
|
'7999'
|
|
1307
1307
|
],
|
|
1308
1308
|
[
|
|
@@ -1504,6 +1504,15 @@ module.exports = {
|
|
|
1504
1504
|
]
|
|
1505
1505
|
]
|
|
1506
1506
|
},
|
|
1507
|
+
'978-66': {
|
|
1508
|
+
name: 'Federated Panel',
|
|
1509
|
+
ranges: [
|
|
1510
|
+
[
|
|
1511
|
+
'30',
|
|
1512
|
+
'30'
|
|
1513
|
+
]
|
|
1514
|
+
]
|
|
1515
|
+
},
|
|
1507
1516
|
'978-69990': {
|
|
1508
1517
|
name: 'Zambia registration group',
|
|
1509
1518
|
ranges: [
|
|
@@ -1596,7 +1605,15 @@ module.exports = {
|
|
|
1596
1605
|
],
|
|
1597
1606
|
[
|
|
1598
1607
|
'200',
|
|
1599
|
-
'
|
|
1608
|
+
'669'
|
|
1609
|
+
],
|
|
1610
|
+
[
|
|
1611
|
+
'6700',
|
|
1612
|
+
'6799'
|
|
1613
|
+
],
|
|
1614
|
+
[
|
|
1615
|
+
'68000',
|
|
1616
|
+
'68499'
|
|
1600
1617
|
],
|
|
1601
1618
|
[
|
|
1602
1619
|
'685000',
|
|
@@ -4136,7 +4153,7 @@ module.exports = {
|
|
|
4136
4153
|
'1'
|
|
4137
4154
|
],
|
|
4138
4155
|
[
|
|
4139
|
-
'
|
|
4156
|
+
'40',
|
|
4140
4157
|
'69'
|
|
4141
4158
|
],
|
|
4142
4159
|
[
|
|
@@ -7566,11 +7583,11 @@ module.exports = {
|
|
|
7566
7583
|
'0'
|
|
7567
7584
|
],
|
|
7568
7585
|
[
|
|
7569
|
-
'
|
|
7586
|
+
'25',
|
|
7570
7587
|
'64'
|
|
7571
7588
|
],
|
|
7572
7589
|
[
|
|
7573
|
-
'
|
|
7590
|
+
'670',
|
|
7574
7591
|
'999'
|
|
7575
7592
|
]
|
|
7576
7593
|
]
|
|
@@ -7988,6 +8005,10 @@ module.exports = {
|
|
|
7988
8005
|
'979-8': {
|
|
7989
8006
|
name: 'United States',
|
|
7990
8007
|
ranges: [
|
|
8008
|
+
[
|
|
8009
|
+
'1800',
|
|
8010
|
+
'1949'
|
|
8011
|
+
],
|
|
7991
8012
|
[
|
|
7992
8013
|
'1950',
|
|
7993
8014
|
'1999'
|