half circle
back to top ⇧

pubfood

new pubfood(configopt) → {pubfood}

Creates a new Pubfood Bidding instance
Parameters:
Name Type Attributes Description
config PubfoodConfig <optional>
configuration properties object
Deprecated:
Example
new pubfood({randomizeBidRequests: true,
               bidProviderCbTimeout: 5000,
               auctionProviderCbTimeout: 5000});

Methods (23)

addBidProvider(delegate) → {BidProvider|null}

Add a BidProvider
Parameters:
Name Type Description
delegate BidDelegate Bid provider configuaration
Example
var pf = new pubfood();
   pf.addBidProvider({
     name: 'BidProvider1',
     libUrl: '',
     init: function(slots, pushBid, done) {
     },
     refresh: function(slots, pushBid, done) {
     }
   });

addBidTransform(delegate) → {pubfood}

Add bid transformation operator.
Parameters:
Name Type Description
delegate TransformDelegate the delegate function

addRequestTransform(delegate) → {pubfood}

Add request transformation operator.
Parameters:
Name Type Description
delegate TransformDelegate the delegate function

addSlot(slot) → {pubfood}

Make this adslot avaialble for bidding
Parameters:
Name Type Description
slot SlotConfig Slot configuration

doneCallbackOffset(millisopt) → {number}

Gets or sets the default done callback timeout offset. Default: 5000ms

If a BidProvider.timeout value is not set, specifies the additional time in which a provider gets to push late bids and call done().

Assists capturing late bid data for analytics and reporting by giving additional timeout "grace" period.

Bid provider timeout calculated as the following if not otherwise set:

  • timeout(millis) + doneCallbackOffset(millis)
  • If the timeout elapses, done() is called on behalf of the provider.

    Parameters:
    Name Type Attributes Description
    millis number <optional>
    milliseconds to set the timeout

    dumpLog(type)

    Parameters:
    Name Type Description
    type string

    getAuctionCount() → {number}

    Get the auction count.
    Returns the latest auction index.

    getAuctionId() → {string}

    Get the auction identifier.
    Returns the auction identifier key.
    Example
    Auction Id Format
    <id>:<auction count>

    getAuctionProvider() → {AuctionProvider}

    Get the Auction Provider

    getAuctionRun(idx) → {AuctionRun}

    Get the auction run data structure.
    Parameters:
    Name Type Description
    idx number the integer index of the auction run
    See:

    getBidProvider(name) → {BidProvider}

    Gets a bid provider
    Parameters:
    Name Type Description
    name string the bid provider name

    getBidProviders() → {object.<BidProvider>}

    Gets a list of bid providers

    getSlot(name) → {Slot}

    Get a slot object
    Parameters:
    Name Type Description
    name string the slot name

    getSlots() → {Array.<Slot>}

    Get a list a of all registered slots

    observe(eventTypeopt, reporter) → {pubfood}

    Add a custom reporter
    Parameters:
    Name Type Attributes Description
    eventType string <optional>
    the event to bind this reporter to
    reporter reporter Custom reporter
    Example
    var pf = new pubfood();
       var reporter = function(event){
         console.log('my reporter', event.data);
       };
       pf.observe(reporter);

    omitDefaultBidKey(defaultBidKeyOff) → {pubfood}

    Omit the bid provider default key/value being sent to the ad server.

    Pubfood will add the bid provider default key/value to the ad server request unless omitted explicitly. Default key of the form: <name>_<label|bid>=<value>

    If the default bid provider key/value is omitted, all ad server targeting is dependent on the TargetingObject.targeting property.

    Parameters:
    Name Type Description
    defaultBidKeyOff boolean true turns the default bid key/value feature off.
    Example
    pubfood.omitDefaultBidKey(true)
    
    e.g. for the bid provider name: 'foo', prevents the 'foo_bid=' parameters shown below
    
    prev_iu_szs:300x250|300x600,728x90
    prev_scp:foo_bid=400|foo_bid=200
    
    where;
    <bidder>_<label|bid>=<value>

    pushApiCall_(name, args)

    Push a call to the pubfood api for logging history. Adds the auctionId to the api call log.
    Parameters:
    Name Type Description
    name string the api call nampe format \"api.\"
    args arrayish the array or array like arguments to the call

    refresh(slotNamesopt) → {pubfood}

    Refresh slot bids.
    Parameters:
    Name Type Attributes Description
    slotNames Array.<string> <optional>
    Optional list of slot names to refresh.

    setAuctionProvider(delegate) → {AuctionProvider|null}

    Set the Auction Provider
    Parameters:
    Name Type Description
    delegate AuctionDelegate Auction provider configuration

    setAuctionTrigger(delegate) → {pubfood}

    Sets a function delegate to initiate the publisher ad server request.
    Parameters:
    Name Type Description
    delegate AuctionTriggerFn the function that makes the callback to start the auction

    start(startTimestampopt, startCbopt) → {pubfood}

    Start the bidding process
    Parameters:
    Name Type Attributes Description
    startTimestamp number <optional>
    An optional timestamp that's used for calculating other time deltas.
    startCb apiStartCallback <optional>

    throwErrors(silentopt) → {pubfood}

    Re-throw caught delegate errors. Default: false

    The throwErrors property for all BidDelegate and AuctionDelegate providers will be set.
    Parameters:
    Name Type Attributes Description
    silent boolean <optional>
    if true: re-throw errors in BidDelegate and AuctionDelegate functions

    timeout(millisopt) → {number}

    Gets or sets the time in which bid providers must supply bids.
    Parameters:
    Name Type Attributes Description
    millis number <optional>
    milliseconds to set the timeout
    back to top ⇧

    TransformOperator

    new TransformOperator(delegate)

    TransformOperator processes input bids and outputs result bids.
    Parameters:
    Name Type Description
    delegate TransformDelegate function to transform input bids

    Methods (1)

    setName(name) → {TransformOperator}

    Set the operator name. Default name: OP-[uniqueID] e.g. OP-ih47iucugqzlerdpbr
    Parameters:
    Name Type Description
    name string the name of the operator
    back to top ⇧

    Bid

    new Bid(value)

    Bid is the result of a partner BidProvider request.
    Parameters:
    Name Type Description
    value string | number the bid value. Default: empty string.

    Members (7)

    label

    Properties:
    Name Type Attributes Description
    label string <optional>
    optional label for adserver key targeting for bid value e.g. label=2.00

    provider

    Properties:
    Name Type Attributes Description
    provider string <optional>
    the bid provider name

    sizes

    Properties:
    Name Type Attributes Description
    sizes Array.<number, number> <optional>
    the dimension sizes of the slot bid

    slot

    Properties:
    Name Type Attributes Description
    slot string <optional>
    the slot name

    targeting

    Properties:
    Name Type Attributes Description
    targeting object <optional>
    ad server targeting key/values in addition to the bid value

    type

    Properties:
    Name Type Description
    type string derived bid value type: from util.asType

    value

    Properties:
    Name Type Description
    value string | number the bid value. Default: empty string

    Methods (2)

    addSize(w, h) → {Bid}

    Sets the bid's slot size
    Parameters:
    Name Type Description
    w string | number
    h string | number
    To Do:
    • maybe combine with Bid.prototype.dimensions

    setValue(v) → {Bid}

    Sets the bid's value
    Parameters:
    Name Type Description
    v string | number the bid value for the ad server key/value targeting
    back to top ⇧

    Slot

    new Slot(name, elementId)

    Slot contains a definition of a publisher ad unit.
    Parameters:
    Name Type Description
    name string the slot name
    elementId string target DOM element id for the slot

    Extends

    Methods (5)

    addBidProvider(bidProvider) → {Slot}

    Add bid provider allocated to the slot.
    Parameters:
    Name Type Description
    bidProvider string the provider name

    addSize(width, height) → {Slot}

    Add a size dimension.
    Parameters:
    Name Type Description
    width string | integer the width dimension
    height string | integer the height dimension

    getParam(name) → {mixed}

    Get an object parameter.
    Parameters:
    Name Type Description
    name string the parameter name
    Inherited From:

    getParamKeys() → {Array.<string>}

    Get all parameter keys.
    Inherited From:

    setParam(name, value) → {PubfoodObject}

    Set an object parameter.
    Parameters:
    Name Type Description
    name string | number | boolean the parameter name
    value mixed the parameter value
    Inherited From:
    back to top ⇧

    AuctionProvider

    new AuctionProvider(auctionDelegate)

    AuctionProvider decorates the AuctionDelegate to implement the publisher ad server requests.
    Parameters:
    Name Type Description
    auctionDelegate AuctionDelegate the delegate object that implements libUri(), init() and refresh()
    Properties:
    Name Type Description
    name string the name of the provider

    Extends

    Methods (6)

    getParam(name) → {mixed}

    Get an object parameter.
    Parameters:
    Name Type Description
    name string the parameter name
    Inherited From:

    getParamKeys() → {Array.<string>}

    Get all parameter keys.
    Inherited From:

    init(targeting, done)

    Initialize a auction provider. The AuctionProvider delegate Javascript and other tag setup is done here.
    Parameters:
    Name Type Description
    targeting array.<TargetingObject> objects with bid targeting
    done auctionDoneCallback a callback to execute on init complete

    libUri() → {string}

    Get the auction provider JavaScript library Uri/Url.

    refresh(targeting, done)

    Refresh for ad slots
    Parameters:
    Name Type Description
    targeting array.<TargetingObject> objects with bid level targeting
    done auctionDoneCallback a callback to execute on init complete

    setParam(name, value) → {PubfoodObject}

    Set an object parameter.
    Parameters:
    Name Type Description
    name string | number | boolean the parameter name
    value mixed the parameter value
    Inherited From:
    back to top ⇧

    BidProvider

    new BidProvider(delegate)

    BidProvider implements bidding partner requests.
    Parameters:
    Name Type Description
    delegate BidDelegate the delegate object that implements libUri(), init() and refresh()
    Properties:
    Name Type Description
    name string the name of the provider

    Methods (11)

    enabled(statusopt) → {boolean}

    Get or set the bid provider enabled status. Bid providers are enabled to be part of auction bid requests by default.

    If a bid provider is not to be included in an auction `init` or `refresh` request,
    the bid provider may be disabled to prevent the provider bid request.

    Parameters:
    Name Type Attributes Description
    status boolean <optional>
    set the enabled status of the provider true|false

    getParam(name) → {mixed}

    Get an object parameter.
    Parameters:
    Name Type Description
    name string the parameter name
    Inherited From:

    getParamKeys() → {Array.<string>}

    Get all parameter keys.
    Inherited From:

    getTimeout() → {number}

    Get the timeout by which a bid provider must call done

    init(slots, pushBid, done)

    Initialize a bid provider. The BidProvider delegate javascript tag and other setup is done here. Delegates to implementation BidDelegate.init
    Parameters:
    Name Type Description
    slots Array.<Slot> slots to bid on
    pushBid pushBidCallback callback that registers the bid; execute callback for each bid object
    done bidDoneCallback a callback to execute on init complete

    libUri(uri) → {string}

    Get or set the provider JavaScript library Uri.
    Parameters:
    Name Type Description
    uri string location Uri

    refresh(slots, pushBid, done)

    Refresh bids for ad slots
    Parameters:
    Name Type Description
    slots Array.<Slot> slots to bid on
    pushBid pushBidCallback callback that registers the bid; execute callback for each bid object
    done bidDoneCallback a callback to execute on init complete

    setParam(name, value) → {PubfoodObject}

    Set an object parameter.
    Parameters:
    Name Type Description
    name string | number | boolean the parameter name
    value mixed the parameter value
    Inherited From:

    sync(loadSyncopt) → {boolean}

    Get or set the provider to load it's library either sync or async.
    Parameters:
    Name Type Attributes Description
    loadSync boolean <optional>
    when true load the library in a sync fashion

    throwErrors(silent) → {boolean}

    Re-throw caught delegate errors. Default: false
    Parameters:
    Name Type Description
    silent boolean if true: re-throw errors in BidDelegate and AuctionDelegate functions
    Inherited From:

    timeout(millis)

    Set the timeout by which a bid provider must call done
    Parameters:
    Name Type Description
    millis number the millisecond duration the bid provider has to push bids
    back to top ⇧

    PubfoodError

    new PubfoodError(message) → {pubfood.PubfoodError}

    Pubfood Error
    Parameters:
    Name Type Description
    message string the error description

    Members (2)

    message

    Properties:
    Name Type Description
    message string The error message

    stack

    Properties:
    Name Type Description
    stack string The error stack trace
    back to top ⇧

    PubfoodEvent

    new PubfoodEvent() → {PubfoodEvent}

    Pubfood event class
    Properties:
    Name Type Description
    auctionId string The auction identifier
    See:
    Example
    AuctionId Format - <random string>:<auction count index>
    iis9xx46a6v2x58e1b:3

    Extends

    • EventEmitter

    Members (2)

    ANNOTATION_TYPE :object

    Event annotation types
    Properties:
    Name Type Description
    FORCED_DONE object Annotation in annotations.forcedDone to indicate that a BID_COMPLETE or AUCTION_COMPLETE event was forced by Pubfood.
    Properties
    Name Type Description
    ERROR 'error' The value of PubfoodEventAnnotation.type in a PubfoodEvent.publish annotations property value
    TIMEOUT 'timeout' The value of PubfoodEventAnnotation.type in a PubfoodEvent.publish annotations property value
    AUCTION_TYPE object Annotation in annotations.auctionType to indicate that a BID_COMPLETE or AUCTION_COMPLETE event was for a particular auction type.
    Properties
    Name Type Description
    INIT 'init' A PubfoodEventAnnotation.type property value
    REFRESH 'refresh' A PubfoodEventAnnotation.type property value
    See:
    Example
    pf.observe('BID_COMPLETE', function(event) {
       var forcedDoneAnnotation = event.annotations.forcedDone;
       var auctionType = event.annotations.auctionType.type;
       if (forcedDoneAnnotation) {
         console.log('BID_COMPLETE, Forced done (' + forcedDoneAnnotation.type + '): ' + event.data + '\n\t' + auctionType  + ', ' + forcedDoneAnnotation.message);
       } else {
         console.log('BID_COMPLETE, Success: ' + event.data + ' - ' + auctionType);
       }
     });
     // BID_COMPLETE, Forced done (error): mock1
     //     refresh, TestError-mock1-BidProvider
     pf.observe('AUCTION_COMPLETE', function(event) {
       var auctionTypeAnnotation = event.annotations.auctionType;
       if (auctionTypeAnnotation && auctionTypeAnnotation.type === 'refresh' ) {
         console.log('### Yes, this was a ' + auctionTypeAnnotation.type + ' AUCTION_COMPLETE ###');
       }
     });
     // ### Yes, this was a refresh AUCTION_COMPLETE ###

    EVENT_TYPE

    Available event types

    Methods (1)

    publish(eventType, data, annotations) → {boolean}

    publish an event
    Parameters:
    Name Type Description
    eventType string The event type
    data * the event data
    annotations object.<string, PubfoodEventAnnotation> Contextual metadata for the event

    Events

    AUCTION_COMPLETE

    The auction has finished running
    Properties:
    Name Type Description
    data object
    Properties
    Name Type Description
    name string the AuctionProvider.name property value
    targeting array.<TargetingObject> targeting data used in the auction
    annotations object event metadata
    Properties
    Name Type Attributes Description
    forcedDone string <optional>
    flag to indicate completion was forced, PubfoodEventAnnotation
    auctionType object the type of auction, PubfoodEventAnnotation
    Example
    annotations.forcedDone && annotations.forcedDone === 'timeout'

    AUCTION_GO

    Start the publisher auction
    Properties:
    Name Type Attributes Description
    data string AuctionProvider.name
    annotations object <optional>
    event metadata
    Properties
    Name Type Description
    auctionType string the type of auction, PubfoodEventAnnotation

    AUCTION_POST_RUN

    Functions dependent on the completed auction can be called
    Properties:
    Name Type Description
    data string AuctionProvider.name

    AUCTION_REFRESH

    The auction was refreshed
    Properties:
    Name Type Description
    data string AuctionProvider.name

    BID_COMPLETE

    Action is complete
    Properties:
    Name Type Description
    data string BidProvider.name
    annotations object.<string, PubfoodEventAnnotation> event metadata
    Properties
    Name Type Attributes Description
    forcedDone string <optional>
    flag to indicate completion was forced, PubfoodEventAnnotation
    auctionType string the type of auction, PubfoodEventAnnotation
    Example
    annotations.forcedDone && annotations.forcedDone === 'timeout'

    BID_START

    Action started.
    e.g BidProvider.init
    Properties:
    Name Type Description
    data string BidProvider.name

    ERROR

    Error event raised
    Properties:
    Name Type Description
    data PubfoodError
    Properties
    Name Type Description
    message string
    stack string

    INVALID

    Invalid operation or data event raise
    Properties:
    Name Type Description
    data string description message

    WARN

    Warn event raised
    Properties:
    Name Type Description
    data string the warning message
    back to top ⇧

    PubfoodObject

    new PubfoodObject()

    PubfoodObject is a base type for pubfood types.

    Methods (3)

    getParam(name) → {mixed}

    Get an object parameter.
    Parameters:
    Name Type Description
    name string the parameter name

    getParamKeys() → {Array.<string>}

    Get all parameter keys.

    setParam(name, value) → {PubfoodObject}

    Set an object parameter.
    Parameters:
    Name Type Description
    name string | number | boolean the parameter name
    value mixed the parameter value
    back to top ⇧

    PubfoodProvider

    new PubfoodProvider()

    Provider is a base type for pubfood provider types.

    Methods (1)

    throwErrors(silent) → {boolean}

    Re-throw caught delegate errors. Default: false
    Parameters:
    Name Type Description
    silent boolean if true: re-throw errors in BidDelegate and AuctionDelegate functions
    back to top ⇧

    Type Definitions

    AuctionRun

    Auction run object structure.
    Properties:
    Name Type Description
    inAuction string | boolean in auction state of false, 'pending' or 'done'
    slots Array.<Slot> slots defined for the auction run
    bids Array.<Bid> bids received for the auction run
    lateBids Array.<Bid> bids received for the auction run
    bidStatus object object keyed by provider name
    Properties
    Name Type Description
    ?providerName? boolean provider name: completed true|false
    targeting Array.<TargetingObject> ad server targeting used in the auction run
    timeoutId number id of bid timeout
    Example
    // bidStatus
    var run = pf.getAuctionRun(1),
        aIsDone = run.bidStatus['bidderA'];
    back to top ⇧

    typeDefs

    Type Definitions

    apiStartCallback(hasErrors, errors)

    Provides information about configuration at start
    Parameters:
    Name Type Description
    hasErrors boolean true if there are any configuration errors
    errors array The list of errors

    AuctionDelegate

    Interface for classes that are delegates for the AuctionProvider decorator..
    Properties:
    Name Type Attributes Description
    name string Auction provider delegate name
    libUri string
    init function Auction provider delegate initial auction request.
    Called at startup.
    Properties
    Name Type Description
    targeting array.<TargetingObject>
    done auctionDoneCallback Callback to execute on done
    refresh function <optional>
    Auction provider delegate refresh auction request.
    Called at startup.
    Properties
    Name Type Description
    targeting array.<TargetingObject>
    done auctionDoneCallback Callback to execute on done
    trigger function <optional>
    Auction provider delegate function to trigger the auction. Default: pubfood.timeout
    Properties
    Name Type Description
    done auctionDoneCallback Callback to initialize the auction provider

    auctionDoneCallback()

    Publisher ad server request processing is done.
    Fires:

    AuctionTriggerFn(start)

    Auction trigger function. A custom function that can be registered with an AuctionMediator that will determine when the publisher ad server request should be initiated. The start callback must be invoked to start the auction.
    Parameters:
    Name Type Description
    start startAuctionCallback callback to initiate the publisher ad server request

    BidDelegate

    Interface for classes that are delegates for the BidProvider decorator.
    Properties:
    Name Type Attributes Description
    name string Bid provider delegate name.
    libUri string <optional>
    location of the delegate JavaScript library/tag.
    init function Initial bid request for BidProvider.init delegate.
    Properties
    Name Type Description
    slots Array.<Slot> slots to bid on
    pushBid pushBidCallback Callback to execute on next bid available
    done bidDoneCallback Callback to execute on done
    refresh function <optional>
    Refresh bids for BidProvider.refresh delegate.
    Properties
    Name Type Description
    slots Array.<Slot> slots to bid on
    pushBid pushBidCallback Callback to execute on next bid available
    done bidDoneCallback Callback to execute on done

    bidDoneCallback()

    Callback to notify of BidProvider has its completed bidding process.
    Fires:

    BidObject

    Bid object structure for the pushBidCallback.
    Properties:
    Name Type Attributes Description
    slot string <optional>
    slot name
    value string <optional>
    publisher adserver targeting bid value. Default: empty string.
    sizes array.array.<number, number> <optional>
    array of sizes for the slot the bid is for
    Properties
    Name Type Description
    0 number width
    1 number height
    targeting object <optional>
    key/value pairs for additional adserver targeting
    label string <optional>
    optional targeting key to use for bid value

    EventObject

    Event object structure for observed events.
    Properties:
    Name Type Description
    auctionId string the auction identifier
    ts string the event timestamp
    type PubfoodEvent#EVENT_TYPE the event type
    data object | string the data payload for the EVENT_TYPE
    annotations object event object metadata. See PubfoodEvent.ANNOTATION_TYPE for spcific annotation properties
    Properties
    Name Type Attributes Description
    auctionType object <optional>
    The auction type annotation, PubfoodEventAnnotation
    forcedDone object <optional>
    The forced done type annotation, PubfoodEventAnnotation
    Example
    AuctionId Format - <random string>:<auction count index>
    iis9xx46a6v2x58e1b:3

    PubfoodConfig

    pubfood constructor configuration
    Properties:
    Name Type Attributes Description
    auctionProviderCbTimeout number <optional>
    The maximum time the auction provider has before calling done() inside the AuctionProvider.init or AuctionProvider.refresh methods
    bidProviderCbTimeout number <optional>
    The maximum time the bid provider has before calling done() inside the BidProvider.init or BidProvider.refresh methods
    randomizeBidRequests boolean <optional>
    Randomize the order in which BidProvider requests are made. Default: false.
    Deprecated:
    • the PubfoodConfig configuration object will be replaced in a future major release. pubfood methods for configuraion properties will be available.

    PubfoodEventAnnotation

    metadata object that is attached to a PubfoodEvent instance to provided additional contextual information.
    Properties:
    Name Type Description
    type string the annotation type, PubfoodEvent#ANNOTATION_TYPE
    message string the description of the annotation

    pushBidCallback(bid)

    Callback to push bids into the list for publisher ad server auction.
    Parameters:
    Name Type Description
    bid BidObject the bid object
    Fires:
    • PubfoodEvent.event:BID_PUSH_NEXT

    reporter(event)

    Custom reporter. A function that handles reporting of PubfoodEvent objects
    Parameters:
    Name Type Description
    event PubfoodEvent the event object

    SlotConfig

    Properties:
    Name Type Attributes Description
    name string name of the slot/ad unit in AuctionProvider system e.g. DFP /accountId/mpu-rt
    elementId string <optional>
    DOM target element id
    sizes array.<number, number> array of slot sizes
    Properties
    Name Type Description
    0 number width slot width
    1 number height slot height
    bidProviders Array.<string> array of BidProvider.name values
    Example
    var slotConfig = {
          name: '/abc/123/rectangle',
          elementId: 'div-left',
          sizes: [ [300, 250], [300, 600] ],
          bidProviders: [
                          'p1', 'p2'
                        ]
        };

    startAuctionCallback()

    Start Publisher Ad Server auction request callback. This is the callback passed into the AuctionTriggerFn.

    TargetingObject

    Key value targeting for a specific slot or the page.
    Properties:
    Name Type Attributes Description
    type string <optional>
    the targeting level [slot|page]
    name string <optional>
    the Slot.name
    id string <optional>
    if targeting object is for a slot, the generated identifier of the slot
    elementId string <optional>
    the target DOM element id
    sizes array.<number, number> <optional>
    array of slot sizes
    targeting object.<string, string> object containing key/value pair targeting
    bids array.<object> source bids for the targeting object
    Deprecated:
    • Property, TargetingObject.type [slot|page].
      Use the existence of "TargetingObject.name" to detect targeting is slot-level

    TransformDelegate(bids, params) → {Array.<Bid>|null}

    Function delegates for the TransformOperator decorator.
    Parameters:
    Name Type Description
    bids Array.<Bid> array of bids to transform
    params object parameters as required by delegate function. Future use.
    Example
    var transformDelegate = function(bids, params) { console.log('operate on bids'); };
    back to top ⇧

    util

    Methods (3)

    (static) asType() → {string}

    Get the type name of an object. For behavior,
    See:

    (static) mergeToObject(target, source) → {object}

    Merge two objects. Where source and target share the same keys, source overwrites target key.
    Parameters:
    Name Type Description
    target object the target object
    source object the source object

    (static) randomize(array) → {array}

    Randomize the position of items in an array. The original array will be both changed in place and returned. The algorithm implemented here is a Fisher–Yates Shuffle which is unbiased.
    Parameters:
    Name Type Description
    array array that should be permuted in place and returned.
    See: