working rss feed to nostr publish
This commit is contained in:
+243
@@ -0,0 +1,243 @@
|
||||
"use strict";
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = function (d, b) {
|
||||
extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
||||
return extendStatics(d, b);
|
||||
};
|
||||
return function (d, b) {
|
||||
if (typeof b !== "function" && b !== null)
|
||||
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __read = (this && this.__read) || function (o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
};
|
||||
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
||||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
||||
if (ar || !(i in from)) {
|
||||
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
||||
ar[i] = from[i];
|
||||
}
|
||||
}
|
||||
return to.concat(ar || Array.prototype.slice.call(from));
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.HashSet = void 0;
|
||||
//================================================================
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std
|
||||
*/
|
||||
//================================================================
|
||||
var UniqueSet_1 = require("../base/container/UniqueSet");
|
||||
var IHashContainer_1 = require("../internal/container/associative/IHashContainer");
|
||||
var SetElementList_1 = require("../internal/container/associative/SetElementList");
|
||||
var SetHashBuckets_1 = require("../internal/hash/SetHashBuckets");
|
||||
var Pair_1 = require("../utility/Pair");
|
||||
/**
|
||||
* Unique-key Set based on Hash buckets.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
var HashSet = /** @class */ (function (_super) {
|
||||
__extends(HashSet, _super);
|
||||
function HashSet() {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
var _this = _super.call(this, function (thisArg) { return new SetElementList_1.SetElementList(thisArg); }) || this;
|
||||
IHashContainer_1.IHashContainer.construct.apply(IHashContainer_1.IHashContainer, __spreadArray([_this,
|
||||
HashSet,
|
||||
function (hash, pred) {
|
||||
_this.buckets_ = new SetHashBuckets_1.SetHashBuckets(_this, hash, pred);
|
||||
}], __read(args), false));
|
||||
return _this;
|
||||
}
|
||||
/* ---------------------------------------------------------
|
||||
ASSIGN & CLEAR
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
HashSet.prototype.clear = function () {
|
||||
this.buckets_.clear();
|
||||
_super.prototype.clear.call(this);
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
HashSet.prototype.swap = function (obj) {
|
||||
var _a, _b;
|
||||
// SWAP CONTENTS
|
||||
_a = __read([obj.data_, this.data_], 2), this.data_ = _a[0], obj.data_ = _a[1];
|
||||
SetElementList_1.SetElementList._Swap_associative(this.data_, obj.data_);
|
||||
// SWAP BUCKETS
|
||||
SetHashBuckets_1.SetHashBuckets._Swap_source(this.buckets_, obj.buckets_);
|
||||
_b = __read([obj.buckets_, this.buckets_], 2), this.buckets_ = _b[0], obj.buckets_ = _b[1];
|
||||
};
|
||||
/* =========================================================
|
||||
ACCESSORS
|
||||
- MEMBER
|
||||
- HASH
|
||||
============================================================
|
||||
MEMBER
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
HashSet.prototype.find = function (key) {
|
||||
return this.buckets_.find(key);
|
||||
};
|
||||
HashSet.prototype.begin = function (index) {
|
||||
if (index === void 0) { index = null; }
|
||||
if (index === null)
|
||||
return _super.prototype.begin.call(this);
|
||||
else
|
||||
return this.buckets_.at(index)[0];
|
||||
};
|
||||
HashSet.prototype.end = function (index) {
|
||||
if (index === void 0) { index = null; }
|
||||
if (index === null)
|
||||
return _super.prototype.end.call(this);
|
||||
else {
|
||||
var bucket = this.buckets_.at(index);
|
||||
return bucket[bucket.length - 1].next();
|
||||
}
|
||||
};
|
||||
HashSet.prototype.rbegin = function (index) {
|
||||
if (index === void 0) { index = null; }
|
||||
return this.end(index).reverse();
|
||||
};
|
||||
HashSet.prototype.rend = function (index) {
|
||||
if (index === void 0) { index = null; }
|
||||
return this.begin(index).reverse();
|
||||
};
|
||||
/* ---------------------------------------------------------
|
||||
HASH
|
||||
--------------------------------------------------------- */
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
HashSet.prototype.bucket_count = function () {
|
||||
return this.buckets_.length();
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
HashSet.prototype.bucket_size = function (n) {
|
||||
return this.buckets_.at(n).length;
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
HashSet.prototype.load_factor = function () {
|
||||
return this.buckets_.load_factor();
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
HashSet.prototype.hash_function = function () {
|
||||
return this.buckets_.hash_function();
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
HashSet.prototype.key_eq = function () {
|
||||
return this.buckets_.key_eq();
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
HashSet.prototype.bucket = function (key) {
|
||||
return this.hash_function()(key) % this.buckets_.length();
|
||||
};
|
||||
HashSet.prototype.max_load_factor = function (z) {
|
||||
if (z === void 0) { z = null; }
|
||||
return this.buckets_.max_load_factor(z);
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
HashSet.prototype.reserve = function (n) {
|
||||
this.buckets_.reserve(n);
|
||||
};
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
HashSet.prototype.rehash = function (n) {
|
||||
this.buckets_.rehash(n);
|
||||
};
|
||||
/* =========================================================
|
||||
ELEMENTS I/O
|
||||
- INSERT
|
||||
- POST-PROCESS
|
||||
- SWAP
|
||||
============================================================
|
||||
INSERT
|
||||
--------------------------------------------------------- */
|
||||
HashSet.prototype._Insert_by_key = function (key) {
|
||||
// TEST WHETHER EXIST
|
||||
var it = this.find(key);
|
||||
if (it.equals(this.end()) === false)
|
||||
return new Pair_1.Pair(it, false);
|
||||
// INSERT
|
||||
this.data_.push(key);
|
||||
it = it.prev();
|
||||
// POST-PROCESS
|
||||
this._Handle_insert(it, it.next());
|
||||
return new Pair_1.Pair(it, true);
|
||||
};
|
||||
HashSet.prototype._Insert_by_hint = function (hint, key) {
|
||||
// FIND DUPLICATED KEY
|
||||
var it = this.find(key);
|
||||
if (it.equals(this.end()) === true) {
|
||||
// INSERT
|
||||
it = this.data_.insert(hint, key);
|
||||
// POST-PROCESS
|
||||
this._Handle_insert(it, it.next());
|
||||
}
|
||||
return it;
|
||||
};
|
||||
/* ---------------------------------------------------------
|
||||
POST-PROCESS
|
||||
--------------------------------------------------------- */
|
||||
HashSet.prototype._Handle_insert = function (first, last) {
|
||||
for (; !first.equals(last); first = first.next())
|
||||
this.buckets_.insert(first);
|
||||
};
|
||||
HashSet.prototype._Handle_erase = function (first, last) {
|
||||
for (; !first.equals(last); first = first.next())
|
||||
this.buckets_.erase(first);
|
||||
};
|
||||
return HashSet;
|
||||
}(UniqueSet_1.UniqueSet));
|
||||
exports.HashSet = HashSet;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
(function (HashSet) {
|
||||
// BODY
|
||||
HashSet.Iterator = SetElementList_1.SetElementList.Iterator;
|
||||
HashSet.ReverseIterator = SetElementList_1.SetElementList.ReverseIterator;
|
||||
})(HashSet = exports.HashSet || (exports.HashSet = {}));
|
||||
exports.HashSet = HashSet;
|
||||
//# sourceMappingURL=HashSet.js.map
|
||||
Reference in New Issue
Block a user