Skip to content
This repository has been archived by the owner on Jul 9, 2022. It is now read-only.

Commit

Permalink
Merge pull request #425 from kabirvirji/master
Browse files Browse the repository at this point in the history
async support
  • Loading branch information
bsansouci committed Mar 28, 2017
2 parents d33a243 + a244c36 commit e90fb39
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ function loginHelper(appState, email, password, globalOptions, callback) {
}

function login(loginData, options, callback) {
if(utils.getType(options) === 'Function') {
if(utils.getType(options) === 'Function' || utils.getType(options) === 'AsyncFunction') {
callback = options;
options = {};
}
Expand Down
2 changes: 1 addition & 1 deletion src/addUserToGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var log = require("npmlog");

module.exports = function(defaultFuncs, api, ctx) {
return function addUserToGroup(userID, threadID, callback) {
if(!callback && utils.getType(threadID) === 'Function') {
if(!callback && (utils.getType(threadID) === 'Function' || getType(threadID) === 'AsyncFunction')) {
throw {error: "please pass a threadID as a second argument."};
}

Expand Down
2 changes: 1 addition & 1 deletion src/changeGroupImage.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ module.exports = function(defaultFuncs, api, ctx) {
}

return function changeGroupImage(image, threadID, callback) {
if(!callback && utils.getType(threadID) === 'Function') {
if(!callback && (utils.getType(threadID) === 'Function' || utils.getType(threadID) === 'AsyncFunction')) {
throw {error: "please pass a threadID as a second argument."};
}

Expand Down
2 changes: 1 addition & 1 deletion src/getThreadList.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = function(defaultFuncs, api, ctx) {
throw {
error: "Please pass a number as a second argument."
};
} else if (utils.getType(type) === 'Function') {
} else if (utils.getType(type) === 'Function' || utils.getType(type) === 'AsyncFunction') {
callback = type;
type = 'inbox'; //default to inbox
} else if (utils.getType(type) !== 'String') {
Expand Down
2 changes: 1 addition & 1 deletion src/removeUserFromGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var log = require("npmlog");

module.exports = function(defaultFuncs, api, ctx) {
return function removeUserFromGroup(userID, threadID, callback) {
if(!callback && utils.getType(threadID) === 'Function') {
if(!callback && (utils.getType(threadID) === 'Function' || utils.getType(threadID) === 'AsyncFunction')) {
throw {error: "please pass a threadID as a second argument."};
}
if (utils.getType(threadID) !== "Number" && utils.getType(threadID) !== "String") {
Expand Down
2 changes: 1 addition & 1 deletion src/sendMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ module.exports = function(defaultFuncs, api, ctx) {
}

return function sendMessage(msg, threadID, callback) {
if(!callback && utils.getType(threadID) === 'Function') {
if(!callback && (utils.getType(threadID) === 'Function' || utils.getType(threadID) === 'AsyncFunction')) {
return callback({error: "Pass a threadID as a second argument."});
}
if(!callback) {
Expand Down
2 changes: 1 addition & 1 deletion src/setTitle.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var log = require("npmlog");

module.exports = function(defaultFuncs, api, ctx) {
return function setTitle(newTitle, threadID, callback) {
if(!callback && utils.getType(threadID) === 'Function') {
if(!callback && (utils.getType(threadID) === 'Function' || utils.getType(threadID) === 'AsyncFunction')) {
throw {error: "please pass a threadID as a second argument."};
}

Expand Down
2 changes: 1 addition & 1 deletion utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function getHeaders(url) {

function isReadableStream(obj) {
return obj instanceof stream.Stream &&
getType(obj._read) === 'Function' &&
(getType(obj._read) === 'Function' || getType(obj._read) === 'AsyncFunction') &&
getType(obj._readableState) === 'Object';
}

Expand Down

0 comments on commit e90fb39

Please sign in to comment.