forked from deadvey/blogger-nodejs
Updated the data reading to have a data request limit, also updated docs
on new configuration options
This commit is contained in:
@@ -78,10 +78,13 @@ export function getdata(data_type, key=-1, value=-1) {
|
||||
case 'comments':
|
||||
result = func.require_module(`../data/${data_type}.json`)
|
||||
if (key != -1) {
|
||||
if (key == 'id' && value < result.length) { // id is the index
|
||||
return result[value]
|
||||
}
|
||||
return result[func.find_key_value_pair(result, key, value)]
|
||||
return -1 // This index doesn't exist
|
||||
}
|
||||
return result
|
||||
return result.slice(- config['data_request_limit'])
|
||||
break;
|
||||
case 'hitcount':
|
||||
result = func.require_module('../data/data.json') // This file is actually called data.json
|
||||
|
||||
Reference in New Issue
Block a user