sjl.js
function () {
            var self = this,
                LIFO_modifier = self._LIFO_modifier;

            // If already sorted return self
            if (self._sorted) {
                return self;
            }

            // Sort entries
            self._values.sort(function (a, b) {
                    var retVal;
                    if (a.priority === b.priority) {
                        retVal = a.serial > b.serial;
                    }
                    else {
                        retVal = a.priority > b.priority;
                    }
                    return (retVal ? -1 : 1) * LIFO_modifier;
                })
                .forEach(function (item, index) {
                    self._keys[index] = item.key;
                    item.serial = index;
                });

            // Set sorted to true and pointer to 0
            self._sorted = true;
            self.pointer = 0;
            return self;
        }
function () {
            var self = this,
                LIFO_modifier = self._LIFO_modifier;

            // If already sorted return self
            if (self._sorted) {
                return self;
            }

            // Sort entries
            self._values.sort(function (a, b) {
                    var retVal;
                    if (a.priority === b.priority) {
                        retVal = a.serial > b.serial;
                    }
                    else {
                        retVal = a.priority > b.priority;
                    }
                    return (retVal ? -1 : 1) * LIFO_modifier;
                })
                .forEach(function (item, index) {
                    self._keys[index] = item.key;
                    item.serial = index;
                });

            // Set sorted to true and pointer to 0
            self._sorted = true;
            self.pointer = 0;
            return self;
        }
Non api specific functions ------------------------------------------- Own Api functions ------------------------------------------- 
Sorts priority list items based on `LIFO` flag.
@method sjl.stdlib.PriorityList#sort
@returns {sjl.stdlib.PriorityList} - Returns self.