...
stream.on("end", () => {
if (status === "200") {
resolve({ device });
} else if ...
To be conistent with the other cases handled in the sendAPN module, it would be great to pick the device prop and set as regId instead of returning the property wrapped in an object literal.
When mapping through received token for sent notifications in sendAPN module the logic assumes that the received tokens are strings (https://github.com/appfeel/node-pushnotifications/blob/master/src/sendAPN.js [line 108ff]):
In fact, looking at the implemenation of the success case logic in the
node-apn
package, thedevice
is wrapped in an object literal (https://github.com/node-apn/node-apn/blob/master/lib/client.js [line 74ff]):To be conistent with the other cases handled in the sendAPN module, it would be great to pick the
device
prop and set asregId
instead of returning the property wrapped in an object literal.