@janjanmedinaaa/clean
v1.0.0
Published
Just Another Javascript utility library that focuses on *DRYing* and **reducing** the lines of sources codes.
Downloads
1
Readme
Clean.js
Just Another Javascript utility library that focuses on DRYing and reducing the lines of sources codes.
Documentation
Usage
const clean = require('./clean') // or
const standard = require('./clean/lib/Standard')
const algo = require('./clean/lib/Algorithms')
const arrays = require('./clean/lib/Arrays')
const term = require('./clean/lib/Logs')
const math = require('./clean/lib/Math')
const pattern = require('./clean/lib/Patterns')
const validators = require('./clean/lib/Validators')
Standard
const clean = require('./clean') // or
const standard = require('./clean/lib/Standard')
let array = [1, 2, 3, 4, 5];
const print = (value, i) => {
console.log(value * 2)
}
const runThis = () => {
console.log("True from if else statement")
}
// for(array, callback = null, reverse = false)
clean.for(array) // prints 1 2 3 4 5
clean.for(5) prints 1 2 3 4 5
clean.foreach(array, print, true) // prints 10 8 6 4 2
clean.while("racecar", (a) => console.log(a), true) // prints r a c e c a r
// try(tryCallback, catchCallback = null, finallyCallback = null)
clean.try(() => a == 0, () => console.log('Oh no! An error occured.'))
clean.try(() => error, 'Oh no! An error occured.', 'Always run this!')
clean.try(() => error) // prints the error
// if(statement, ifCallback = null, elseCallBack = null)
if(true, "THIS IS TRUE", "THIS IS FALSE") // prints "THIS IS TRUE"
if(1 > 2) // prints false
if(2 == 2, runThis) // runs runThis()
Todo List
- [ ] Documentation
- [ ] Euclidean Distance Algorithm
- [ ] Clean and Enhance Source codes
- [ ] Random String and Number Generators
- [ ] Data Type Validators