https://github.com/igmrrf/funckage
JavaScript Functions for public use
https://github.com/igmrrf/funckage
Last synced: 3 months ago
JSON representation
JavaScript Functions for public use
- Host: GitHub
- URL: https://github.com/igmrrf/funckage
- Owner: igmrrf
- License: mit
- Created: 2023-02-06T09:12:54.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-03-02T01:32:01.000Z (about 1 year ago)
- Last Synced: 2024-12-10T21:14:03.226Z (6 months ago)
- Language: TypeScript
- Homepage:
- Size: 28.3 KB
- Stars: 0
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## FUNCKAGE
###### FUNCTIONS (We all know what this is.) - KAGE (shadow, shade, other side and shadows.)
#
#
### LOCAL STORAGE
Add data to localStorage temporarily without the need to delete them manually.
```javascript
import { store } from 'funckage'const login = (userData) => {
const response = await api.call("/login-url")
const { token } = response;// default ttl of 24hours (key, data, ttl)
store.setWithExpiry('token', token)
}
```Then you can access it within the ttl;
```javascript
import { store } from 'funckage'const getUserData =(userData)=>{
// will return null if queried after ttl
const token = store.getWithExpiry('token')const response = await api.call("/get-data-url", { headers: { 'auth-token': token } } )
// use response in application
}
```### Arrays
Basically a package for custom Javascript Functions to be used in the shade of greater projects.
Number to String Converter
Takes in a Number value and returns a String representation
Check the length of numbers to get the size (tens, hundreds, millions, ten millions, hundred millions, billions, ten billions, hundred billions, trillions, ten trillions, hundred trillions)
Example 1234, string?:
Take it value, returns one thousand, then inputs one thousand to call another
then returns one thousand two hundred then returns thirty, then returns four
switch(value.toString().length){
case 1:
size = "Units"
break;
case 2:
size = "Ten"
break;
case 3:
size = "Hundreds"
break;
case 4:
size = "Thousands"
break;
case 5:
size = "Ten Thousands"
break;
case 6:
size = "Hundred Thousands"
break;
case 7:
size = "Millions"
break;
case 8:
size = "Ten Millions"
break;
case 9:
size = "Hundred Millions"
break;
case 10:
size = "Billions"
break;
case 11:
size = "Ten Billions"
break;
case 12:
size = "Hundred Billions"
break;
case 13:
size = "Trillion"
break;
case 14:
size = "Ten Trillions"
break;
case 15:
size = "Hundred Trillions"
break;
}