2.0.0 • Published 3 years ago

@ackystack/ackystack-utils v2.0.0

Weekly downloads
1
License
Apache-2.0
Repository
github
Last release
3 years ago

AckyStack Front End Utilities

npm version jsDelivr Maintenance Website ackystack.com GitHub license GitHub contributors

A utility made for AckyStack front end developers. This utilities toolkit cloud help developers to do some AckyStack special operations more efficiently. It includes but not limit to: Codec Module, Encryption Module and Http Request Module. Have fun and be free to use this library!!!

Install Instruction

NPM

npm install @ackystack/ackystack-utils

YARN

yarn add @ackystack/ackystack-utils

CDN

Add one of the following tag in your HTML document.

<script src="https://cdn.jsdelivr.net/npm/@ackystack/ackystack-utils@latest/dist/ackystack-utils.min.js"></script>

or a specific version

<script src="https://cdn.jsdelivr.net/npm/@ackystack/ackystack-utils@2.0.0/dist/ackystack-utils.min.js"></script>

Usage

    // instantiate with default configuration
    let asu = new AckyStackUtils();

    /** Encryption Utils*/

	//This method will do exactly what you think (return a string)
    asu.EncryptionUtils().sha256Encrypt();
	//This method will do exactly what you think (return a string)
    asu.EncryptionUtils().md5Encrypt();     
	//This method will do exactly what you think (return a string)
    asu.EncryptionUtils().passwordEncrypt();


    /** Codec Utils*/

	//This method will do exactly what you think (return a string)
    asu.CodecUtils().base64Encode();
	//This method will do exactly what you think (return a string)
    asu.CodecUtils().base64Decode();


    /** HTTP Request Utils*/
    
    // send a get request with axios
    asu.RequestUtils().get('url', {a: 'hello', b: 1234123}).then(response => {
        //When the request success and also gets feedback from the server...
        console.log(response.ret);
        console.log(response.msg);
        console.log(response.data);
    }).catch(reason => {
        //When the request faild to send, or server send error feedback...
        //the 'reason' will be either a server response, or a Promise error.
        console.log(reason);
    })
    
    //send a post request with axios
    //The post method has three arguments, as you can tell what first and second is. 
	//The third argument is called 'isForm',
    //I'm sure about you can tell what does it do from the name.
    asu.RequestUtils().post('url', {a: 'hello', b: 1234123}, true).then(response => {
        //do something...
    }).catch(reason => {
        //do something else...
    })

more and more methods coming up ~

Contributing

All contributions are super welcome!

Contact us

Please contact us if you need any help or just chill out: