Skip to content

Commit

Permalink
SMC-4466: handle null options being passed in
Browse files Browse the repository at this point in the history
  • Loading branch information
southbite committed Dec 2, 2021
1 parent a8611ea commit 03a050d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 14 deletions.
4 changes: 4 additions & 0 deletions RELEASES.md
Original file line number Diff line number Diff line change
Expand Up @@ -915,3 +915,7 @@
- maybe-breaking: SMC-734: removed encrypted payloads as it is not being used anywhere
- lintignored session-management test, may be breaking eslint due to callback hell

12.0.1 2021-12-02
-----------------
- SMC-4466: light client modifications - able to pass null options into create

22 changes: 12 additions & 10 deletions lib/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,22 @@
connection = null;
}

if (!options) options = connection;
if (!options) {
options = connection || null;
}

var client = new HappnClient().client(options);

if (options.testMode) HappnClient.lastClient = client;

if (typeof options.cookieEventHandler === 'function' && browser) {
HappnClient.addCookieEventHandler(
options.cookieEventHandler,
options.cookieName,
options.interval
);
if (options != null) {
if (options.testMode) HappnClient.lastClient = client;
if (typeof options.cookieEventHandler === 'function' && browser) {
HappnClient.addCookieEventHandler(
options.cookieEventHandler,
options.cookieName,
options.interval
);
}
}

return client.initialize(function(err, createdClient) {
if (!err) return callback(null, createdClient);

Expand Down
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "happn-3",
"version": "12.0.0",
"version": "12.0.1",
"description": "pub/sub api as a service using primus and mongo & redis or nedb, can work as cluster, single process or embedded using nedb",
"keywords": [
"mongo",
Expand Down

0 comments on commit 03a050d

Please sign in to comment.