npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

muthu-plugins

v1.0.6

Published

Created by Muthukumar D

Downloads

4

Readme

muthu-plugins

Commonly used plugins for Javascript based frameworks.

Install

with npm

npm install --save muthu-plugins

Usage

For Api Calls

To Initialize Headers and Base Url for Api Calls, call the below method to initialize.

initializeApiCall(
    {
    "Content-Tye":"application/json", // Remove or Change value for Content Type whatever you need
    "Authorization":"Bearer Token" // Remove or Change value for Authorization whatever you need
    "YOUR_CUSTOM_HEADERS" : "YOUR_CUSTOM_HEADERS_VALUE" // Add your Headers whatever you need
    }, 
    "BASEURL_STRING", // Must be your Base URL
    "WITH_CREDENTIALS", // With Credentials must be Boolean - true | false
    [{ 
        status_code : "401", // Kindly pass the status code to run the function mentioned in func key for all Api's
        func: "YOUR_FUNCTIONS" // Call your functions based on Status Code (status_code)
    },
    {
        status_code : "406", // Kindly pass the status code to run the function mentioned in func key for all Api's
        func: "YOUR_FUNCTIONS" // Call your functions based on Status Code (status_code)
    }]
);

For Example,

import {initializeApiCall} from "muthu-plugins";
initializeApiCall(
    {
        "Content-Tye":"application/json",
        "Authorization":"Bearer Token",
    }, 
    "http://43.204.131.206:8000/api/v1/",
    false,
    {
        status_code:'401',
        func: () => (your_function1(),your_function2(),...)
    }
);

For Get Method, call getApiCall method to make the request and get the respsonse.

getApiCall('PART_OF_URL_STRING', (response) => {
    console.log(response);
});

For Post Method, call postApiCall method to make the request and get the respsonse.

var data = {} // Your POST Data's
postApiCall('PART_OF_URL_STRING', {data}, (response) => {
    console.log(response);
});

For Put Method, call putApiCall method to make the request and get the respsonse.

var data = {} // Your Data's
putApiCall('PART_OF_URL_STRING', {data}, (response) => {
    console.log(response);
});

For Patch Method, call patchApiCall method to make the request and get the respsonse.

var data = {} // Your Data's
patchApiCall('PART_OF_URL_STRING', {data}, (response) => {
    console.log(response);
});

For Delete Method, call deleteApiCall method to make the request and get the respsonse.

var data = {} // Your Data's
deleteApiCall('PART_OF_URL_STRING', {data}, (response) => {
    console.log(response);
});

For storing items in Cookie, Use set, get and remove Cookie items.

For set item, use below to set the item to store in Cookie.

setCookie(name, value);

For set item with expiry, use below to set the item to store in Cookie with Expiry.

setCookieWithExpiry(name, value, no_of_expiry_days);

For get item, use below to get the item stored in Cookie.

getCookie(name);

For remove item, use below to remove the item stored in Cookie.

removeCookie(name);

For remove all items, use below to remove all the items stored in Cookie.

deleteAllCookies();

For storing items locally, Use set, get and remove Storage items.

For set item, use below to set the item to store in local storage.

storageSetItem(key, value);

For get item, use below to get the item stored in local storage.

storageGetItem(key);

For remove item, use below to remove the item stored in local storage.

storageRemoveItem(key);

For remove all items, use below to remove all items stored in local storage.

storageRemoveAll(key);

For storing items in session, Use set, get and remove Storage items in session.

For set item, use below to set the item to store in session storage.

sessionStorageSetItem(key, value);

For get item, use below to get the item stored in session storage.

sessionStorageGetItem(key);

For remove item, use below to remove the item stored in session storage.

sessionStorageRemoveItem(key);

For remove all items, use below to remove all items stored in session storage.

sessionStorageRemoveAll(key);

To Format Currency with Amount, Use the below to format currency.

currencyFormatter(amount, code);

For Example

currencyFormatter('120','INR'); // Returns ₹120

To Format Date with Time, Use the below to format.

showTimeZoneDate(full_date_with_time);

To Format Date and return only Date, Use the below to format.

showZoneDate(full_date_with_time);

To Format Time and return only Time, Use the below to format.

showZoneTime(date);

To capitalize the given text, Use the below to change the text to capitalized.

textCapitalize(text);

To return the value from Object.

To return the First Object Value from Object.

returnFirstDegreeObjValue(obj, key);

To return the Second Object Value from Object.

returnSecondDegreeObjValue(obj, key, postion);

To return the Third Object Value from Object.

returnThirdDegreeObjValue(masterobj, obj, key, postion);

To return the Fourth Object Value from Object.

returnFourthDegreeObjValue(masterobj, obj, key, postion, fourthObj);

To return the Fifth Object Value from Object.

returnFifthDegreeObjValue(masterobj, obj, key, postion, fourthObj, fifthObj);

To parse the Object.

parseJson(obj);

To stringify the JSON Object.

stringifyJson(obj);

To reload the window.

reloadWindow();

To reload the window to certain path.

reloadWindowToPath(path_to_load);

Author

This component is written by Muthukumar D.

License

Muthukumar D, 2022 © All Rights Reserved. [Muthukumar D]