Halfway through extending subscriptions by selectable unsubscription process. Also contains changes towards better handling of scenarios when address is already subscribed.
This commit is contained in:
parent
b0d51c7dad
commit
3783d7c2ce
27 changed files with 727 additions and 431 deletions
10
lib/tools.js
10
lib/tools.js
|
@ -43,7 +43,13 @@ function toDbKey(key) {
|
|||
}
|
||||
|
||||
function fromDbKey(key) {
|
||||
return key.replace(/[_\-]([a-z])/g, (m, c) => c.toUpperCase());
|
||||
let prefix = '';
|
||||
if (key.startsWith('_')) {
|
||||
key = key.substring(1);
|
||||
prefix = '_';
|
||||
|
||||
}
|
||||
return prefix + key.replace(/[_\-]([a-z])/g, (m, c) => c.toUpperCase());
|
||||
}
|
||||
|
||||
function convertKeys(obj, options) {
|
||||
|
@ -54,7 +60,7 @@ function convertKeys(obj, options) {
|
|||
if (options.skip && options.skip.indexOf(lKey) >= 0) {
|
||||
return;
|
||||
}
|
||||
if (options.keep && options.skip.indexOf(lKey) < 0) {
|
||||
if (options.keep && options.keep.indexOf(lKey) < 0) {
|
||||
return;
|
||||
}
|
||||
response[lKey] = obj[key];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue