Last active
December 13, 2015 17:19
-
-
Save chapel/4947289 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 albumIds = [] | |
var albums = pin.photos.map(function(photo){ | |
albumIds.push(photo.albumId) | |
return { | |
albumId: photo.albumId, | |
albumTitle: photo.albumTitle | |
}; | |
}) | |
// Alternative to avoid empty elements and duplicates | |
var alumbIds = [] | |
var albums = [] | |
pin.photos.forEach(function (photo) { | |
if (!!~albumIds.indexOf(photo.albumId) || !photo.albumId) return | |
albumIds.push(photo.albumId) | |
albums.push({ | |
albumId: photo.albumId, | |
albumTitle: photo.albumTitle | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment