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

kodekita

v1.0.16

Published

javascript reusable code collection

Downloads

1

Readme

kodekita

Kodekita is a collection of javascript code that can be reused without rewriting the code.


Daftar Isi


Installation

npm install --save kodekita

Usage

import React, { Component } from "react";
import { initGlobalTools } from "kodekita";
initGlobalTools({ devLog: true, devStatus: true });

class App extends Component {
	componentDidMount( ) {
		/** same as console.log, but the logs will not be displayed after the production / npm run build */
		window.devLog( `Dev Status: ${ window.devStatus }` );
	}
	render( ) {
		return (
			<div>
				<h1>Hello Joko!</h1>
				<p>Happy Hacking! :)</p>
			</div>
		);
	}
}

export default App;

API

initGlobalTools

initGlobalTools( object:config ) will initiate a global variable or function that can be accessed freely without importing

import { initGlobalTools } from "kodekita";
// call on the root component index.js
initGlobalTools({ devStatus: true, devLog: true });

console.log( window.devStatus ); // return true if it is under development
window.devLog( 'this message will not appear after production!' ); //can be used to view logs only during development

Name | Description | Type | Config
--------|---------- | ----|------ window.devLog( all:log ) | same as console.log, but the logs will not be displayed after the production / npm run build | function | devLog : true window.devStatus | Global boolean variable that contains true if running under development | boolean | devStatus : true window.localhostStatus| Global boolean variable that contains true if running under localhost | boolean|localhostStatus : true *variables and functions are not needed| Configuring to disable React Developer Tools extension. This feature is only needed if the browser uses the React Developer Tools extension |boolean|disableReactDevTools : true

promiseAll

promiseAll( list:functions ) will execute multiple functions asynchronously

import { promiseAll } from "kodekita";
function showLog( ) {
	console.log( 'Im here!' );
}
promiseAll([ showLog, showLog, showLog ]);

isJsonString

isJsonString( string:jsonString ) will check and return true if string is a stringified JSON

import { isJsonString } from "kodekita";
const stringifiedJson = '{name:"Joko",gender:"male",city:"Bekasi"}';
isJsonString( stringifiedJson ); //true

idrCurrencyFormatter

idrCurrencyFormatter( number:currency ) will format integer into IDR currency format

import { idrCurrencyFormatter } from "kodekita";
idrCurrencyFormatter( 64000 ); //Rp 64000

idrCurrencyParser

idrCurrencyParser( string:currency ) will parse IDR currency into integer

import { idrCurrencyParser } from "kodekita";
idrCurrencyParser( 'Rp 64000' ); //64000

greeterText

greeterText( string:name ) will display greeter with name

import { greeterText } from "kodekita";

greeterText( 'Joko' );

setSession

setSession( string:header, string:value) stores data to Session Storage.

import { setSession } from "kodekita";

setSession( 'name', 'Joko' );

getSession

getSession( string:header ) get data from Session Storage.

import { getSession } from "kodekita";

getSession( 'name' );

deleteSession

deleteSession( string:header ) delete data from Session Storage.

import { deleteSession } from "kodekita";

deleteSession( 'name' );

clearSession

clearSession() clear all data from Session Storage.

import { clearSession } from "kodekita";

clearSession( );