PluginProbe
Packeta / 2.0.9
Packeta v2.0.9
2.3.2 2.3.1 trunk 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.3.0 1.3.1 1.3.2 1.4 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 All 56 releases
packeta / src / PacketaWidget / fillRateAttrValues.js

fillRateAttrValues.js in Packeta 2.0.9, at src/PacketaWidget/fillRateAttrValues.js

24 lines 597 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 export const fillRateAttrValues = function ( carrierRateId, data, source, rateAttrValues ) {
2 for ( let attrKey in data ) {
3 if ( ! data.hasOwnProperty( attrKey ) ) {
4 continue;
5 }
6
7 const { name, widgetResultField, isWidgetResultField } =
8 data[ attrKey ];
9
10 if ( false === isWidgetResultField ) {
11 continue;
12 }
13
14 let widgetField = widgetResultField || attrKey;
15 let addressFieldValue = source[ widgetField ];
16
17 rateAttrValues[ carrierRateId ] =
18 rateAttrValues[ carrierRateId ] || {};
19 rateAttrValues[ carrierRateId ][ name ] = addressFieldValue;
20 }
21
22 return rateAttrValues;
23 };
24