person.utils
v1.4.5
Published
A small-sized utility nodejs library.
Downloads
2
Maintainers
Readme
person.utils
If you find any bugs or have a suggestion, dm __person__#0267 or join this server and go to the #person-utils-support channel on discord
Check the change logs in changelog.md
Installing
npm i person.utils
Methods
Convert markdown to html
let pr = require('person.utils')
console.log(pr.mdToHtml(`
\`\`\`
amogus\`\`\`
## Hello
> Looking at dis text:
~*meow*~ <= what a **cat** usally ***does***
[click me for Google](https://google.com)
![img](https://i.imgur.com/00XnnLF_d.webp?maxwidth=640&shape=thumb&fidelity=medium)
`)) /* output: <code>amogus</code>
<h2>Hello</h2>
<blockquote>Looking at dis text:</blockquote>
<s><i>meow</i></s> <= what a <b>cat</b> usally <b><i>does</b></i>
<a href='https://google.com'>click me for Google</a>
<img src='https://i.imgur.com/00XnnLF_d.webp?maxwidth=640&shape=thumb&fidelity=medium'>*/
// usage: pr.mdToHtml(md)
Progress bar
let pr = require('person.utils')
console.log(pr.progressbar(9, 20, '😧', '🥚'))
// output: 😧😧😧😧😧😧😧😧🥚😧😧😧😧😧😧😧😧😧😧😧
// usage: pr.progressbar(percentage, max = 100, stringSymbol = '➖', percentageSymbol = '⭕' )
Random hexadecimal
let pr = require('person.utils')
console.log(pr.hex()) // output (diffirent output for each call): D518B9
// usage: pr.hex()
Calculate
let pr = require('person.utils')
console.log(pr.calculate('2**(4/5)+6.5')) // output: 8.241101126592248
// usage: pr.calculate(expression)
HTTP
let pr = require('person.utils')
//get
pr.http.get('https://example.link',{tr: 5}).then(console.log) // output depends on what you are fetching
// usage: pr.http.get(link, headers = {}) (returns a promise)
// post/put/patch/delete
pr.http.post('https://another.link', {
content: 2
}, {
tok: 2
}).then(console.log) /*
output depends on what you are fetching
pr.http.post(link, headers = {}, body = {}) (returns a promise)
pr.http.patch(link, headers = {}, body = {}) (returns a promise)
pr.http.put(link, headers = {}, body = {}) (returns a promise)
pr.http.delete(link, headers = {}, body = {}) (returns a promise)
*/
Get version of an installed package in your project
let pr = require('person.utils')
console.log(pr.packageVersion('node-fetch')) // output: ^2.6.3
//usage: pr.packageVersion(name)
person.utils version
let pr = require('person.utils')
console.log(pr.version)