Created
July 21, 2017 12:02
-
-
Save xylude/1c38fcd8d08ede96975af5ef7155b233 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var userList = []; | |
function getUsers(page, cb) { | |
management.users.getAll({per_page: 50, page: page},function (err, users) { | |
if(!err) { | |
if (users.length > 0) { | |
userList = userList.concat(users); | |
getUsers(page + 1, cb); | |
} else { | |
if(cb) { | |
cb(true) | |
} | |
} | |
} else { | |
console.log(err); | |
cb(false) | |
} | |
}) | |
} | |
getUsers(0, err => { | |
console.log(JSON.stringify(userList, null, 4)); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment