This repository has been archived by the owner on Dec 8, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
auction.min.js
1 lines (1 loc) · 2.17 KB
/
auction.min.js
1
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Auction=f()}})(function(){var define,module,exports;return function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}({1:[function(require,module,exports){"use strict";var _createClass=function(){function defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor)}}return function(Constructor,protoProps,staticProps){if(protoProps)defineProperties(Constructor.prototype,protoProps);if(staticProps)defineProperties(Constructor,staticProps);return Constructor}}();function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function")}}var Auction=function(){function Auction(data){_classCallCheck(this,Auction);this.data=data}_createClass(Auction,[{key:"getUniqueBidders",value:function getUniqueBidders(){var a=[];var bids=this.data.bids;for(var i=0,l=bids.length;i<l;i++){if(a.indexOf(bids[i].bidder.duns_number)===-1&&bids[i].duns_number!=="")a.push(bids[i].bidder.duns_number)}return a}},{key:"getWinningBid",value:function getWinningBid(){var bids=this.data.bids;var bidAmounts=bids.map(function(d){return parseInt(d.amount)});var minBid=Math.min.apply(Math,bidAmounts);var minBidder=bids[bidAmounts.indexOf(minBid)];return{bidder:minBidder.bidder.duns_number,amount:minBid}}}]);return Auction}();module.exports=Auction},{}]},{},[1])(1)});