Skip to content

Altir-Team/jsutil

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JSUtil

jsutil_logo

Available features

Examples

const jsutil = require('./')

jsutil.isEqual([1, 2, 3], [1, 2, 3])

/*
output: true
type: Boolean
*/

jsutil.isFloat(2)

/*
output: false
type: Boolean
*/

let Parser = new jsutil.Parser()

Parser.format('%0 %1, %2 %3', 'no', 'anime', 'no', 'k-pop');

/*
output: 'no anime, no k-pop'
type: String
*/

Parser.replace('loooooong %var%', {var: 'text'});

/*
output: 'loooooong text'
type: String
*/

jsutil.chunk('hello world', 3)

/*
output: ['hel', 'lo ', 'wor', 'ld']
type: Array
*/

jsutil.capsTest('LOOONG text', 5)

/*
output: true
type: Boolean
*/

jsutil.protocol('ftp://path/to/hell')

/*
output: 'ftp'
type: String
*/

;(async () => {
    for (let i = 0; i < 69; i++) {
         console.log(i)
         await jsutil.sleep(1)
    }
})()

/*
output: Promise
type: Promise
*/

jsutil.calculate('2 + 2 / sqrt(9) ** PI - E + 1')

/*
output: 0.3451211072112388
type: Number
*/

jsutil.type(new Map())

/*
output: [ [Function: Map], 'Map' ]
type: Array
*/

jsutil.eval('2 + 2')

/*
output: 4
type: any
*/

jsutil.eval.safe('process')

/*
output: undefined
type: any
*/

jsutil.eval.async('2 + 2')

/*
output: any
type: any

*/

CLI

const { CLI, calculate } = require('./')
const interface = new CLI('easy math')

function math(args) {
    return !console.log(calculate(args))
}

interface.addCommand('math', math, 'description', true)
.setFooter('😮😮😮')

interface.spawn()

Docs

Boolean

Object

String

Number

Array

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published