New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@thi.ng/heaps

Package Overview
Dependencies
Maintainers
1
Versions
191
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@thi.ng/heaps - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

8

CHANGELOG.md

@@ -6,2 +6,10 @@ # Change Log

## [1.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/heaps@1.1.4...@thi.ng/heaps@1.1.5) (2019-11-09)
**Note:** Version bump only for package @thi.ng/heaps
## [1.1.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/heaps@1.1.3...@thi.ng/heaps@1.1.4) (2019-09-21)

@@ -8,0 +16,0 @@

2

heap.d.ts

@@ -25,3 +25,3 @@ import { Comparator, ICopy, IEmpty, ILength, IStack } from "@thi.ng/api";

constructor(values?: Iterable<T> | null, opts?: HeapOpts<T>);
[Symbol.iterator](): IterableIterator<T>;
[Symbol.iterator](): Generator<T, void, undefined>;
readonly length: number;

@@ -28,0 +28,0 @@ copy(): Heap<T>;

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@thi.ng/compare")):"function"==typeof define&&define.amd?define(["exports","@thi.ng/compare"],t):t(((e=e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.heaps={}),e.thi.ng.compare)}(this,function(e,t){"use strict";class s{constructor(e,s){s=Object.assign({compare:t.compare},s),this.compare=s.compare,this.values=[],e&&this.into(e)}static parentIndex(e){return e>0?e-1>>1:-1}static childIndex(e){return e>=0?1+(e<<1):-1}*[Symbol.iterator](){yield*this.min()}get length(){return this.values.length}copy(){const e=this.empty();return e.values=this.values.slice(),e}clear(){this.values.length=0}empty(){return new s(null,{compare:this.compare})}peek(){return this.values[0]}push(e){return this.values.push(e),this.percolateUp(this.values.length-1),this}pop(){const e=this.values,t=e.pop();let s;return e.length>0?(s=e[0],e[0]=t,this.percolateDown(0)):s=t,s}pushPop(e,t=this.values){const s=t[0];return t.length>0&&this.compare(s,e)<0&&(t[0]=e,e=s,this.percolateDown(0,t)),e}into(e){for(let t of e)this.push(t);return this}pushPopAll(e){let t;for(let s of e)t=this.pushPop(s);return t}replaceHead(e){const t=this.values[0];return this.values[0]=e,this.percolateDown(0),t}heapify(e=this.values){for(var t=e.length-1>>1;t>=0;t--)this.percolateDown(t,e)}max(e=this.values.length){const t=this.values,s=this.compare,r=t.slice(0,e);if(!e)return r;this.heapify(r);for(let s=t.length;e<s;e++)this.pushPop(t[e],r);return r.sort((e,t)=>s(t,e))}min(e=this.values.length){const t=this.values,s=this.compare,n=t.slice(0,e).sort(s);if(!e)return n;let i,h=n[e-1];for(let o=e,l=t.length;o<l;o++)s(i=t[o],h)<0&&(n.splice(r(i,n,0,e,s),0,i),n.pop(),h=n[e-1]);return n}parent(e){return(e=s.parentIndex(e))>=0?this.values[e]:void 0}children(e){e=s.childIndex(e);const t=this.values,r=t.length;if(!(e>=r))return e===r-1?[t[e]]:[t[e],t[e+1]]}leaves(){const e=this.values;return e.length?e.slice(s.parentIndex(e.length-1)+1):[]}percolateUp(e,t=this.values){const s=t[e],r=this.compare;for(;e>0;){const n=e-1>>1,i=t[n];if(r(s,i)>=0)break;t[n]=s,t[e]=i,e=n}}percolateDown(e,t=this.values){const s=t.length,r=t[e],n=this.compare;let i=1+(e<<1);for(;i<s;){const h=i+1;if(h<s&&n(t[i],t[h])>=0&&(i=h),!(n(t[i],r)<0))break;t[e]=t[i],i=1+((e=i)<<1)}t[e]=r}}const r=(e,t,s,r,n)=>{let i;for(;s<r;)n(e,t[i=s+r>>>1])<0?r=i:s=i+1;return s};class n extends s{constructor(e,s){super(void 0,Object.assign({compare:t.compare},s)),this.d=s&&s.d||4,this.values=[],e&&this.into(e)}static parentIndex(e,t=4){return e>0?(e-1)/t|0:-1}static childIndex(e,t=4){return e>=0?e*t+1:-1}copy(){return super.copy()}empty(){return new n(null,{compare:this.compare,d:this.d})}parent(e){return(e=n.parentIndex(e,this.d))>=0?this.values[e]:void 0}children(e){e=n.childIndex(e,this.d);const t=this.values;if(!(e>=t.length))return t.slice(e,e+this.d)}leaves(){const e=this.values;return e.length?e.slice(n.parentIndex(e.length-1,this.d)+1):[]}heapify(e=this.values){for(var t=(e.length-1)/this.d|0;t>=0;t--)this.percolateDown(t,e)}percolateUp(e,t=this.values){const s=t[e],r=this.d,n=this.compare;for(;e>0;){const i=(e-1)/r|0,h=t[i];if(n(s,h)>=0)break;t[i]=s,t[e]=h,e=i}}percolateDown(e,t=this.values){const s=t.length,r=this.d,n=t[e],i=this.compare;let h,o=e*r+1;for(;o<s;){h=o;for(let e=o+1,n=o+r;e<n;e++)e<s&&i(t[e],t[h])<0&&(h=e);if(!(i(t[h],n)<0))break;t[e]=t[h],o=(e=h)*r+1}t[e]=n}}e.DHeap=n,e.Heap=s,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@thi.ng/compare")):"function"==typeof define&&define.amd?define(["exports","@thi.ng/compare"],t):t(((e=e||self).thi=e.thi||{},e.thi.ng=e.thi.ng||{},e.thi.ng.heaps={}),e.thi.ng.compare)}(this,(function(e,t){"use strict";class s{constructor(e,s){s=Object.assign({compare:t.compare},s),this.compare=s.compare,this.values=[],e&&this.into(e)}static parentIndex(e){return e>0?e-1>>1:-1}static childIndex(e){return e>=0?1+(e<<1):-1}*[Symbol.iterator](){yield*this.min()}get length(){return this.values.length}copy(){const e=this.empty();return e.values=this.values.slice(),e}clear(){this.values.length=0}empty(){return new s(null,{compare:this.compare})}peek(){return this.values[0]}push(e){return this.values.push(e),this.percolateUp(this.values.length-1),this}pop(){const e=this.values,t=e.pop();let s;return e.length>0?(s=e[0],e[0]=t,this.percolateDown(0)):s=t,s}pushPop(e,t=this.values){const s=t[0];return t.length>0&&this.compare(s,e)<0&&(t[0]=e,e=s,this.percolateDown(0,t)),e}into(e){for(let t of e)this.push(t);return this}pushPopAll(e){let t;for(let s of e)t=this.pushPop(s);return t}replaceHead(e){const t=this.values[0];return this.values[0]=e,this.percolateDown(0),t}heapify(e=this.values){for(var t=e.length-1>>1;t>=0;t--)this.percolateDown(t,e)}max(e=this.values.length){const t=this.values,s=this.compare,r=t.slice(0,e);if(!e)return r;this.heapify(r);for(let s=t.length;e<s;e++)this.pushPop(t[e],r);return r.sort((e,t)=>s(t,e))}min(e=this.values.length){const t=this.values,s=this.compare,n=t.slice(0,e).sort(s);if(!e)return n;let i,h=n[e-1];for(let o=e,l=t.length;o<l;o++)s(i=t[o],h)<0&&(n.splice(r(i,n,0,e,s),0,i),n.pop(),h=n[e-1]);return n}parent(e){return(e=s.parentIndex(e))>=0?this.values[e]:void 0}children(e){e=s.childIndex(e);const t=this.values,r=t.length;if(!(e>=r))return e===r-1?[t[e]]:[t[e],t[e+1]]}leaves(){const e=this.values;return e.length?e.slice(s.parentIndex(e.length-1)+1):[]}percolateUp(e,t=this.values){const s=t[e],r=this.compare;for(;e>0;){const n=e-1>>1,i=t[n];if(r(s,i)>=0)break;t[n]=s,t[e]=i,e=n}}percolateDown(e,t=this.values){const s=t.length,r=t[e],n=this.compare;let i=1+(e<<1);for(;i<s;){const h=i+1;if(h<s&&n(t[i],t[h])>=0&&(i=h),!(n(t[i],r)<0))break;t[e]=t[i],i=1+((e=i)<<1)}t[e]=r}}const r=(e,t,s,r,n)=>{let i;for(;s<r;)n(e,t[i=s+r>>>1])<0?r=i:s=i+1;return s};class n extends s{constructor(e,s){super(void 0,Object.assign({compare:t.compare},s)),this.d=s&&s.d||4,this.values=[],e&&this.into(e)}static parentIndex(e,t=4){return e>0?(e-1)/t|0:-1}static childIndex(e,t=4){return e>=0?e*t+1:-1}copy(){return super.copy()}empty(){return new n(null,{compare:this.compare,d:this.d})}parent(e){return(e=n.parentIndex(e,this.d))>=0?this.values[e]:void 0}children(e){e=n.childIndex(e,this.d);const t=this.values;if(!(e>=t.length))return t.slice(e,e+this.d)}leaves(){const e=this.values;return e.length?e.slice(n.parentIndex(e.length-1,this.d)+1):[]}heapify(e=this.values){for(var t=(e.length-1)/this.d|0;t>=0;t--)this.percolateDown(t,e)}percolateUp(e,t=this.values){const s=t[e],r=this.d,n=this.compare;for(;e>0;){const i=(e-1)/r|0,h=t[i];if(n(s,h)>=0)break;t[i]=s,t[e]=h,e=i}}percolateDown(e,t=this.values){const s=t.length,r=this.d,n=t[e],i=this.compare;let h,o=e*r+1;for(;o<s;){h=o;for(let e=o+1,n=o+r;e<n;e++)e<s&&i(t[e],t[h])<0&&(h=e);if(!(i(t[h],n)<0))break;t[e]=t[h],o=(e=h)*r+1}t[e]=n}}e.DHeap=n,e.Heap=s,Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "@thi.ng/heaps",
"version": "1.1.4",
"version": "1.1.5",
"description": "Generic binary heap & d-ary heap implementations with customizable ordering",

@@ -32,8 +32,8 @@ "module": "./index.js",

"nyc": "^14.0.0",
"typedoc": "^0.14.2",
"typescript": "^3.5.3"
"typedoc": "^0.15.0",
"typescript": "^3.6.4"
},
"dependencies": {
"@thi.ng/api": "^6.4.0",
"@thi.ng/compare": "^1.0.9"
"@thi.ng/api": "^6.5.0",
"@thi.ng/compare": "^1.0.10"
},

@@ -53,3 +53,3 @@ "keywords": [

"sideEffects": false,
"gitHead": "5f865588e37a27ceb46484c24fce4d59a0637f90"
"gitHead": "97add769f24aa32a1a5e13c5c941605e1b9eb569"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc