working rss feed to nostr publish
This commit is contained in:
+31
@@ -0,0 +1,31 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std
|
||||
*/
|
||||
/**
|
||||
* Interface for comparison.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
export interface IComparable<T> {
|
||||
/**
|
||||
* Test whether equal to some object.
|
||||
*
|
||||
* @param obj The object to compare.
|
||||
* @return Whether equal or not.
|
||||
*/
|
||||
equals(obj: T): boolean;
|
||||
/**
|
||||
* Test whether less than some object.
|
||||
*
|
||||
* @param obj The object to compare.
|
||||
* @return Whether less or not.
|
||||
*/
|
||||
less(obj: T): boolean;
|
||||
/**
|
||||
* Get hash code.
|
||||
*
|
||||
* @return The hash code.
|
||||
*/
|
||||
hashCode(): number;
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=IComparable.js.map
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std
|
||||
*/
|
||||
/**
|
||||
* Pointer referencing value.
|
||||
*
|
||||
* @author Jeongho Nam - https://github.com/samchon
|
||||
*/
|
||||
export interface IPointer<T> {
|
||||
/**
|
||||
* Reference of the value.
|
||||
*/
|
||||
value: T;
|
||||
}
|
||||
export declare namespace IPointer {
|
||||
/**
|
||||
* Inference of value type.
|
||||
*/
|
||||
type ValueType<Pointer extends IPointer<any>> = Pointer extends IPointer<infer T> ? T : unknown;
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
//# sourceMappingURL=IPointer.js.map
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std
|
||||
*/
|
||||
export declare function logical_and<T>(x: T, y: T): boolean;
|
||||
export declare function logical_or<T>(x: T, y: T): boolean;
|
||||
export declare function logical_not<T>(x: T): boolean;
|
||||
export declare function bit_and(x: number, y: number): number;
|
||||
export declare function bit_or(x: number, y: number): number;
|
||||
export declare function bit_xor(x: number, y: number): number;
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.bit_xor = exports.bit_or = exports.bit_and = exports.logical_not = exports.logical_or = exports.logical_and = void 0;
|
||||
//================================================================
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std
|
||||
*/
|
||||
//================================================================
|
||||
function logical_and(x, y) {
|
||||
return !!x && !!y;
|
||||
}
|
||||
exports.logical_and = logical_and;
|
||||
function logical_or(x, y) {
|
||||
return !!x || !!y;
|
||||
}
|
||||
exports.logical_or = logical_or;
|
||||
function logical_not(x) {
|
||||
return !x;
|
||||
}
|
||||
exports.logical_not = logical_not;
|
||||
function bit_and(x, y) {
|
||||
return x & y;
|
||||
}
|
||||
exports.bit_and = bit_and;
|
||||
function bit_or(x, y) {
|
||||
return x | y;
|
||||
}
|
||||
exports.bit_or = bit_or;
|
||||
function bit_xor(x, y) {
|
||||
return x ^ y;
|
||||
}
|
||||
exports.bit_xor = bit_xor;
|
||||
//# sourceMappingURL=bit_operations.js.map
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
/**
|
||||
* Test whether two arguments are equal.
|
||||
*
|
||||
* @param x The first argument to compare.
|
||||
* @param y The second argument to compare.
|
||||
* @return Whether two arguments are equal or not.
|
||||
*/
|
||||
export declare function equal_to<T>(x: T, y: T): boolean;
|
||||
/**
|
||||
* Test whether two arguments are not equal.
|
||||
*
|
||||
* @param x The first argument to compare.
|
||||
* @param y The second argument to compare.
|
||||
* @return Returns `true`, if two arguments are not equal, otherwise `false`.
|
||||
*/
|
||||
export declare function not_equal_to<T>(x: T, y: T): boolean;
|
||||
/**
|
||||
* Test whether *x* is less than *y*.
|
||||
*
|
||||
* @param x The first argument to compare.
|
||||
* @param y The second argument to compare.
|
||||
* @return Whether *x* is less than *y*.
|
||||
*/
|
||||
export declare function less<T>(x: T, y: T): boolean;
|
||||
/**
|
||||
* Test whether *x* is less than or equal to *y*.
|
||||
*
|
||||
* @param x The first argument to compare.
|
||||
* @param y The second argument to compare.
|
||||
* @return Whether *x* is less than or equal to *y*.
|
||||
*/
|
||||
export declare function less_equal<T>(x: T, y: T): boolean;
|
||||
/**
|
||||
* Test whether *x* is greater than *y*.
|
||||
*
|
||||
* @param x The first argument to compare.
|
||||
* @param y The second argument to compare.
|
||||
* @return Whether *x* is greater than *y*.
|
||||
*/
|
||||
export declare function greater<T>(x: T, y: T): boolean;
|
||||
/**
|
||||
* Test whether *x* is greater than or equal to *y*.
|
||||
*
|
||||
* @param x The first argument to compare.
|
||||
* @param y The second argument to compare.
|
||||
* @return Whether *x* is greater than or equal to *y*.
|
||||
*/
|
||||
export declare function greater_equal<T>(x: T, y: T): boolean;
|
||||
+90
@@ -0,0 +1,90 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.greater_equal = exports.greater = exports.less_equal = exports.less = exports.not_equal_to = exports.equal_to = void 0;
|
||||
var uid_1 = require("./uid");
|
||||
/**
|
||||
* Test whether two arguments are equal.
|
||||
*
|
||||
* @param x The first argument to compare.
|
||||
* @param y The second argument to compare.
|
||||
* @return Whether two arguments are equal or not.
|
||||
*/
|
||||
function equal_to(x, y) {
|
||||
// CONVERT TO PRIMITIVE TYPE
|
||||
x = x ? x.valueOf() : x;
|
||||
y = y ? y.valueOf() : y;
|
||||
// DO COMPARE
|
||||
if (x instanceof Object &&
|
||||
x.equals instanceof Function)
|
||||
return x.equals(y);
|
||||
else
|
||||
return x === y;
|
||||
}
|
||||
exports.equal_to = equal_to;
|
||||
/**
|
||||
* Test whether two arguments are not equal.
|
||||
*
|
||||
* @param x The first argument to compare.
|
||||
* @param y The second argument to compare.
|
||||
* @return Returns `true`, if two arguments are not equal, otherwise `false`.
|
||||
*/
|
||||
function not_equal_to(x, y) {
|
||||
return !equal_to(x, y);
|
||||
}
|
||||
exports.not_equal_to = not_equal_to;
|
||||
/**
|
||||
* Test whether *x* is less than *y*.
|
||||
*
|
||||
* @param x The first argument to compare.
|
||||
* @param y The second argument to compare.
|
||||
* @return Whether *x* is less than *y*.
|
||||
*/
|
||||
function less(x, y) {
|
||||
// CONVERT TO PRIMITIVE TYPE
|
||||
x = x.valueOf();
|
||||
y = y.valueOf();
|
||||
// DO COMPARE
|
||||
if (x instanceof Object)
|
||||
if (x.less instanceof Function)
|
||||
// has less()
|
||||
return x.less(y);
|
||||
else
|
||||
return (0, uid_1.get_uid)(x) < (0, uid_1.get_uid)(y);
|
||||
else
|
||||
return x < y;
|
||||
}
|
||||
exports.less = less;
|
||||
/**
|
||||
* Test whether *x* is less than or equal to *y*.
|
||||
*
|
||||
* @param x The first argument to compare.
|
||||
* @param y The second argument to compare.
|
||||
* @return Whether *x* is less than or equal to *y*.
|
||||
*/
|
||||
function less_equal(x, y) {
|
||||
return less(x, y) || equal_to(x, y);
|
||||
}
|
||||
exports.less_equal = less_equal;
|
||||
/**
|
||||
* Test whether *x* is greater than *y*.
|
||||
*
|
||||
* @param x The first argument to compare.
|
||||
* @param y The second argument to compare.
|
||||
* @return Whether *x* is greater than *y*.
|
||||
*/
|
||||
function greater(x, y) {
|
||||
return !less_equal(x, y);
|
||||
}
|
||||
exports.greater = greater;
|
||||
/**
|
||||
* Test whether *x* is greater than or equal to *y*.
|
||||
*
|
||||
* @param x The first argument to compare.
|
||||
* @param y The second argument to compare.
|
||||
* @return Whether *x* is greater than or equal to *y*.
|
||||
*/
|
||||
function greater_equal(x, y) {
|
||||
return !less(x, y);
|
||||
}
|
||||
exports.greater_equal = greater_equal;
|
||||
//# sourceMappingURL=comparators.js.map
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Hash function.
|
||||
*
|
||||
* @param itemList The items to be hashed.
|
||||
* @return The hash code.
|
||||
*/
|
||||
export declare function hash(...itemList: any[]): number;
|
||||
+104
@@ -0,0 +1,104 @@
|
||||
"use strict";
|
||||
var __values = (this && this.__values) || function(o) {
|
||||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
||||
if (m) return m.call(o);
|
||||
if (o && typeof o.length === "number") return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.hash = void 0;
|
||||
var uid_1 = require("./uid");
|
||||
/**
|
||||
* Hash function.
|
||||
*
|
||||
* @param itemList The items to be hashed.
|
||||
* @return The hash code.
|
||||
*/
|
||||
function hash() {
|
||||
var e_1, _a;
|
||||
var itemList = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
itemList[_i] = arguments[_i];
|
||||
}
|
||||
var ret = INIT_VALUE;
|
||||
try {
|
||||
for (var itemList_1 = __values(itemList), itemList_1_1 = itemList_1.next(); !itemList_1_1.done; itemList_1_1 = itemList_1.next()) {
|
||||
var item = itemList_1_1.value;
|
||||
item = item ? item.valueOf() : item;
|
||||
var type = typeof item;
|
||||
if (type === "boolean")
|
||||
// BOOLEAN -> 1 BYTE
|
||||
ret = _Hash_boolean(item, ret);
|
||||
else if (type === "number" || type === "bigint")
|
||||
// NUMBER -> 8 BYTES
|
||||
ret = _Hash_number(item, ret);
|
||||
else if (type === "string")
|
||||
// STRING -> {LENGTH} BYTES
|
||||
ret = _Hash_string(item, ret);
|
||||
else if (item instanceof Object &&
|
||||
item.hashCode instanceof Function) {
|
||||
var hashed = item.hashCode();
|
||||
if (itemList.length === 1)
|
||||
return hashed;
|
||||
else {
|
||||
ret = ret ^ hashed;
|
||||
ret *= MULTIPLIER;
|
||||
}
|
||||
} // object | null | undefined
|
||||
else
|
||||
ret = _Hash_number((0, uid_1.get_uid)(item), ret);
|
||||
}
|
||||
}
|
||||
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
||||
finally {
|
||||
try {
|
||||
if (itemList_1_1 && !itemList_1_1.done && (_a = itemList_1.return)) _a.call(itemList_1);
|
||||
}
|
||||
finally { if (e_1) throw e_1.error; }
|
||||
}
|
||||
return Math.abs(ret);
|
||||
}
|
||||
exports.hash = hash;
|
||||
function _Hash_boolean(val, ret) {
|
||||
ret ^= val ? 1 : 0;
|
||||
ret *= MULTIPLIER;
|
||||
return ret;
|
||||
}
|
||||
function _Hash_number(val, ret) {
|
||||
return _Hash_string(val.toString(), ret);
|
||||
// // ------------------------------------------
|
||||
// // IN C++
|
||||
// // CONSIDER A NUMBER AS A STRING
|
||||
// // HASH<STRING>((CHAR*)&VAL, 8)
|
||||
// // ------------------------------------------
|
||||
// // CONSTRUCT BUFFER AND BYTE_ARRAY
|
||||
// const buffer: ArrayBuffer = new ArrayBuffer(8);
|
||||
// const byteArray: Int8Array = new Int8Array(buffer);
|
||||
// const valueArray: Float64Array = new Float64Array(buffer);
|
||||
// valueArray[0] = val;
|
||||
// for (let i: number = 0; i < byteArray.length; ++i)
|
||||
// {
|
||||
// const byte = (byteArray[i] < 0) ? byteArray[i] + 256 : byteArray[i];
|
||||
// ret ^= byte;
|
||||
// ret *= _HASH_MULTIPLIER;
|
||||
// }
|
||||
// return Math.abs(ret);
|
||||
}
|
||||
function _Hash_string(str, ret) {
|
||||
for (var i = 0; i < str.length; ++i) {
|
||||
ret ^= str.charCodeAt(i);
|
||||
ret *= MULTIPLIER;
|
||||
}
|
||||
return Math.abs(ret);
|
||||
}
|
||||
/* ---------------------------------------------------------
|
||||
RESERVED ITEMS
|
||||
--------------------------------------------------------- */
|
||||
var INIT_VALUE = 2166136261;
|
||||
var MULTIPLIER = 16777619;
|
||||
//# sourceMappingURL=hash.js.map
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std
|
||||
*/
|
||||
export * from "./bit_operations";
|
||||
export * from "./comparators";
|
||||
export * from "./hash";
|
||||
export * from "./uid";
|
||||
export * from "./IPointer";
|
||||
export * from "./IComparable";
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
"use strict";
|
||||
//================================================================
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std
|
||||
*/
|
||||
//================================================================
|
||||
// <functional>
|
||||
//
|
||||
// @reference http://www.cplusplus.com/reference/functional/
|
||||
// @author Jeongho Nam - https://github.com/samchon
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
var desc = Object.getOwnPropertyDescriptor(m, k);
|
||||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
||||
desc = { enumerable: true, get: function() { return m[k]; } };
|
||||
}
|
||||
Object.defineProperty(o, k2, desc);
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
||||
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
__exportStar(require("./bit_operations"), exports);
|
||||
__exportStar(require("./comparators"), exports);
|
||||
__exportStar(require("./hash"), exports);
|
||||
__exportStar(require("./uid"), exports);
|
||||
__exportStar(require("./IPointer"), exports);
|
||||
__exportStar(require("./IComparable"), exports);
|
||||
//# sourceMappingURL=index.js.map
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
/**
|
||||
* Get unique identifier.
|
||||
*
|
||||
* @param obj Target object.
|
||||
* @return The identifier number.
|
||||
*/
|
||||
export declare function get_uid(obj: object | null | undefined): number;
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.get_uid = void 0;
|
||||
//================================================================
|
||||
/**
|
||||
* @packageDocumentation
|
||||
* @module std
|
||||
*/
|
||||
//================================================================
|
||||
var Global_1 = require("../internal/Global");
|
||||
/**
|
||||
* Get unique identifier.
|
||||
*
|
||||
* @param obj Target object.
|
||||
* @return The identifier number.
|
||||
*/
|
||||
function get_uid(obj) {
|
||||
// NO UID EXISTS, THEN ISSUE ONE.
|
||||
if (obj instanceof Object) {
|
||||
if (obj.hasOwnProperty("__get_m_iUID") === false) {
|
||||
var uid_1 = ++(0, Global_1._Get_root)().__s_iUID;
|
||||
Object.defineProperty(obj, "__get_m_iUID", {
|
||||
value: function () {
|
||||
return uid_1;
|
||||
},
|
||||
});
|
||||
}
|
||||
// RETURNS
|
||||
return obj.__get_m_iUID();
|
||||
}
|
||||
else if (obj === undefined)
|
||||
return -1;
|
||||
// is null
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
exports.get_uid = get_uid;
|
||||
//# sourceMappingURL=uid.js.map
|
||||
Reference in New Issue
Block a user