Skip to content

Instantly share code, notes, and snippets.

@web20opensource
Last active August 29, 2015 14:19
Show Gist options
  • Select an option

  • Save web20opensource/480610c19459be2cb1bc to your computer and use it in GitHub Desktop.

Select an option

Save web20opensource/480610c19459be2cb1bc to your computer and use it in GitHub Desktop.

Revisions

  1. web20opensource revised this gist Apr 18, 2015. 1 changed file with 12 additions and 4 deletions.
    16 changes: 12 additions & 4 deletions ex12
    Original file line number Diff line number Diff line change
    @@ -1,19 +1,27 @@
    return movieLists.map(
    (cat) => {

    // map receives 3 args
    // cat - element to iterate
    // cIndex - index in the array of the element
    // cCollection - movieLists array
    // same applies for the rest if the code
    (cat, cIndex, cCollection) => {
    //v for videos object
    return cat.videos.map ( (v,vIndex,vCollection) => {
    //if you open the debugger (F12) you will see the variables values
    debugger;
    //pressing F11 in the next line and with some good luck you can see the code of ex 7
    return v.boxarts.filter( (box,bIndex,bCollection) => {
    debugger;
    //using coercion with double equals cool!
    return box.width=='150'

    })
    .map( (filteredResult,fRIndex,fRCollection) => {
    debugger;
    return {
    'id': v.id ,
    'title' : v.title ,
    'boxart': filteredResult.url

    'boxart': filteredResult.url
    }
    })
    }).concatAll()
  2. web20opensource revised this gist Apr 18, 2015. 1 changed file with 4 additions and 4 deletions.
    8 changes: 4 additions & 4 deletions ex12
    Original file line number Diff line number Diff line change
    @@ -1,18 +1,18 @@
    return movieLists.map(
    (cat) => {
    return cat.videos.map ( (v,v2,v3) => {
    return cat.videos.map ( (v,vIndex,vCollection) => {
    debugger;
    return v.boxarts.filter( (box,filter2,filter3) => {
    return v.boxarts.filter( (box,bIndex,bCollection) => {
    debugger;
    return box.width=='150'

    })
    .map( (my150,box2,box3) => {
    .map( (filteredResult,fRIndex,fRCollection) => {
    debugger;
    return {
    'id': v.id ,
    'title' : v.title ,
    'boxart': my150.url
    'boxart': filteredResult.url

    }
    })
  3. web20opensource renamed this gist Apr 18, 2015. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  4. web20opensource revised this gist Apr 18, 2015. 1 changed file with 18 additions and 14 deletions.
    32 changes: 18 additions & 14 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -1,16 +1,20 @@
    return movieLists.map(
    (cat) => {
    return cat.videos.map ( (v) => {
    v.boxarts.filter(
    (box) => {
    return box.width=='150'
    })
    .map( (f) => {
    debugger;
    return {
    'id': f.id ,
    'title' : f.title ,
    'boxart': box.url
    }
    })
    })
    return cat.videos.map ( (v,v2,v3) => {
    debugger;
    return v.boxarts.filter( (box,filter2,filter3) => {
    debugger;
    return box.width=='150'

    })
    .map( (my150,box2,box3) => {
    debugger;
    return {
    'id': v.id ,
    'title' : v.title ,
    'boxart': my150.url

    }
    })
    }).concatAll()
    }).concatAll()
  5. web20opensource created this gist Apr 18, 2015.
    16 changes: 16 additions & 0 deletions gistfile1.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,16 @@
    return movieLists.map(
    (cat) => {
    return cat.videos.map ( (v) => {
    v.boxarts.filter(
    (box) => {
    return box.width=='150'
    })
    .map( (f) => {
    debugger;
    return {
    'id': f.id ,
    'title' : f.title ,
    'boxart': box.url
    }
    })
    })