Skip to content

Instantly share code, notes, and snippets.

@volpeo
Created November 8, 2019 23:49
Show Gist options
  • Save volpeo/6120cf167fad3323d4a1142704b3f61a to your computer and use it in GitHub Desktop.
Save volpeo/6120cf167fad3323d4a1142704b3f61a to your computer and use it in GitHub Desktop.
Jato.js
data = request_result
// target the array of projects
projects = request_result.data.projects.group
// target the array of repos
repos = data.data.repo.edges
// get the strings we need to filter on as source
source = repos.map(function(repo) { return repo.node.relativePath })
// filter on projects
projects.filter(function(project) {
// return true if relativeDirectory of project is in the array of the source strings
return source.includes(project.edges[0].node.relativeDirectory)
})
[
{
"edges": [
{
"node": {
"publicURL": "/static/Aleyna-3f3a4b1c7761ad2cf6f9ea748d45e43c.jpg",
"relativeDirectory": "Logos",
"sourceInstanceName": "Design"
}
}
]
},
{
"edges": [
{
"node": {
"publicURL": "/static/bouille2mome-3-89bd292a63902adb7385737cf9062ffd.jpg",
"relativeDirectory": "Love",
"sourceInstanceName": "Photography"
}
}
]
},
{
"edges": [
{
"node": {
"publicURL": "/static/new-sydney-life-c6234718d269fb13854f2bfbfc60ba7a.jpg",
"relativeDirectory": "Personal",
"sourceInstanceName": "Design"
}
}
]
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment