Skip to content

Commit

Permalink
Stable Version 4.3.2.
Browse files Browse the repository at this point in the history
Fixes #191
  • Loading branch information
jmdobry committed Jul 10, 2015
1 parent ac58584 commit a320166
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 90 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
##### 4.3.2 10 July 2015

- #191 - yabh issue with ie8

##### 4.3.1 07 July 2015

- #190 - 4.3 breaks phantomJS tests
Expand Down
148 changes: 64 additions & 84 deletions dist/angular-cache.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*!
* angular-cache
* @version 4.3.1 - Homepage <http://jmdobry.github.io/angular-cache/>
* @version 4.3.2 - Homepage <http://jmdobry.github.io/angular-cache/>
* @author Jason Dobry <[email protected]>
* @copyright (c) 2013-2015 Jason Dobry
* @license MIT <https://github.com/jmdobry/angular-cache/blob/master/LICENSE>
Expand Down Expand Up @@ -108,7 +108,7 @@ return /******/ (function(modules) { // webpackBootstrap

/*!
* cachefactory
* @version 1.0.2 - Homepage <http://jmdobry.github.io/cachefactory/>
* @version 1.1.0 - Homepage <http://jmdobry.github.io/cachefactory/>
* @author Jason Dobry <[email protected]>
* @copyright (c) 2013-2015 Jason Dobry
* @license MIT <https://github.com/jmdobry/cachefactory/blob/master/LICENSE>
Expand Down Expand Up @@ -1085,7 +1085,7 @@ return /******/ (function(modules) { // webpackBootstrap

/*!
* yabh
* @version 1.0.1 - Homepage <http://jmdobry.github.io/yabh/>
* @version 1.1.0 - Homepage <http://jmdobry.github.io/yabh/>
* @author Jason Dobry <[email protected]>
* @copyright (c) 2015 Jason Dobry
* @license MIT <https://github.com/jmdobry/yabh/blob/master/LICENSE>
Expand Down Expand Up @@ -1148,13 +1148,6 @@ return /******/ (function(modules) { // webpackBootstrap
/* 0 */
/***/ function(module, exports, __webpack_require__) {

var _classCallCheck = function (instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } };

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; }; })();

Object.defineProperty(exports, '__esModule', {
value: true
});
/**
* @method bubbleUp
* @param {array} heap The heap.
Expand Down Expand Up @@ -1223,88 +1216,75 @@ return /******/ (function(modules) { // webpackBootstrap
}
};

var BinaryHeap = (function () {
function BinaryHeap(weightFunc, compareFunc) {
_classCallCheck(this, BinaryHeap);
function BinaryHeap(weightFunc, compareFunc) {
if (!weightFunc) {
weightFunc = function (x) {
return x;
};
}
if (!compareFunc) {
compareFunc = function (x, y) {
return x === y;
};
}
if (typeof weightFunc !== 'function') {
throw new Error('BinaryHeap([weightFunc][, compareFunc]): "weightFunc" must be a function!');
}
if (typeof compareFunc !== 'function') {
throw new Error('BinaryHeap([weightFunc][, compareFunc]): "compareFunc" must be a function!');
}
this.weightFunc = weightFunc;
this.compareFunc = compareFunc;
this.heap = [];
}

var BHProto = BinaryHeap.prototype;

if (!weightFunc) {
weightFunc = function (x) {
return x;
};
}
if (!compareFunc) {
compareFunc = function (x, y) {
return x === y;
};
}
if (typeof weightFunc !== 'function') {
throw new Error('BinaryHeap([weightFunc][, compareFunc]): "weightFunc" must be a function!');
}
if (typeof compareFunc !== 'function') {
throw new Error('BinaryHeap([weightFunc][, compareFunc]): "compareFunc" must be a function!');
}
this.weightFunc = weightFunc;
this.compareFunc = compareFunc;
this.heap = [];
BHProto.push = function (node) {
this.heap.push(node);
bubbleUp(this.heap, this.weightFunc, this.heap.length - 1);
};

BHProto.peek = function () {
return this.heap[0];
};

BHProto.pop = function () {
var front = this.heap[0];
var end = this.heap.pop();
if (this.heap.length > 0) {
this.heap[0] = end;
bubbleDown(this.heap, this.weightFunc, 0);
}
return front;
};

_createClass(BinaryHeap, [{
key: 'push',
value: function push(node) {
this.heap.push(node);
bubbleUp(this.heap, this.weightFunc, this.heap.length - 1);
}
}, {
key: 'peek',
value: function peek() {
return this.heap[0];
}
}, {
key: 'pop',
value: function pop() {
var front = this.heap[0];
BHProto.remove = function (node) {
var length = this.heap.length;
for (var i = 0; i < length; i++) {
if (this.compareFunc(this.heap[i], node)) {
var removed = this.heap[i];
var end = this.heap.pop();
if (this.heap.length > 0) {
this.heap[0] = end;
bubbleDown(this.heap, this.weightFunc, 0);
}
return front;
}
}, {
key: 'remove',
value: function remove(node) {
var length = this.heap.length;
for (var i = 0; i < length; i++) {
if (this.compareFunc(this.heap[i], node)) {
var removed = this.heap[i];
var end = this.heap.pop();
if (i !== length - 1) {
this.heap[i] = end;
bubbleUp(this.heap, this.weightFunc, i);
bubbleDown(this.heap, this.weightFunc, i);
}
return removed;
}
if (i !== length - 1) {
this.heap[i] = end;
bubbleUp(this.heap, this.weightFunc, i);
bubbleDown(this.heap, this.weightFunc, i);
}
return null;
return removed;
}
}, {
key: 'removeAll',
value: function removeAll() {
this.heap = [];
}
}, {
key: 'size',
value: function size() {
return this.heap.length;
}
}]);
}
return null;
};

return BinaryHeap;
})();
BHProto.removeAll = function () {
this.heap = [];
};

BHProto.size = function () {
return this.heap.length;
};

exports['default'] = BinaryHeap;
module.exports = exports['default'];
module.exports = BinaryHeap;

/***/ }
/******/ ])
Expand Down
Loading

0 comments on commit a320166

Please sign in to comment.