Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const bitbucket = require('bitbucket-api')
- const bbClient = bitbucket.createClient({
- username: 'username',
- password: 'hui'
- })
- function collectRecentRepos() {
- return new Promise((resolve, reject) => {
- bbClient.repositories((err, repos) =>
- resolve(repos
- .map(repo => ({ name: repo.slug, updated_at: new Date(repo.utc_last_updated) }))
- .filter(repo => repo.updated_at > (Date.now() - 7 * 24 * 60 * 60 * 1000))
- .sort((a, b) => a.updated_at - b.updated_at))
- })
- }
- function listRecentRepos() {
- collectRecentRepos()
- .then(repos => console.log(repos))
- }
- listRecentRepos()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement