project/app/scripts/modules/payment-api.js
/**
   * Utility function to extract fields from one object and copy them into a new
   * object.
   * @param {object} source copies from this object
   * @param {...string} fields names of fields to copy
   * @returns {object} new object with only the specified fields (copied from source)
   */
Utility function to extract fields from one object and copy them into a new
object.
@param {object} source copies from this object
@param {...string} fields names of fields to copy
@returns {object} new object with only the specified fields (copied from source)
Utility function to extract fields from one object and copy them into a new object . @param { object } source copies from this object @param { ... string } fields names of fields to copy @returns { object } new object with only the specified fields ( copied from source )
copy(source, ...fields) {
    if (source === null) return source;
    let result = {};
    for (let i = 0; i < fields.length; i++) {
      const field = fields[i];
      result[field] = source[field];
    }
    return result;
  }
copy ( source , ... fields ) { if ( source === null ) return source ; let result = { } ; for ( let i = 0 ; i < fields . length ; i ++ ) { const field = fields [ i ] ; result [ field ] = source [ field ] ; } return result ; }
Utility function to extract fields from one object and copy them into a new
 object.
Utility function to extract fields from one object and copy them into a new object .