Skip to content

Commit

Permalink
organize files and folders
Browse files Browse the repository at this point in the history
  • Loading branch information
201flaviosilva committed Jan 21, 2023
1 parent a52a066 commit 44f1642
Show file tree
Hide file tree
Showing 229 changed files with 19,859 additions and 44,863 deletions.
File renamed without changes.
Expand Up @@ -19,10 +19,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Change Directory
run: cd ./lib/Vanilla
uses: actions/checkout@v3

- name: Install Dependencies
run: npm ci
Expand All @@ -31,7 +28,7 @@ jobs:
run: npm run compile

- name: Upload Artifact
uses: actions/upload-artifact@v1
uses: actions/upload-artifact@v3
with:
name: "201flaviosilva-utils"
path: build
5 changes: 1 addition & 4 deletions .github/workflows/DeployDoc.yml
Expand Up @@ -17,17 +17,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Change Directory
run: cd ./lib/Vanilla

- name: Install
run: npm install && npm run jsDoc

- name: Build
run: npm run jsDoc

- name: Deploy
uses: JamesIves/github-pages-deploy-action@4.1.1
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs # The folder the action should deploy.
Expand Up @@ -18,10 +18,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Change Directory
run: cd ./lib/Vanilla
uses: actions/checkout@v3

- name: Install
run: npm install
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
@@ -1,3 +1,3 @@
{
"liveServer.settings.port": 5501
"liveServer.settings.port": 5511
}
File renamed without changes.
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Flavio Silva
Copyright (c) 2023 Flavio Silva

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions build/utils.min.cjs
@@ -0,0 +1 @@
var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Arrays:()=>n,BinarySearchTree:()=>Y,BinarySearchTreeInstance:()=>K,EventSystem:()=>ut,EventSystemInstance:()=>ot,Fibonacci:()=>at,Maths:()=>r,Physics:()=>i,Vector2:()=>jt,allCharactersSame:()=>H,and:()=>bt,binary2Decimal:()=>U,choiceTrend:()=>Q,clone:()=>m,compare2Objects:()=>Z,decimal2Binary:()=>tt,fibonacciCustomSequence:()=>ct,fibonacciSequence:()=>ht,fibonacciUntil:()=>lt,getDate:()=>et,getVersion:()=>dt,isFalsy:()=>mt,isObjectEmpty:()=>gt,isTruthy:()=>yt,or:()=>vt,randomColor:()=>xt,randomColor0X:()=>Mt,randomFloat:()=>u,randomInt:()=>o,randomNumber:()=>a,randomRGBAColor:()=>St,randomRGBColor:()=>wt,randomString:()=>Nt,randomWalk1D:()=>Dt,randomWalk2D:()=>Ot,randomWalk3D:()=>_t,recursiveFibonacci:()=>ft,reverseString:()=>qt,xor:()=>pt});var n={};t.r(n),t.d(n,{allEqual:()=>s,choice:()=>h,findBigObject:()=>l,findLowObject:()=>c,isSorted:()=>f,moveLeft:()=>d,moveRight:()=>g,shuffle:()=>y,sortAscending:()=>b,sortAscendingObject:()=>v,sortDescending:()=>p,sortDescendingObject:()=>x});var r={};t.r(r),t.d(r,{average:()=>w,clamp:()=>S,degreesToRadians:()=>N,divideEvenly:()=>D,divideEvenlyWithSpread:()=>O,division:()=>_,factorial:()=>q,getPositionWithAngleDistance:()=>j,invertedLerp:()=>k,isEven:()=>E,isMultipleOf:()=>I,isNarcissisticNumber:()=>P,isOdd:()=>F,lerp:()=>T,makeNegative:()=>C,map:()=>$,median:()=>J,mode:()=>A,multiplication:()=>z,negative:()=>W,percentage:()=>B,radiansToDegrees:()=>R,range:()=>V,subtraction:()=>G,sum:()=>M});var i={};function s(t){return t.every((e=>JSON.stringify(e)===JSON.stringify(t[0])))}function u(t=0,e=1,n=2){return e||(e=t,t=0),parseFloat((Math.random()*(e-t)+t).toFixed(n))}function o(t,e){return e||(e=t,t=0),Math.round(t+Math.random()*(e-t))}function a(t,e){return u(t,e)}function h(t){return t[o(t.length)]}function l(t,e,n=!1){const r=Math.max(...t.map((t=>t[e])));return n?r:t.find((t=>t[e]===r))}function c(t,e,n=!1){const r=Math.min(...t.map((t=>t[e])));return n?r:t.find((t=>t[e]===r))}function f(t=[]){for(let e=0;e<t.length-1;e++)if(t[e]>t[e+1])return!1;return!0}function d(t=[],e=1){for(let n=0;n<e;n++){let e=t[t.length-1];for(let n=t.length-2;n>=0;n--){const r=t[n];t[n]=e,e=r}t[t.length-1]=e}return t}function g(t=[],e=1){for(let n=0;n<e;n++){let e=t[0];for(let n=1;n<t.length;n++){const r=t[n];t[n]=e,e=r}t[0]=e}return t}function m(t){return JSON.parse(JSON.stringify(t))}function y(t,e=!0){if(e)return t.sort((()=>Math.random()-.5));const n=m(t),r=[];for(;n.length;){const t=o(n.length);r.push(n[t]),n.splice(t,1)}return r}function b(t,e=!1){return e?t.sort(((t,e)=>t-e)):[...t].sort(((t,e)=>t-e))}function v(t,e,n=!1){return n?t.sort(((t,n)=>t[e]-n[e])):[...t].sort(((t,n)=>t[e]-n[e]))}function p(t,e=!1){return e?t.sort(((t,e)=>e-t)):[...t].sort(((t,e)=>e-t))}function x(t,e,n=!1){return n?t.sort(((t,n)=>n[e]-t[e])):[...t].sort(((t,n)=>n[e]-t[e]))}function M(...t){return t.reduce(((t,e)=>t+e),0)}function w(...t){return t.length?M(...t)/t.length:0}function S(t,e=0,n=1){return Math.min(n,Math.max(e,t))}function N(t){return t*(Math.PI/180)}function D(t=0,e=10,n=5){const r=[],i=(e-t)/(n-1);for(let e=0;e<n;e++)r.push(t+i*e);return r}function O(t=3,e=5){if(t<=1)return[0];const n=[];for(let r=0;r<t;r++)n.push(r*(2*e)/(t-1)-e);return n}function _(...t){if(!t.length)return 0;if(1===t.length)return t[0];let e=t[0];for(let n=1;n<t.length;n++)e/=t[n];return e}function q(t){return t<=1?t:t*q(t-1)}function j(t,e,n={x:0,y:0}){return{x:e*Math.cos(t)+n.x,y:e*Math.sin(t)+n.y}}function E(t){return t%2==0}function F(t){return t%2==1}function k(t,e,n){return S((t-e)/(n-e))}function I(t,e){return t%e==0}function P(t){const e=String(t);let n=0;for(let t=0;t<e.length;t++)n+=Math.pow(e[t],e.length);return n===t}function T(t,e,n){return e+(n-e)*t}function C(t){return-1*Math.abs(t)}function $(t,e,n,r,i){return(t-e)*(i-r)/(n-e)+r}function J(...t){const{length:e}=t;return e?(b(t,!0),E(e)?(t[e/2-1]+t[e/2])/2:t[(e-1)/2]):0}function A(...t){const e={};let n=0,r=0;for(let i=0;i<t.length;i++){const s=t[i];e[s]?e[s]++:e[s]=1,r<e[s]&&(n=s,r=e[s])}return n}function B(t,e){return 100*t/e}function z(...t){return t.reduce(((t,e)=>t*e),1)}function W(t){return-1*Math.abs(t)}function R(t){return t*(180/Math.PI)}function V(t,e,n=1,r=[]){const i=[];for(let s=t;s<e+1;s+=n){let t=!1;r.forEach((({start:e,end:n})=>{s>=e&&s<=n&&(t=!0)})),t||i.push(s)}return i}function G(...t){if(!t.length)return 0;if(1===t.length)return t[0];let e=t[0];for(let n=1;n<t.length;n++)e-=t[n];return e}function L({keys:t={forward:!1,left:!1,right:!1,reverse:!1},x:e,y:n,speed:r,acceleration:i,maxSpeed:s=1/0,friction:u=0,rotation:o,rotationSpeed:a,bounds:h={x:{min:-1/0,max:1/0},y:{min:-1/0,max:1/0}}}){t.forward?r+=i:t.reverse&&(r-=i);const l=Number(t.reverse)+1;if(r>s?r=s/l:r<-s/2&&(r=-s/2),r>0?r-=u:r<0&&(r+=u),Math.abs(r)<u&&(r=0),r){const e=r>0?1:-1;t.left&&(o-=a*e),t.right&&(o+=a*e)}const c=e+Math.sin(o)*r,f=n-Math.cos(o)*r;return{x:S(c,h.x.min,h.x.max),y:S(f,h.y.min,h.y.max),speed:r,rotation:o}}function H(t){for(let e=1;e<t.length;e++)if(t[0]!=t[e])return!1;return!0}function U(t){if("string"==typeof t)return parseInt(t,2)}t.r(i),t.d(i,{topDownCarMovimentation:()=>L});class X{constructor(t){this.value=t,this.left=null,this.right=null,this.parent=null}}class Y{constructor(t){this.root=null,this.count=0,void 0!==t&&this.add(t)}size(){return this.count}add(t){if("number"!=typeof t||isNaN(t))return void console.error("Value need to be a number!");const e=new X(t);if(null===this.root)return this.count++,void(this.root=e);let n=this.root;for(;n;){if(t===n.value)return;if(n.value>t){if(null===n.left){e.parent=n,n.left=e,this.count++;break}n=n.left}else{if(null===n.right){e.parent=n,n.right=e,this.count++;break}n=n.right}}}smaller(t){if(!this.root)return;let e=this.search(t||this.root.value);do{if(null===e.left)return e.value;e=e.left}while(e)}larger(t){if(!this.root)return;let e=this.search(t||this.root.value);do{if(null===e.right)return e.value;e=e.right}while(e)}search(t){if(!this.root)return;if("number"!=typeof t)throw new Error("Value need to be a number!");let e=this.root;for(;e;){if(t===e.value)return e;if(e.value>t){if(null===e.left)return!1;e=e.left}else{if(null===e.right)return!1;e=e.right}}}delete(t){const e=this.search(t);if(!e)return!1;if(null===e.left&&null===e.right)e.parent.left?.value===e.value?e.parent.left=null:e.parent.right=null;else if(null!==e.left&&null===e.right||null===e.left&&null!==e.right){const t=e.left||e.right;t.parent=e.parent,e.parent.left?.value===e.value?e.parent.left=t:e.parent.right=t}else{if(null===e.left||null===e.right)throw new Error("Error deleting value");{const t=this.search(this.larger(e.left.value));t.value===e.left.value?e.left=null:t.parent.right=null,e.value=t.value}}}}const K=new Y;function Q(t=[.25,.5,.25]){let e=0;const n=Math.random();for(let r=0;r<t.length;r++)if(e+=t[r],n<=e)return r}function Z(t,e){return JSON.stringify(t)===JSON.stringify(e)}function tt(t){return Number(t).toString(2)}function et(){return{time:(new Date).getTime(),milliseconds:(new Date).getMilliseconds(),seconds:(new Date).getSeconds(),minutes:(new Date).getMinutes(),hours:(new Date).getHours(),day:nt(),weekDay:(new Date).getDay()+1,week:rt(),month:it(),year:st(),dateFormatted:nt()+"/"+it()+"/"+st()}}function nt(){return(new Date).getDate()}function rt(){const t=new Date,e=new Date(t.getFullYear(),0,1),n=Math.floor((t-e)/864e5);return Math.ceil(n/7)}function it(){return(new Date).getMonth()+1}function st(){return(new Date).getFullYear()}class ut{constructor(){this.events={}}on(t,e){this.has(t)||(this.events[t]=[]),this.events[t].push(e)}emit(t,...e){this.has(t)&&this.events[t].forEach((t=>{t(...e)}))}off(t){delete this.events[t]}once(t,e){this.on(t,((...n)=>{e(...n),this.off(t)}))}clear(){this.events={}}has(t){return void 0!==this.events[t]}}const ot=new ut;class at{constructor(){this._lastNumber=0,this._currentNumber=1,this.sequence=[0]}next(){const t=this._currentNumber+this._lastNumber;return this._lastNumber=this._currentNumber,this._currentNumber=t,this.sequence.push(t),this._currentNumber}current(){return this.sequence[this.sequence.length-1]}before(){if(this.sequence.length>1)return this._lastNumber=this._currentNumber-this._lastNumber,this._currentNumber=this._currentNumber-this._lastNumber,this.sequence.pop(),this._currentNumber}}function ht(t=20){const e=[0,1];for(;e.length<t;)e.push(e[e.length-2]+e[e.length-1]);return e}function lt(t=100){const e=[0,1];do{if(e[e.length-2]+e[e.length-1]>=t)return e;e.push(e[e.length-2]+e[e.length-1])}while(e[e.length-1]<t)}function ct(t=1,e=100){const n=[];let r=0,i=t;for(;i<=e;){const t=i+r;r=i,i=t,n.push(i)}return n}function ft(t=10){return t<=1?t:ft(t-1)+ft(t-2)}function dt(){return"1.3.1"}function gt(t){return 0===Object.keys(t).length}function mt(t){try{if(!t||"object"==typeof t&&0==Object.keys(t).length)return!0}catch(t){return!0}return!1}function yt(t){return!mt(t)}function bt(...t){for(let e=0;e<t.length;e++)if(!t[e])return!1;return!0}function vt(...t){return!!t.find((t=>!!t))}function pt(t,e){return!!t!=!!e}function xt(){return"#"+(16777215*Math.random()<<0).toString(16)}function Mt(){return`0x${Math.floor(16777215*Math.random()).toString(16)}`}function wt(){return`rgb(${o(255)}, ${o(255)}, ${o(255)})`}function St(){return`rgba(${o(255)}, ${o(255)}, ${o(255)}, ${Math.random().toFixed(5)})`}function Nt(t={numberCharacters:12,numbers:!0,symbols:!0,capital:!0,small:!0}){let e=[];e=t.capital?[...e,"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","y","Z"]:[...e],e=t.small?[...e,"a","b","c","d","e","f","G","H","I","J","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]:[...e],e=t.numbers?[...e,"0","1","2","3","4","5","6","7","8","9"]:[...e],e=t.symbols?[...e,"!",'"',"@","#","€","$","£","%","‰","&","¶","/","(","[",")","]","=","≠","'","?","+","*"]:[...e];let n="";for(let r=0;r<t.numberCharacters;r++)n+=h(e);return n}function Dt(){return[Math.random()<.5?-1:1]}function Ot(){return Math.random()<.5?[...Dt(),0]:[0,...Dt()]}function _t(){const t=Math.random();return t<.333?[...Dt(),0,0]:t<.666?[0,...Dt(),0]:[0,0,...Dt()]}function qt(t){return t.split("").reverse().join("")}class jt{constructor(t=0,e=t){this.x=0,this.y=0,this.set(t,e)}set(t=0,e=t){return"object"==typeof t?(this.x=t.x||0,this.y=t.y||0):(this.x=t||0,this.y=e||0),this}clone(){return new jt(this.x,this.y)}add(t){return this.x+=t.x,this.y+=t.y,this}subtract(t){return this.x-=t.x,this.y-=t.y,this}scale(t=1){return this.x*=t,this.y*=t,this}multiply(t){return this.x*=t.x,this.y*=t.y,this}divide(t){return this.x/=t.x,this.y/=t.y,this}dot(t){return this.x*t.x+this.y*t.y}moveTowards(t=jt.zero(),e=1){e=S(e,0,1);const n=t.subtract(this).scale(e);return this.add(n)}magnitude(){return this.x*this.x+this.y*this.y}magnitudeSqr(){return Math.sqrt(this.magnitude())}distance(t=jt.zero()){const e=this.x-t.x,n=this.y-t.y;return e*e+n*n}distanceSqrt(t){return Math.sqrt(this.distance(t))}normalize(){const t=this.distanceSqrt();return Math.abs(t)<1e-9?(this.x=0,this.y=0):(this.x/=t,this.y/=t),this}diferenceAngle(t){return R(Math.atan2(t.y-this.y,t.x-this.x))}angle(){let t=Math.atan2(this.y,this.x);return t<0&&(t+=2*Math.PI),R(t)}rotate(t=0){const e=Math.cos(t),n=Math.sin(t),r=this.x*e-this.y*n,i=this.x*n+this.y*e;return this.set(r,i)}toPrecision(t=1){return this.x=Number(this.x.toFixed(t)),this.y=Number(this.y.toFixed(t)),this}equals(t){return this.x===t.x&&this.y===t.y}toString(){return"["+this.x+"; "+this.y+"]"}absolute(){return this.x=Math.abs(this.x),this.y=Math.abs(this.y),this}negative(){return this.x=W(this.x),this.y=W(this.y),this}negate(){return this.x=-1*this.x,this.y=-1*this.y,this}invert(){const t=this.x;return this.x=this.y,this.y=t,this}static zero(){return new jt(0)}static one(){return new jt(1)}static positiveInfinity(){return new jt(1/0)}static negativeInfinity(){return new jt(-1/0)}static up(){return new jt(0,-1)}static down(){return new jt(0,1)}static left(){return new jt(-1,0)}static right(){return new jt(1,0)}static random(){return new jt(Math.random(),Math.random())}}module.exports=e;

0 comments on commit 44f1642

Please sign in to comment.