@dotdev/apparel21-sdk
Advanced tools
Comparing version 0.0.76 to 0.0.77
@@ -227,4 +227,4 @@ import currency from 'currency.js'; | ||
stores: Store[]; | ||
name: string; | ||
skuIdx: number; | ||
name?: string; | ||
skuIdx?: number; | ||
} | ||
@@ -231,0 +231,0 @@ export interface FreeStockClr { |
@@ -22,2 +22,3 @@ "use strict"; | ||
}); | ||
// Clr may not have Sku property, but directly contain store information | ||
if (res.Clr) | ||
@@ -24,0 +25,0 @@ return freestock_1.formatFreestockBySku(res.Clr); |
@@ -1,2 +0,3 @@ | ||
import { FreeStockSku, FreeStockClr, FreeStockStyle, StockChangedSince } from '../common/types'; | ||
import { FreeStockSku, FreeStockStore, FreeStockClr, FreeStockStyle, StockChangedSince } from '../common/types'; | ||
export declare const formatFreestockByStore: (store: any) => FreeStockStore; | ||
export declare const formatFreestockBySku: (sku: any) => FreeStockSku; | ||
@@ -3,0 +4,0 @@ export declare const formatFreestockByClr: (clr: any) => FreeStockClr; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.formatStockChangedSince = exports.formatFreestock = exports.formatFreestockByStyle = exports.formatFreestockByClr = exports.formatFreestockBySku = void 0; | ||
exports.formatStockChangedSince = exports.formatFreestock = exports.formatFreestockByStyle = exports.formatFreestockByClr = exports.formatFreestockBySku = exports.formatFreestockByStore = void 0; | ||
exports.formatFreestockByStore = (store) => { | ||
return { | ||
name: store.$.Name, | ||
storeId: parseInt(store.$.StoreId, 10), | ||
storeNumber: parseInt(store.$.StoreNumber, 10), | ||
freeStock: parseInt(store.$.FreeStock, 10), | ||
}; | ||
}; | ||
exports.formatFreestockBySku = (sku) => { | ||
const stock = { | ||
stores: sku.Store.map((store) => { | ||
return { | ||
name: store.$.Name, | ||
storeId: parseInt(store.$.StoreId, 10), | ||
storeNumber: parseInt(store.$.StoreNumber, 10), | ||
freeStock: parseInt(store.$.FreeStock, 10), | ||
}; | ||
}), | ||
stores: sku.Store.map((store) => exports.formatFreestockByStore(store)), | ||
name: sku.$.Name, | ||
@@ -21,3 +22,10 @@ skuIdx: parseInt(sku.$.SkuIdx, 10), | ||
const stock = { | ||
skus: clr.Sku.map((sku) => exports.formatFreestockBySku(sku)), | ||
// Clr may not have Sku property, but directly contain store information | ||
skus: clr.Sku | ||
? clr.Sku.map((sku) => exports.formatFreestockBySku(sku)) | ||
: [ | ||
{ | ||
stores: clr.Store.map((store) => exports.formatFreestockByStore(store)), | ||
}, | ||
], | ||
name: clr.$.Name, | ||
@@ -24,0 +32,0 @@ clrIdx: parseInt(clr.$.ClrIdx, 10), |
{ | ||
"name": "@dotdev/apparel21-sdk", | ||
"version": "0.0.76", | ||
"version": "0.0.77", | ||
"license": "UNLICENSED", | ||
@@ -5,0 +5,0 @@ "description": "Apparel21 Interface Library", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
218448
3641