Filter array and add a property











up vote
1
down vote

favorite












I have an array where I have the weekly progress of some projects .



In the cuurent week, timestamp of 1529539200 or date 06/21/2018, I have the information of 3 projects. Project 20, 21 and 22.



In the other week, a week before the current 06/14/2018, there's only information of 2 projects. Because project 22 didn't exist.



progressList = [
// current 06/21/2018
{
project: 20,
timestamp: 1529539200, // seconds
current: true,
progress: 90
},
{
project: 21,
timestamp: 1529539200,
current: true,
progress: 70
},
{
project: 22,
timestamp: 1529539200,
current: true,
progress: 100
},
// 06/14/2018
{
project: 20,
timestamp: 1528934400, // a week before (1529539200 - 604800)
current: false,
progress: 80
},
{
project: 21,
timestamp: 1528934400,
current: false,
progress: 50
}
]


What I need is a list of current projects, but includes a new property "increase", that is equals to the difference between current project progress and the progress of the week before.



For example I should get something like this:



currentProgressList = [
{
project: 20,
timestamp: 1529539200,
current: true,
progress: 90,
increase: 10 // difference
},
{
project: 21,
timestamp: 1529539200,
current: true,
progress: 70,
increase: 20
},
{
project: 22,
timestamp: 1529539200,
current: true,
progress: 100,
increase: 0 //
}
]


I guess that filtering the projects by current property may be simple:



listadoprogresss.filter(p => {
return p.current === true
})


But, I don't know how to add the increase property according with my needs.



Thanks in advance










share|improve this question






















  • You can simply use the Array map method to generate a new Array with the 'increase' property.
    – Vishnu Vishwa
    Nov 10 at 21:09















up vote
1
down vote

favorite












I have an array where I have the weekly progress of some projects .



In the cuurent week, timestamp of 1529539200 or date 06/21/2018, I have the information of 3 projects. Project 20, 21 and 22.



In the other week, a week before the current 06/14/2018, there's only information of 2 projects. Because project 22 didn't exist.



progressList = [
// current 06/21/2018
{
project: 20,
timestamp: 1529539200, // seconds
current: true,
progress: 90
},
{
project: 21,
timestamp: 1529539200,
current: true,
progress: 70
},
{
project: 22,
timestamp: 1529539200,
current: true,
progress: 100
},
// 06/14/2018
{
project: 20,
timestamp: 1528934400, // a week before (1529539200 - 604800)
current: false,
progress: 80
},
{
project: 21,
timestamp: 1528934400,
current: false,
progress: 50
}
]


What I need is a list of current projects, but includes a new property "increase", that is equals to the difference between current project progress and the progress of the week before.



For example I should get something like this:



currentProgressList = [
{
project: 20,
timestamp: 1529539200,
current: true,
progress: 90,
increase: 10 // difference
},
{
project: 21,
timestamp: 1529539200,
current: true,
progress: 70,
increase: 20
},
{
project: 22,
timestamp: 1529539200,
current: true,
progress: 100,
increase: 0 //
}
]


I guess that filtering the projects by current property may be simple:



listadoprogresss.filter(p => {
return p.current === true
})


But, I don't know how to add the increase property according with my needs.



Thanks in advance










share|improve this question






















  • You can simply use the Array map method to generate a new Array with the 'increase' property.
    – Vishnu Vishwa
    Nov 10 at 21:09













up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have an array where I have the weekly progress of some projects .



In the cuurent week, timestamp of 1529539200 or date 06/21/2018, I have the information of 3 projects. Project 20, 21 and 22.



In the other week, a week before the current 06/14/2018, there's only information of 2 projects. Because project 22 didn't exist.



progressList = [
// current 06/21/2018
{
project: 20,
timestamp: 1529539200, // seconds
current: true,
progress: 90
},
{
project: 21,
timestamp: 1529539200,
current: true,
progress: 70
},
{
project: 22,
timestamp: 1529539200,
current: true,
progress: 100
},
// 06/14/2018
{
project: 20,
timestamp: 1528934400, // a week before (1529539200 - 604800)
current: false,
progress: 80
},
{
project: 21,
timestamp: 1528934400,
current: false,
progress: 50
}
]


What I need is a list of current projects, but includes a new property "increase", that is equals to the difference between current project progress and the progress of the week before.



For example I should get something like this:



currentProgressList = [
{
project: 20,
timestamp: 1529539200,
current: true,
progress: 90,
increase: 10 // difference
},
{
project: 21,
timestamp: 1529539200,
current: true,
progress: 70,
increase: 20
},
{
project: 22,
timestamp: 1529539200,
current: true,
progress: 100,
increase: 0 //
}
]


I guess that filtering the projects by current property may be simple:



listadoprogresss.filter(p => {
return p.current === true
})


But, I don't know how to add the increase property according with my needs.



Thanks in advance










share|improve this question













I have an array where I have the weekly progress of some projects .



In the cuurent week, timestamp of 1529539200 or date 06/21/2018, I have the information of 3 projects. Project 20, 21 and 22.



In the other week, a week before the current 06/14/2018, there's only information of 2 projects. Because project 22 didn't exist.



progressList = [
// current 06/21/2018
{
project: 20,
timestamp: 1529539200, // seconds
current: true,
progress: 90
},
{
project: 21,
timestamp: 1529539200,
current: true,
progress: 70
},
{
project: 22,
timestamp: 1529539200,
current: true,
progress: 100
},
// 06/14/2018
{
project: 20,
timestamp: 1528934400, // a week before (1529539200 - 604800)
current: false,
progress: 80
},
{
project: 21,
timestamp: 1528934400,
current: false,
progress: 50
}
]


What I need is a list of current projects, but includes a new property "increase", that is equals to the difference between current project progress and the progress of the week before.



For example I should get something like this:



currentProgressList = [
{
project: 20,
timestamp: 1529539200,
current: true,
progress: 90,
increase: 10 // difference
},
{
project: 21,
timestamp: 1529539200,
current: true,
progress: 70,
increase: 20
},
{
project: 22,
timestamp: 1529539200,
current: true,
progress: 100,
increase: 0 //
}
]


I guess that filtering the projects by current property may be simple:



listadoprogresss.filter(p => {
return p.current === true
})


But, I don't know how to add the increase property according with my needs.



Thanks in advance







javascript






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 10 at 20:52









Javier Cárdenas

6342920




6342920












  • You can simply use the Array map method to generate a new Array with the 'increase' property.
    – Vishnu Vishwa
    Nov 10 at 21:09


















  • You can simply use the Array map method to generate a new Array with the 'increase' property.
    – Vishnu Vishwa
    Nov 10 at 21:09
















You can simply use the Array map method to generate a new Array with the 'increase' property.
– Vishnu Vishwa
Nov 10 at 21:09




You can simply use the Array map method to generate a new Array with the 'increase' property.
– Vishnu Vishwa
Nov 10 at 21:09












2 Answers
2






active

oldest

votes

















up vote
2
down vote



accepted










Here is a possible solution, you can adjust the checkIncrease to suit your solution. but run the code snippet






let checkIncrease = function(list, p) {
let prevProgress = list.find(np => np.project === p.project && !np.current)
var increase = 0;
// confirm that its defined
if (prevProgress) increase = p.progress - prevProgress.progress

// create a clone and return
return { project: p.project, timestamp: p.timestamp, current: p.current, progress: p.progress, increase: increase }
}

let getProgressIncrease = function(progressList) {
return progressList
.filter(p => p.current)
.map(p => checkIncrease(progressList, p))
}


var progressList = [
// current 06/21/2018
{
project: 20,
timestamp: 1529539200, // seconds
current: true,
progress: 90
},
{
project: 21,
timestamp: 1529539200,
current: true,
progress: 70
},
{
project: 22,
timestamp: 1529539200,
current: true,
progress: 100
},
// 06/14/2018
{
project: 20,
timestamp: 1528934400, // a week before (1529539200 - 604800)
current: false,
progress: 80
},
{
project: 21,
timestamp: 1528934400,
current: false,
progress: 50
}
]

// try it out
let result = getProgressIncrease(progressList)
console.log(result)








share|improve this answer






























    up vote
    2
    down vote
















    const progressList = [
    { project: 20, timestamp: 1529539200, current: true, progress: 90 },
    { project: 21, timestamp: 1529539200, current: true, progress: 70 },
    { project: 22, timestamp: 1529539200, current: true, progress: 100 },
    { project: 20, timestamp: 1528934400, current: false, progress: 80 },
    { project: 21, timestamp: 1528934400, current: false, progress: 50 }
    ]

    function getCurrentProgressList(progressList) {

    const projects = ;
    const indexes = {};

    for(const Project of progressList) {
    const index = indexes[Project.project];
    const CurrentProject = projects[index];

    if (Project.current) {
    indexes[Project.project] = projects.length;
    projects.push({ ...Project, increase: 0 });
    } else if (index !== undefined) {
    const a = CurrentProject.progress;
    const b = Project.progress;
    CurrentProject['increase'] = a - b;
    }
    }

    return projects;
    }

    console.log(getCurrentProgressList(progressList));








    share|improve this answer























      Your Answer






      StackExchange.ifUsing("editor", function () {
      StackExchange.using("externalEditor", function () {
      StackExchange.using("snippets", function () {
      StackExchange.snippets.init();
      });
      });
      }, "code-snippets");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "1"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














       

      draft saved


      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243296%2ffilter-array-and-add-a-property%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      2 Answers
      2






      active

      oldest

      votes








      2 Answers
      2






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes








      up vote
      2
      down vote



      accepted










      Here is a possible solution, you can adjust the checkIncrease to suit your solution. but run the code snippet






      let checkIncrease = function(list, p) {
      let prevProgress = list.find(np => np.project === p.project && !np.current)
      var increase = 0;
      // confirm that its defined
      if (prevProgress) increase = p.progress - prevProgress.progress

      // create a clone and return
      return { project: p.project, timestamp: p.timestamp, current: p.current, progress: p.progress, increase: increase }
      }

      let getProgressIncrease = function(progressList) {
      return progressList
      .filter(p => p.current)
      .map(p => checkIncrease(progressList, p))
      }


      var progressList = [
      // current 06/21/2018
      {
      project: 20,
      timestamp: 1529539200, // seconds
      current: true,
      progress: 90
      },
      {
      project: 21,
      timestamp: 1529539200,
      current: true,
      progress: 70
      },
      {
      project: 22,
      timestamp: 1529539200,
      current: true,
      progress: 100
      },
      // 06/14/2018
      {
      project: 20,
      timestamp: 1528934400, // a week before (1529539200 - 604800)
      current: false,
      progress: 80
      },
      {
      project: 21,
      timestamp: 1528934400,
      current: false,
      progress: 50
      }
      ]

      // try it out
      let result = getProgressIncrease(progressList)
      console.log(result)








      share|improve this answer



























        up vote
        2
        down vote



        accepted










        Here is a possible solution, you can adjust the checkIncrease to suit your solution. but run the code snippet






        let checkIncrease = function(list, p) {
        let prevProgress = list.find(np => np.project === p.project && !np.current)
        var increase = 0;
        // confirm that its defined
        if (prevProgress) increase = p.progress - prevProgress.progress

        // create a clone and return
        return { project: p.project, timestamp: p.timestamp, current: p.current, progress: p.progress, increase: increase }
        }

        let getProgressIncrease = function(progressList) {
        return progressList
        .filter(p => p.current)
        .map(p => checkIncrease(progressList, p))
        }


        var progressList = [
        // current 06/21/2018
        {
        project: 20,
        timestamp: 1529539200, // seconds
        current: true,
        progress: 90
        },
        {
        project: 21,
        timestamp: 1529539200,
        current: true,
        progress: 70
        },
        {
        project: 22,
        timestamp: 1529539200,
        current: true,
        progress: 100
        },
        // 06/14/2018
        {
        project: 20,
        timestamp: 1528934400, // a week before (1529539200 - 604800)
        current: false,
        progress: 80
        },
        {
        project: 21,
        timestamp: 1528934400,
        current: false,
        progress: 50
        }
        ]

        // try it out
        let result = getProgressIncrease(progressList)
        console.log(result)








        share|improve this answer

























          up vote
          2
          down vote



          accepted







          up vote
          2
          down vote



          accepted






          Here is a possible solution, you can adjust the checkIncrease to suit your solution. but run the code snippet






          let checkIncrease = function(list, p) {
          let prevProgress = list.find(np => np.project === p.project && !np.current)
          var increase = 0;
          // confirm that its defined
          if (prevProgress) increase = p.progress - prevProgress.progress

          // create a clone and return
          return { project: p.project, timestamp: p.timestamp, current: p.current, progress: p.progress, increase: increase }
          }

          let getProgressIncrease = function(progressList) {
          return progressList
          .filter(p => p.current)
          .map(p => checkIncrease(progressList, p))
          }


          var progressList = [
          // current 06/21/2018
          {
          project: 20,
          timestamp: 1529539200, // seconds
          current: true,
          progress: 90
          },
          {
          project: 21,
          timestamp: 1529539200,
          current: true,
          progress: 70
          },
          {
          project: 22,
          timestamp: 1529539200,
          current: true,
          progress: 100
          },
          // 06/14/2018
          {
          project: 20,
          timestamp: 1528934400, // a week before (1529539200 - 604800)
          current: false,
          progress: 80
          },
          {
          project: 21,
          timestamp: 1528934400,
          current: false,
          progress: 50
          }
          ]

          // try it out
          let result = getProgressIncrease(progressList)
          console.log(result)








          share|improve this answer














          Here is a possible solution, you can adjust the checkIncrease to suit your solution. but run the code snippet






          let checkIncrease = function(list, p) {
          let prevProgress = list.find(np => np.project === p.project && !np.current)
          var increase = 0;
          // confirm that its defined
          if (prevProgress) increase = p.progress - prevProgress.progress

          // create a clone and return
          return { project: p.project, timestamp: p.timestamp, current: p.current, progress: p.progress, increase: increase }
          }

          let getProgressIncrease = function(progressList) {
          return progressList
          .filter(p => p.current)
          .map(p => checkIncrease(progressList, p))
          }


          var progressList = [
          // current 06/21/2018
          {
          project: 20,
          timestamp: 1529539200, // seconds
          current: true,
          progress: 90
          },
          {
          project: 21,
          timestamp: 1529539200,
          current: true,
          progress: 70
          },
          {
          project: 22,
          timestamp: 1529539200,
          current: true,
          progress: 100
          },
          // 06/14/2018
          {
          project: 20,
          timestamp: 1528934400, // a week before (1529539200 - 604800)
          current: false,
          progress: 80
          },
          {
          project: 21,
          timestamp: 1528934400,
          current: false,
          progress: 50
          }
          ]

          // try it out
          let result = getProgressIncrease(progressList)
          console.log(result)








          let checkIncrease = function(list, p) {
          let prevProgress = list.find(np => np.project === p.project && !np.current)
          var increase = 0;
          // confirm that its defined
          if (prevProgress) increase = p.progress - prevProgress.progress

          // create a clone and return
          return { project: p.project, timestamp: p.timestamp, current: p.current, progress: p.progress, increase: increase }
          }

          let getProgressIncrease = function(progressList) {
          return progressList
          .filter(p => p.current)
          .map(p => checkIncrease(progressList, p))
          }


          var progressList = [
          // current 06/21/2018
          {
          project: 20,
          timestamp: 1529539200, // seconds
          current: true,
          progress: 90
          },
          {
          project: 21,
          timestamp: 1529539200,
          current: true,
          progress: 70
          },
          {
          project: 22,
          timestamp: 1529539200,
          current: true,
          progress: 100
          },
          // 06/14/2018
          {
          project: 20,
          timestamp: 1528934400, // a week before (1529539200 - 604800)
          current: false,
          progress: 80
          },
          {
          project: 21,
          timestamp: 1528934400,
          current: false,
          progress: 50
          }
          ]

          // try it out
          let result = getProgressIncrease(progressList)
          console.log(result)





          let checkIncrease = function(list, p) {
          let prevProgress = list.find(np => np.project === p.project && !np.current)
          var increase = 0;
          // confirm that its defined
          if (prevProgress) increase = p.progress - prevProgress.progress

          // create a clone and return
          return { project: p.project, timestamp: p.timestamp, current: p.current, progress: p.progress, increase: increase }
          }

          let getProgressIncrease = function(progressList) {
          return progressList
          .filter(p => p.current)
          .map(p => checkIncrease(progressList, p))
          }


          var progressList = [
          // current 06/21/2018
          {
          project: 20,
          timestamp: 1529539200, // seconds
          current: true,
          progress: 90
          },
          {
          project: 21,
          timestamp: 1529539200,
          current: true,
          progress: 70
          },
          {
          project: 22,
          timestamp: 1529539200,
          current: true,
          progress: 100
          },
          // 06/14/2018
          {
          project: 20,
          timestamp: 1528934400, // a week before (1529539200 - 604800)
          current: false,
          progress: 80
          },
          {
          project: 21,
          timestamp: 1528934400,
          current: false,
          progress: 50
          }
          ]

          // try it out
          let result = getProgressIncrease(progressList)
          console.log(result)






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 10 at 22:28

























          answered Nov 10 at 21:27









          Ebi Igweze

          22927




          22927
























              up vote
              2
              down vote
















              const progressList = [
              { project: 20, timestamp: 1529539200, current: true, progress: 90 },
              { project: 21, timestamp: 1529539200, current: true, progress: 70 },
              { project: 22, timestamp: 1529539200, current: true, progress: 100 },
              { project: 20, timestamp: 1528934400, current: false, progress: 80 },
              { project: 21, timestamp: 1528934400, current: false, progress: 50 }
              ]

              function getCurrentProgressList(progressList) {

              const projects = ;
              const indexes = {};

              for(const Project of progressList) {
              const index = indexes[Project.project];
              const CurrentProject = projects[index];

              if (Project.current) {
              indexes[Project.project] = projects.length;
              projects.push({ ...Project, increase: 0 });
              } else if (index !== undefined) {
              const a = CurrentProject.progress;
              const b = Project.progress;
              CurrentProject['increase'] = a - b;
              }
              }

              return projects;
              }

              console.log(getCurrentProgressList(progressList));








              share|improve this answer



























                up vote
                2
                down vote
















                const progressList = [
                { project: 20, timestamp: 1529539200, current: true, progress: 90 },
                { project: 21, timestamp: 1529539200, current: true, progress: 70 },
                { project: 22, timestamp: 1529539200, current: true, progress: 100 },
                { project: 20, timestamp: 1528934400, current: false, progress: 80 },
                { project: 21, timestamp: 1528934400, current: false, progress: 50 }
                ]

                function getCurrentProgressList(progressList) {

                const projects = ;
                const indexes = {};

                for(const Project of progressList) {
                const index = indexes[Project.project];
                const CurrentProject = projects[index];

                if (Project.current) {
                indexes[Project.project] = projects.length;
                projects.push({ ...Project, increase: 0 });
                } else if (index !== undefined) {
                const a = CurrentProject.progress;
                const b = Project.progress;
                CurrentProject['increase'] = a - b;
                }
                }

                return projects;
                }

                console.log(getCurrentProgressList(progressList));








                share|improve this answer

























                  up vote
                  2
                  down vote










                  up vote
                  2
                  down vote












                  const progressList = [
                  { project: 20, timestamp: 1529539200, current: true, progress: 90 },
                  { project: 21, timestamp: 1529539200, current: true, progress: 70 },
                  { project: 22, timestamp: 1529539200, current: true, progress: 100 },
                  { project: 20, timestamp: 1528934400, current: false, progress: 80 },
                  { project: 21, timestamp: 1528934400, current: false, progress: 50 }
                  ]

                  function getCurrentProgressList(progressList) {

                  const projects = ;
                  const indexes = {};

                  for(const Project of progressList) {
                  const index = indexes[Project.project];
                  const CurrentProject = projects[index];

                  if (Project.current) {
                  indexes[Project.project] = projects.length;
                  projects.push({ ...Project, increase: 0 });
                  } else if (index !== undefined) {
                  const a = CurrentProject.progress;
                  const b = Project.progress;
                  CurrentProject['increase'] = a - b;
                  }
                  }

                  return projects;
                  }

                  console.log(getCurrentProgressList(progressList));








                  share|improve this answer

















                  const progressList = [
                  { project: 20, timestamp: 1529539200, current: true, progress: 90 },
                  { project: 21, timestamp: 1529539200, current: true, progress: 70 },
                  { project: 22, timestamp: 1529539200, current: true, progress: 100 },
                  { project: 20, timestamp: 1528934400, current: false, progress: 80 },
                  { project: 21, timestamp: 1528934400, current: false, progress: 50 }
                  ]

                  function getCurrentProgressList(progressList) {

                  const projects = ;
                  const indexes = {};

                  for(const Project of progressList) {
                  const index = indexes[Project.project];
                  const CurrentProject = projects[index];

                  if (Project.current) {
                  indexes[Project.project] = projects.length;
                  projects.push({ ...Project, increase: 0 });
                  } else if (index !== undefined) {
                  const a = CurrentProject.progress;
                  const b = Project.progress;
                  CurrentProject['increase'] = a - b;
                  }
                  }

                  return projects;
                  }

                  console.log(getCurrentProgressList(progressList));








                  const progressList = [
                  { project: 20, timestamp: 1529539200, current: true, progress: 90 },
                  { project: 21, timestamp: 1529539200, current: true, progress: 70 },
                  { project: 22, timestamp: 1529539200, current: true, progress: 100 },
                  { project: 20, timestamp: 1528934400, current: false, progress: 80 },
                  { project: 21, timestamp: 1528934400, current: false, progress: 50 }
                  ]

                  function getCurrentProgressList(progressList) {

                  const projects = ;
                  const indexes = {};

                  for(const Project of progressList) {
                  const index = indexes[Project.project];
                  const CurrentProject = projects[index];

                  if (Project.current) {
                  indexes[Project.project] = projects.length;
                  projects.push({ ...Project, increase: 0 });
                  } else if (index !== undefined) {
                  const a = CurrentProject.progress;
                  const b = Project.progress;
                  CurrentProject['increase'] = a - b;
                  }
                  }

                  return projects;
                  }

                  console.log(getCurrentProgressList(progressList));





                  const progressList = [
                  { project: 20, timestamp: 1529539200, current: true, progress: 90 },
                  { project: 21, timestamp: 1529539200, current: true, progress: 70 },
                  { project: 22, timestamp: 1529539200, current: true, progress: 100 },
                  { project: 20, timestamp: 1528934400, current: false, progress: 80 },
                  { project: 21, timestamp: 1528934400, current: false, progress: 50 }
                  ]

                  function getCurrentProgressList(progressList) {

                  const projects = ;
                  const indexes = {};

                  for(const Project of progressList) {
                  const index = indexes[Project.project];
                  const CurrentProject = projects[index];

                  if (Project.current) {
                  indexes[Project.project] = projects.length;
                  projects.push({ ...Project, increase: 0 });
                  } else if (index !== undefined) {
                  const a = CurrentProject.progress;
                  const b = Project.progress;
                  CurrentProject['increase'] = a - b;
                  }
                  }

                  return projects;
                  }

                  console.log(getCurrentProgressList(progressList));






                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited Nov 10 at 21:51

























                  answered Nov 10 at 21:24









                  Callam

                  7,70721522




                  7,70721522






























                       

                      draft saved


                      draft discarded



















































                       


                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53243296%2ffilter-array-and-add-a-property%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Florida Star v. B. J. F.

                      Danny Elfman

                      Retrieve a Users Dashboard in Tumblr with R and TumblR. Oauth Issues