Rob-- / bitskins

A wrapper for the Bitskins API in Node.js
11 stars 7 forks source link

update getAllItemPrices #8

Open waxapi opened 5 years ago

waxapi commented 5 years ago

I'm leaving this here for anyone who needed the getAllItemPrices() to allow app_id as a parameter.

      let getItemPrices = function (app_id, simple) {
        function arrayToObject(object, item) {
          object[item.market_hash_name] = item.price;
          return object;
        }

        return api.makeRequest('get_all_item_prices', {
          app_id
        }, (body) => {
          if (simple) {
            body.prices = body.prices.reduce(arrayToObject, {});
          }

          return body.prices;
        });
      }