We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The following can be refactored
function encrypt_hook(keys) { var encrypt_hook = function(hook, next) { winston.log("debug", ">>>ENCRYPTING:", hook.data); function encrypt_ids(data) { return json_transform(data, keys, crypto.encrypt); } if (hook.data != null) { /* winston.log("debug", "encrypting data:", hook.data); */ var encrypted_data = encrypt_ids(hook.data); /* winston.log("debug", "encrypted data:", encrypted_data); */ hook.data = encrypted_data; } if (hook.params != null) { /* winston.log("debug", "encrypting params:", hook.params); */ var encrypted_params = encrypt_ids(hook.params); /* winston.log("debug", "encrypted params:", encrypted_params); */ hook.params = encrypted_params; } next(); } return encrypt_hook; }
to
function encrypt_hook(keys) { return function(hook, next) { if (hook.data != null) { hook.data = encrypt_ids(hook.data, keys); } if (hook.params != null) { hook.params = encrypt_ids(hook.params, keys); } next(); }; } function encrypt_ids(data, keys) { return json_transform(data, keys, crypto.encrypt); }
I am not convinced about nesting functions within functions like that. Feels like a code smell.
I see why you used the variable so you could log the results. I still think it's additional bloat that makes the code less readable.
I feel like the refactoring above could be improved, but I need to understand what the difference between data and params is. Getting there ...
The text was updated successfully, but these errors were encountered:
No branches or pull requests
The following can be refactored
to
I am not convinced about nesting functions within functions like that. Feels like a code smell.
I see why you used the variable so you could log the results. I still think it's additional bloat that makes the code less readable.
I feel like the refactoring above could be improved, but I need to understand what the difference between data and params is. Getting there ...
The text was updated successfully, but these errors were encountered: