Browse Source

Refactored copyWithProperties()

pull/28/head
Peter Morgan 4 years ago
parent
commit
4cb0c76065
1 changed files with 5 additions and 7 deletions
  1. +5
    -7
      routes/api/v2.js

+ 5
- 7
routes/api/v2.js View File

@ -95,13 +95,11 @@ const fetchAllWithPagination = async (apiPath, page, lst) => {
* @param {*} props
* @param {*} obj
*/
function copyWithProperties(props, obj)
{
var newO = new Object();
for(var i =0; i < props.length; i++)
{
newO[props[i]] = obj[props[i]];
}
const copyWithProperties = (props, obj) => {
let newO = new Object();
props.forEach(prop => {
newO[prop] = obj[prop];
})
return newO;
}

Loading…
Cancel
Save