|
| 1 | +package data |
| 2 | + |
| 3 | +// Prefixes for ISBN standards |
| 4 | +const ( |
| 5 | + ISBN13Prefix = "978" |
| 6 | + ISBN10Prefix = "979" |
| 7 | +) |
| 8 | + |
| 9 | +// ISBNRule defines a registrant rule range and its length |
| 10 | +type ISBNRule struct { |
| 11 | + Min string |
| 12 | + Max string |
| 13 | + Length int |
| 14 | +} |
| 15 | + |
| 16 | +// ISBNRules maps prefix -> registration group -> registrant rules |
| 17 | +var ISBNRules = map[string]map[string][]ISBNRule{ |
| 18 | + ISBN13Prefix: { |
| 19 | + "0": { |
| 20 | + {Min: "0000000", Max: "1999999", Length: 2}, |
| 21 | + {Min: "2000000", Max: "2279999", Length: 3}, |
| 22 | + {Min: "2280000", Max: "2289999", Length: 4}, |
| 23 | + {Min: "2290000", Max: "6479999", Length: 3}, |
| 24 | + {Min: "6480000", Max: "6489999", Length: 7}, |
| 25 | + {Min: "6490000", Max: "6999999", Length: 3}, |
| 26 | + {Min: "7000000", Max: "8499999", Length: 4}, |
| 27 | + {Min: "8500000", Max: "8999999", Length: 5}, |
| 28 | + {Min: "9000000", Max: "9499999", Length: 6}, |
| 29 | + {Min: "9500000", Max: "9999999", Length: 7}, |
| 30 | + }, |
| 31 | + "1": { |
| 32 | + {Min: "0000000", Max: "0999999", Length: 2}, |
| 33 | + {Min: "1000000", Max: "3999999", Length: 3}, |
| 34 | + {Min: "4000000", Max: "5499999", Length: 4}, |
| 35 | + {Min: "5500000", Max: "7319999", Length: 5}, |
| 36 | + {Min: "7320000", Max: "7399999", Length: 7}, |
| 37 | + {Min: "7400000", Max: "8697999", Length: 5}, |
| 38 | + {Min: "8698000", Max: "9729999", Length: 6}, |
| 39 | + {Min: "9730000", Max: "9877999", Length: 4}, |
| 40 | + {Min: "9878000", Max: "9989999", Length: 6}, |
| 41 | + {Min: "9990000", Max: "9999999", Length: 7}, |
| 42 | + }, |
| 43 | + }, |
| 44 | + ISBN10Prefix: { |
| 45 | + "8": { |
| 46 | + {Min: "0000000", Max: "1999999", Length: 2}, |
| 47 | + {Min: "2000000", Max: "2279999", Length: 3}, |
| 48 | + {Min: "2280000", Max: "2289999", Length: 4}, |
| 49 | + {Min: "2290000", Max: "6479999", Length: 3}, |
| 50 | + {Min: "6480000", Max: "6489999", Length: 7}, |
| 51 | + {Min: "6490000", Max: "6999999", Length: 3}, |
| 52 | + {Min: "7000000", Max: "8499999", Length: 4}, |
| 53 | + {Min: "8500000", Max: "8999999", Length: 5}, |
| 54 | + {Min: "9000000", Max: "9499999", Length: 6}, |
| 55 | + {Min: "9500000", Max: "9999999", Length: 7}, |
| 56 | + }, |
| 57 | + }, |
| 58 | +} |
0 commit comments