equal
deleted
inserted
replaced
45 return res; |
45 return res; |
46 }, {}); |
46 }, {}); |
47 |
47 |
48 return { |
48 return { |
49 'lexvoids': resMap |
49 'lexvoids': resMap |
|
50 }; |
|
51 |
|
52 }); |
|
53 |
|
54 this.get('/bnf/:ids', function(db, request) { |
|
55 |
|
56 var bnfIds = decodeURIComponent(request.params.ids); |
|
57 var resMap = _.reduce(bnfIds.split(','), function(res, id) { |
|
58 var fullId = id; |
|
59 if(_.startsWith(fullId, constants.BNF_BASE_URL)) { |
|
60 fullId = fullId.slice(constants.BNF_BASE_URL.length); |
|
61 } else if (_.startsWith(fullId, constants.BNF_ARK_BASE_URL)) { |
|
62 fullId = fullId.slice(constants.BNF_ARK_BASE_URL.length); |
|
63 } else if (!_.startsWith(fullId, constants.BNF_ARK_BASE_ID)) { |
|
64 fullId = constants.BNF_ARK_BASE_ID + fullId; |
|
65 } |
|
66 var bnfRes = db.lexvo.find(fullId); |
|
67 res[fullId] = bnfRes?bnfRes.label:null; |
|
68 return res; |
|
69 }, {}); |
|
70 |
|
71 return { |
|
72 'bnfids': resMap |
50 }; |
73 }; |
51 |
74 |
52 }); |
75 }); |
53 |
76 |
54 /* |
77 /* |