Skip to content

Commit

Permalink
feat(CV-0): added developer ssl
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-jonathan committed Jul 20, 2023
1 parent 5347c1f commit 089eb9a
Show file tree
Hide file tree
Showing 17 changed files with 470 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
.DS_Store
node_modules
ssl
dist
useUserChannels
coverage
logs
local
Expand Down
1 change: 1 addition & 0 deletions dist/lib-cjs.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("@cosmicmind/foundationjs"),N=(e,t)=>e===t?0:e>t?1:-1,D=(e,t)=>e===t?0:e>t?1:-1,Q=(e,t)=>e.key===t.key?0:e.key>t.key?1:-1,j=(e,t)=>e.key===t.key?0:e.key>t.key?1:-1,i=void 0,B=(e,t)=>{for(let r=1,n=e.length;r<n;++r){const s=e[r];let f=r-1;for(;0<=f&&0<t(e[f],s);)e[f+1]=e[f],--f;e[f+1]=s}},H=(e,t,r,n,s)=>{const f=r-t+1,a=n-r;let u,c,l;const g=[],h=[];for(u=0;u<f;++u)g[u]=e[t+u];for(c=0;c<a;++c)h[c]=e[r+c+1];for(u=0,c=0,l=t;u<f&&c<a;)1>s(g[u],h[c])?(e[l]=g[u],++u):(e[l]=h[c],++c),++l;for(;u<f;)e[l]=g[u],++u,++l;for(;c<a;)e[l]=h[c],++c,++l},C=(e,t,r,n)=>{if(t<r){const s=Math.floor(t+(r-t)/2);C(e,t,s,n),C(e,s+1,r,n),H(e,t,s,r,n)}},K=(e,t)=>C(e,0,e.length-1,t),O=(e,t)=>{let r=0;for(let n=0,s=e.length;n<s;++n){r=n;for(let a=n+1;a<s;++a)0<t(e[r],e[a])&&(r=a);const f=e[r];e[r]=e[n],e[n]=f}},m=(e,t)=>e===t?0:-1,M=e=>({...e??{},parent:i}),q=()=>({top:i,count:0});function E(e){return e.top}function G(e,t){t.parent=e.top,e.top=t,++e.count}function T(e){const t=e.top;return o.guard(t)&&(e.top=t.parent,t.parent=i,--e.count),t}function*k(e){let t=e.top;for(;o.guard(t);)yield t,t=t.parent}function*x(e){let t=e;for(;o.guard(t);)yield t,t=t.parent}function*J(e){let t=e.parent;for(;o.guard(t);)yield t,t=t.parent}function U(e){for(;o.guard(e.top);)T(e)}function z(e){let t=e.parent,r=0;for(;o.guard(t);)++r,t=t.parent;return r}function V(e,t,r=m){return o.guard(e.top)&&r(e.top,t)===0}function W(e,t,r=m){for(const n of k(e))if(r(n,t)===0)return!0;return!1}function X(e,...t){const r=new Set;e:for(const n of k(e)){for(const s of t)if(!s(n))continue e;r.add(n)}return r}const p=(e,t)=>e===t?0:e>t?1:-1,Y=e=>({...e,next:i,previous:i}),A=()=>({first:i,last:i,count:0});function y(e,t){o.guard(e.first)?(e.first.previous=t,t.next=e.first,t.previous=i):(e.last=t,t.previous=i,t.next=i),e.first=t,++e.count}function v(e){const t=e.first;if(o.guard(t)){const r=t.next;o.guard(r)?(e.first=r,r.previous=i):(e.first=i,e.last=i),t.previous=i,t.next=i,--e.count}return t}function F(e,t){o.guard(e.last)?(e.last.next=t,t.previous=e.last,t.next=i):(e.first=t,t.previous=i,t.next=i),e.last=t,++e.count}function S(e){const t=e.last;if(o.guard(t)){const r=t.previous;o.guard(r)?(e.last=r,r.next=i):(e.first=i,e.last=i),t.previous=i,t.next=i,--e.count}return t}function Z(e,t,r,n=p){if(o.guard(e.first)&&n(e.first,r)===0)y(e,t);else{const s=r.previous;o.guard(s)&&(s.next=t,t.previous=s,t.next=r,r.previous=t,++e.count)}}function _(e,t,r=p){const n=t.previous;if(o.guard(e.first)&&o.guard(n)&&r(e.first,n)===0)v(e);else if(o.guard(n)){const s=n.previous;o.guard(s)&&(t.previous=s,s.next=t,n.previous=i,n.next=i,--e.count)}return n}function $(e,t,r,n=p){if(o.guard(e.last)&&n(e.last,r)===0)F(e,t);else{const s=r.next;o.guard(s)&&(s.previous=t,t.next=s,t.previous=r,r.next=t,++e.count)}}function b(e,t,r=p){const n=t.next;if(o.guard(e.last)&&o.guard(n)&&r(e.last,n)===0)S(e);else if(o.guard(n)){const s=n.next;o.guard(s)&&(s.previous=t,t.next=s,n.previous=i,n.next=i,--e.count)}return n}function ee(e,t,r=p){if(o.guard(e.first)&&r(e.first,t)===0)v(e);else if(o.guard(e.last)&&r(e.last,t)===0)S(e);else{const n=t.previous,s=t.next;o.guard(n)&&o.guard(s)&&(n.next=s,s.previous=n,t.previous=i,t.next=i,--e.count)}}function*I(e){let t=e.first;for(;o.guard(t);)yield t,t=t.next}function*te(e){let t=e.last;for(;o.guard(t);)yield t,t=t.previous}function*re(e){let t=e;for(;o.guard(t);)yield t,t=t.next}function*ne(e){let t=e;for(;o.guard(t);)yield t,t=t.previous}function oe(e){for(;o.guard(e.first);)v(e)}function w(e,t,r=p){return o.guard(e.first)&&r(e.first,t)===0}function L(e,t,r=p){return o.guard(e.last)&&r(e.last,t)===0}function se(e,t){for(const r of I(e))if(r===t)return!0;return!1}function ie(e,...t){const r=new Set;e:for(const n of I(e)){for(const s of t)if(!s(n))continue e;r.add(n)}return r}const d=(e,t)=>e===t?0:e>t?1:-1,ue=e=>({...e??{},parent:i,next:i,previous:i,children:A(),size:1});function ce(e,t){e.parent=t,y(t.children,e),R(t,e.size)}function fe(e,t){e.parent=t,F(t.children,e),R(t,e.size)}const ae=e=>z(e);function le(e){return i===e.parent}function pe(e){return e.children.count===0}function de(e,t,r=d){return o.guard(e.parent)&&r(e.parent,t)===0}function ge(e,t,r=d){return w(t.children,e,r)}function he(e,t,r=d){return L(t.children,e,r)}function ve(e,t,r=d){return w(t.children,e,r)&&L(t.children,e,r)}function R(e,t){o.assert(0<t,"size must be greater than 0");for(const r of x(e))r.size+=t}function Ie(e,t){o.assert(0<t,"size must be greater than 0");for(const r of x(e))r.size-=t}function*P(e){yield e;for(const t of I(e.children))yield*P(t)}function Ce(e,...t){const r=new Set;e:for(const n of P(e)){for(const s of t)if(!s(n))continue e;r.add(n)}return r}exports.ListCompareFn=p;exports.SentinelNode=i;exports.StackCompareFn=m;exports.TreeCompareFn=d;exports.insertionSort=B;exports.listAppend=F;exports.listClear=oe;exports.listCreate=A;exports.listHas=se;exports.listInsert=y;exports.listInsertAfter=$;exports.listInsertBefore=Z;exports.listIsFirst=w;exports.listIsLast=L;exports.listIterateFromFirst=I;exports.listIterateFromLast=te;exports.listIterateToNext=re;exports.listIterateToPrevious=ne;exports.listNodeCreate=Y;exports.listQuery=ie;exports.listRemove=ee;exports.listRemoveAfter=b;exports.listRemoveBefore=_;exports.listRemoveFirst=v;exports.listRemoveLast=S;exports.mergeSort=K;exports.numericCompare=D;exports.numericKeyCompare=j;exports.selectionSort=O;exports.stackClear=U;exports.stackCreate=q;exports.stackDepth=z;exports.stackHas=W;exports.stackIsTop=V;exports.stackIterateFrom=x;exports.stackIterateToParent=J;exports.stackIterator=k;exports.stackNodeCreate=M;exports.stackPeek=E;exports.stackPop=T;exports.stackPush=G;exports.stackQuery=X;exports.stringCompare=N;exports.stringKeyCompare=Q;exports.treeAppendChild=fe;exports.treeCreate=ue;exports.treeDecreaseSize=Ie;exports.treeDepth=ae;exports.treeIncreaseSize=R;exports.treeInsertChild=ce;exports.treeIsChild=de;exports.treeIsFirstChild=ge;exports.treeIsLastChild=he;exports.treeIsLeaf=pe;exports.treeIsOnlyChild=ve;exports.treeIsRoot=le;exports.treeIterator=P;exports.treeQuery=Ce;
342 changes: 342 additions & 0 deletions dist/lib-es.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,342 @@
import { guard as i, assert as C } from "@cosmicmind/foundationjs";
const d = (e, t) => e === t ? 0 : e > t ? 1 : -1, B = (e, t) => e === t ? 0 : e > t ? 1 : -1, H = (e, t) => e.key === t.key ? 0 : e.key > t.key ? 1 : -1, K = (e, t) => e.key === t.key ? 0 : e.key > t.key ? 1 : -1, s = void 0, M = (e, t) => {
for (let n = 1, o = e.length; n < o; ++n) {
const r = e[n];
let f = n - 1;
for (; 0 <= f && 0 < t(e[f], r); )
e[f + 1] = e[f], --f;
e[f + 1] = r;
}
}, A = (e, t, n, o, r) => {
const f = n - t + 1, l = o - n;
let c, u, p;
const v = [], x = [];
for (c = 0; c < f; ++c)
v[c] = e[t + c];
for (u = 0; u < l; ++u)
x[u] = e[n + u + 1];
for (c = 0, u = 0, p = t; c < f && u < l; )
1 > r(v[c], x[u]) ? (e[p] = v[c], ++c) : (e[p] = x[u], ++u), ++p;
for (; c < f; )
e[p] = v[c], ++c, ++p;
for (; u < l; )
e[p] = x[u], ++u, ++p;
}, y = (e, t, n, o) => {
if (t < n) {
const r = Math.floor(t + (n - t) / 2);
y(e, t, r, o), y(e, r + 1, n, o), A(e, t, r, n, o);
}
}, O = (e, t) => y(e, 0, e.length - 1, t), q = (e, t) => {
let n = 0;
for (let o = 0, r = e.length; o < r; ++o) {
n = o;
for (let l = o + 1; l < r; ++l)
0 < t(e[n], e[l]) && (n = l);
const f = e[n];
e[n] = e[o], e[o] = f;
}
}, k = (e, t) => e === t ? 0 : -1, E = (e) => ({
...e ?? {},
parent: s
}), G = () => ({
top: s,
count: 0
});
function J(e) {
return e.top;
}
function U(e, t) {
t.parent = e.top, e.top = t, ++e.count;
}
function N(e) {
const t = e.top;
return i(t) && (e.top = t.parent, t.parent = s, --e.count), t;
}
function* w(e) {
let t = e.top;
for (; i(t); )
yield t, t = t.parent;
}
function* g(e) {
let t = e;
for (; i(t); )
yield t, t = t.parent;
}
function* V(e) {
let t = e.parent;
for (; i(t); )
yield t, t = t.parent;
}
function W(e) {
for (; i(e.top); )
N(e);
}
function j(e) {
let t = e.parent, n = 0;
for (; i(t); )
++n, t = t.parent;
return n;
}
function X(e, t, n = k) {
return i(e.top) && n(e.top, t) === 0;
}
function Y(e, t, n = k) {
for (const o of w(e))
if (n(o, t) === 0)
return !0;
return !1;
}
function Z(e, ...t) {
const n = /* @__PURE__ */ new Set();
e:
for (const o of w(e)) {
for (const r of t)
if (!r(o))
continue e;
n.add(o);
}
return n;
}
const h = (e, t) => e === t ? 0 : e > t ? 1 : -1, _ = (e) => ({
...e,
next: s,
previous: s
}), D = () => ({
first: s,
last: s,
count: 0
});
function F(e, t) {
i(e.first) ? (e.first.previous = t, t.next = e.first, t.previous = s) : (e.last = t, t.previous = s, t.next = s), e.first = t, ++e.count;
}
function m(e) {
const t = e.first;
if (i(t)) {
const n = t.next;
i(n) ? (e.first = n, n.previous = s) : (e.first = s, e.last = s), t.previous = s, t.next = s, --e.count;
}
return t;
}
function S(e, t) {
i(e.last) ? (e.last.next = t, t.previous = e.last, t.next = s) : (e.first = t, t.previous = s, t.next = s), e.last = t, ++e.count;
}
function z(e) {
const t = e.last;
if (i(t)) {
const n = t.previous;
i(n) ? (e.last = n, n.next = s) : (e.first = s, e.last = s), t.previous = s, t.next = s, --e.count;
}
return t;
}
function $(e, t, n, o = h) {
if (i(e.first) && o(e.first, n) === 0)
F(e, t);
else {
const r = n.previous;
i(r) && (r.next = t, t.previous = r, t.next = n, n.previous = t, ++e.count);
}
}
function b(e, t, n = h) {
const o = t.previous;
if (i(e.first) && i(o) && n(e.first, o) === 0)
m(e);
else if (i(o)) {
const r = o.previous;
i(r) && (t.previous = r, r.next = t, o.previous = s, o.next = s, --e.count);
}
return o;
}
function ee(e, t, n, o = h) {
if (i(e.last) && o(e.last, n) === 0)
S(e, t);
else {
const r = n.next;
i(r) && (r.previous = t, t.next = r, t.previous = n, n.next = t, ++e.count);
}
}
function te(e, t, n = h) {
const o = t.next;
if (i(e.last) && i(o) && n(e.last, o) === 0)
z(e);
else if (i(o)) {
const r = o.next;
i(r) && (r.previous = t, t.next = r, o.previous = s, o.next = s, --e.count);
}
return o;
}
function ne(e, t, n = h) {
if (i(e.first) && n(e.first, t) === 0)
m(e);
else if (i(e.last) && n(e.last, t) === 0)
z(e);
else {
const o = t.previous, r = t.next;
i(o) && i(r) && (o.next = r, r.previous = o, t.previous = s, t.next = s, --e.count);
}
}
function* I(e) {
let t = e.first;
for (; i(t); )
yield t, t = t.next;
}
function* oe(e) {
let t = e.last;
for (; i(t); )
yield t, t = t.previous;
}
function* re(e) {
let t = e;
for (; i(t); )
yield t, t = t.next;
}
function* ie(e) {
let t = e;
for (; i(t); )
yield t, t = t.previous;
}
function se(e) {
for (; i(e.first); )
m(e);
}
function L(e, t, n = h) {
return i(e.first) && n(e.first, t) === 0;
}
function R(e, t, n = h) {
return i(e.last) && n(e.last, t) === 0;
}
function ce(e, t) {
for (const n of I(e))
if (n === t)
return !0;
return !1;
}
function ue(e, ...t) {
const n = /* @__PURE__ */ new Set();
e:
for (const o of I(e)) {
for (const r of t)
if (!r(o))
continue e;
n.add(o);
}
return n;
}
const a = (e, t) => e === t ? 0 : e > t ? 1 : -1, fe = (e) => ({
...e ?? {},
parent: s,
next: s,
previous: s,
children: D(),
size: 1
});
function le(e, t) {
e.parent = t, F(t.children, e), P(t, e.size);
}
function pe(e, t) {
e.parent = t, S(t.children, e), P(t, e.size);
}
const he = (e) => j(e);
function ve(e) {
return s === e.parent;
}
function xe(e) {
return e.children.count === 0;
}
function ae(e, t, n = a) {
return i(e.parent) && n(e.parent, t) === 0;
}
function ye(e, t, n = a) {
return L(t.children, e, n);
}
function me(e, t, n = a) {
return R(t.children, e, n);
}
function Ie(e, t, n = a) {
return L(t.children, e, n) && R(t.children, e, n);
}
function P(e, t) {
C(0 < t, "size must be greater than 0");
for (const n of g(e))
n.size += t;
}
function Ce(e, t) {
C(0 < t, "size must be greater than 0");
for (const n of g(e))
n.size -= t;
}
function* T(e) {
yield e;
for (const t of I(e.children))
yield* T(t);
}
function ke(e, ...t) {
const n = /* @__PURE__ */ new Set();
e:
for (const o of T(e)) {
for (const r of t)
if (!r(o))
continue e;
n.add(o);
}
return n;
}
export {
h as ListCompareFn,
s as SentinelNode,
k as StackCompareFn,
a as TreeCompareFn,
M as insertionSort,
S as listAppend,
se as listClear,
D as listCreate,
ce as listHas,
F as listInsert,
ee as listInsertAfter,
$ as listInsertBefore,
L as listIsFirst,
R as listIsLast,
I as listIterateFromFirst,
oe as listIterateFromLast,
re as listIterateToNext,
ie as listIterateToPrevious,
_ as listNodeCreate,
ue as listQuery,
ne as listRemove,
te as listRemoveAfter,
b as listRemoveBefore,
m as listRemoveFirst,
z as listRemoveLast,
O as mergeSort,
B as numericCompare,
K as numericKeyCompare,
q as selectionSort,
W as stackClear,
G as stackCreate,
j as stackDepth,
Y as stackHas,
X as stackIsTop,
g as stackIterateFrom,
V as stackIterateToParent,
w as stackIterator,
E as stackNodeCreate,
J as stackPeek,
N as stackPop,
U as stackPush,
Z as stackQuery,
d as stringCompare,
H as stringKeyCompare,
pe as treeAppendChild,
fe as treeCreate,
Ce as treeDecreaseSize,
he as treeDepth,
P as treeIncreaseSize,
le as treeInsertChild,
ae as treeIsChild,
ye as treeIsFirstChild,
me as treeIsLastChild,
xe as treeIsLeaf,
Ie as treeIsOnlyChild,
ve as treeIsRoot,
T as treeIterator,
ke as treeQuery
};
7 changes: 7 additions & 0 deletions dist/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export type { CompareFn, CompareStringKey, CompareNumericKey, } from './utils';
export { stringCompare, numericCompare, stringKeyCompare, numericKeyCompare, } from './utils';
export type { LinearSort } from './utils';
export { SentinelNode } from './utils';
export { insertionSort, mergeSort, selectionSort, } from './sort';
export type { Listable, List, Stackable, Stack, Tree, } from './structures';
export { ListCompareFn, listNodeCreate, listCreate, listInsert, listRemoveFirst, listAppend, listRemoveLast, listInsertBefore, listRemoveBefore, listInsertAfter, listRemoveAfter, listRemove, listIterateFromFirst, listIterateFromLast, listIterateToNext, listIterateToPrevious, listClear, listIsFirst, listIsLast, listHas, listQuery, StackCompareFn, stackNodeCreate, stackCreate, stackPeek, stackPush, stackPop, stackIterator, stackIterateFrom, stackIterateToParent, stackClear, stackDepth, stackIsTop, stackHas, stackQuery, TreeCompareFn, treeCreate, treeInsertChild, treeAppendChild, treeDepth, treeIsRoot, treeIsLeaf, treeIsChild, treeIsFirstChild, treeIsLastChild, treeIsOnlyChild, treeIncreaseSize, treeDecreaseSize, treeIterator, treeQuery, } from './structures';
2 changes: 2 additions & 0 deletions dist/src/sort/InsertionSort.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { LinearSort } from '../utils/sort';
export declare const insertionSort: LinearSort;
2 changes: 2 additions & 0 deletions dist/src/sort/MergeSort.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { CompareFn } from '../utils/compare';
export declare const mergeSort: <T>(data: T[], fn: CompareFn<T>) => void;
2 changes: 2 additions & 0 deletions dist/src/sort/SelectionSort.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { LinearSort } from '../utils/sort';
export declare const selectionSort: LinearSort;
3 changes: 3 additions & 0 deletions dist/src/sort/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { insertionSort } from '../sort/InsertionSort';
export { mergeSort } from '../sort/MergeSort';
export { selectionSort } from '../sort/SelectionSort';
Loading

0 comments on commit 089eb9a

Please sign in to comment.