Socket
Socket
Sign inDemoInstall

@blackglory/structures

Package Overview
Dependencies
1
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

lib/es2015/hash-set.d.ts

7

CHANGELOG.md

@@ -5,2 +5,9 @@ # Changelog

### [0.1.1](https://github.com/BlackGlory/structures/compare/v0.1.0...v0.1.1) (2020-12-19)
### Features
* add HashSet ([3cd0b59](https://github.com/BlackGlory/structures/commit/3cd0b59a5a06eeb9c99e23d634b2116eab3de090))
## 0.1.0 (2020-12-19)

@@ -7,0 +14,0 @@

@@ -53,3 +53,31 @@ (function (global, factory) {

var _map;
class HashSet {
constructor(hash) {
this.hash = hash;
_map.set(this, new Map());
}
add(value) {
__classPrivateFieldGet(this, _map).set(this.hash(value), value);
return this;
}
delete(value) {
return __classPrivateFieldGet(this, _map).delete(this.hash(value));
}
has(value) {
return __classPrivateFieldGet(this, _map).has(this.hash(value));
}
clear() {
__classPrivateFieldGet(this, _map).clear();
}
get size() {
return __classPrivateFieldGet(this, _map).size;
}
[(_map = new WeakMap(), Symbol.iterator)]() {
return __classPrivateFieldGet(this, _map).values();
}
}
exports.EmptyQueueError = EmptyQueueError;
exports.HashSet = HashSet;
exports.Queue = Queue;

@@ -56,0 +84,0 @@

2

dist/es2015/index.umd.min.js

@@ -15,3 +15,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@blackglory/errors")):"function"==typeof define&&define.amd?define(["exports","@blackglory/errors"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Structures={},e.errors)}(this,(function(e,t){"use strict";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function r(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}var s;s=new WeakMap;class o extends t.CustomError{constructor(){super("Queue is empty.")}}e.EmptyQueueError=o,e.Queue=class{constructor(){s.set(this,[])}enqueue(...e){r(this,s).push(...e)}dequeue(){if(0===this.size)throw new o;return r(this,s).shift()}get size(){return r(this,s).length}},Object.defineProperty(e,"__esModule",{value:!0})}));
***************************************************************************** */function s(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}var r,i;r=new WeakMap;class n extends t.CustomError{constructor(){super("Queue is empty.")}}class o{constructor(e){this.hash=e,i.set(this,new Map)}add(e){return s(this,i).set(this.hash(e),e),this}delete(e){return s(this,i).delete(this.hash(e))}has(e){return s(this,i).has(this.hash(e))}clear(){s(this,i).clear()}get size(){return s(this,i).size}[(i=new WeakMap,Symbol.iterator)](){return s(this,i).values()}}e.EmptyQueueError=n,e.HashSet=o,e.Queue=class{constructor(){r.set(this,[])}enqueue(...e){s(this,r).push(...e)}dequeue(){if(0===this.size)throw new n;return s(this,r).shift()}get size(){return s(this,r).length}},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map

@@ -53,3 +53,31 @@ (function (global, factory) {

var _map;
class HashSet {
constructor(hash) {
this.hash = hash;
_map.set(this, new Map());
}
add(value) {
__classPrivateFieldGet(this, _map).set(this.hash(value), value);
return this;
}
delete(value) {
return __classPrivateFieldGet(this, _map).delete(this.hash(value));
}
has(value) {
return __classPrivateFieldGet(this, _map).has(this.hash(value));
}
clear() {
__classPrivateFieldGet(this, _map).clear();
}
get size() {
return __classPrivateFieldGet(this, _map).size;
}
[(_map = new WeakMap(), Symbol.iterator)]() {
return __classPrivateFieldGet(this, _map).values();
}
}
exports.EmptyQueueError = EmptyQueueError;
exports.HashSet = HashSet;
exports.Queue = Queue;

@@ -56,0 +84,0 @@

@@ -15,3 +15,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@blackglory/errors")):"function"==typeof define&&define.amd?define(["exports","@blackglory/errors"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Structures={},e.errors)}(this,(function(e,t){"use strict";

PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */function r(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}var s;s=new WeakMap;class o extends t.CustomError{constructor(){super("Queue is empty.")}}e.EmptyQueueError=o,e.Queue=class{constructor(){s.set(this,[])}enqueue(...e){r(this,s).push(...e)}dequeue(){if(0===this.size)throw new o;return r(this,s).shift()}get size(){return r(this,s).length}},Object.defineProperty(e,"__esModule",{value:!0})}));
***************************************************************************** */function s(e,t){if(!t.has(e))throw new TypeError("attempted to get private field on non-instance");return t.get(e)}var r,i;r=new WeakMap;class n extends t.CustomError{constructor(){super("Queue is empty.")}}class o{constructor(e){this.hash=e,i.set(this,new Map)}add(e){return s(this,i).set(this.hash(e),e),this}delete(e){return s(this,i).delete(this.hash(e))}has(e){return s(this,i).has(this.hash(e))}clear(){s(this,i).clear()}get size(){return s(this,i).size}[(i=new WeakMap,Symbol.iterator)](){return s(this,i).values()}}e.EmptyQueueError=n,e.HashSet=o,e.Queue=class{constructor(){r.set(this,[])}enqueue(...e){s(this,r).push(...e)}dequeue(){if(0===this.size)throw new n;return s(this,r).shift()}get size(){return s(this,r).length}},Object.defineProperty(e,"__esModule",{value:!0})}));
//# sourceMappingURL=index.umd.min.js.map
export * from './queue';
export * from './hash-set';

@@ -14,2 +14,3 @@ "use strict";

__exportStar(require("./queue"), exports);
__exportStar(require("./hash-set"), exports);
//# sourceMappingURL=index.js.map
export * from './queue';
export * from './hash-set';

@@ -14,2 +14,3 @@ "use strict";

__exportStar(require("./queue"), exports);
__exportStar(require("./hash-set"), exports);
//# sourceMappingURL=index.js.map
{
"name": "@blackglory/structures",
"version": "0.1.0",
"version": "0.1.1",
"description": "",

@@ -5,0 +5,0 @@ "files": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc