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 🙏

© 2026 – Pkg Stats / Ryan Hefner

kube-f

v0.2.8

Published

A framework for easy scaling through namespaces

Readme

Kube

The Kube framework.

installing

Just Kube

  $ git clone [email protected]:Kube-f/Kube.git
  $ cd Kube
  $ yarn install

Through yarn

$ yarn add kube-f

quickstart

import Kube from 'kube';

const myKube = new Kube();
const aNamespace = myKube.namespace('aNamespace');

aNamespace.def(function coolFunction(a) {
  return a;
});

aNamespace.coolFunction('hello kube!')
  .then(function handleCoolFunctionResult(a) {
    console.log(a); //hello kube!
  });

Docs

Kube()

The Kube object is the focus of this framework. It keeps track of the global state aswell as the namespaces you define on it. It has few functionalities, but the ones it does have are quite usefull.

the Kube object should only be instantiated once across your application, this is to prevent undefined behaviour when you try to access namespaces from other kubes. The Kube object can be instantiated like so:

const myKube = new Kube();

.namespace()

Within your Kube object, you can instantiate so called namespaces. These namespaces serve as a clean way to keep different parts of your application seperated from eachother. This being said, it is also extremely easy to access different namespaces defined on the same Kube() instance.

You can define a namespace like so:

  const myNamespace = myKube.namespace('myNamespace'); //instantiating the namespace
  const alsoMyNamespace = myKube.namespace('myNamespace'); //importing the namespace

As you can see, once a namespace is created, it cannot be redefined. This is done so you can import the namespace wherever you want once it is defined elsewhere and use the functions defined on it.

.def(fn)

.def(fn) is a function that is present on all namespaces that allows you to define a function on the namespace itself. This means that functions defined on a certain namespace can only be used when the namespace is imported.

It is also important to note that all functions defined through def are promisified on definition to make sure all functions are executed at the right time preventing things like race conditions adn unexpected behaviour

For example, this is how it can be used:

  const myNamespace = myKube.namespace('myNamespace');
  
  myNamespace.def(function myCoolFunction(a) {
    return a;
  });
  
  myNamespace.myCoolFunction('hello kube!')
    .then(function handleMyCoolFunctionResult(a) {
      console.log(a); //hello kube!
    })

.def() does require you to provide a named function, this means that the following example will yield an Function name not defined error. This error will be thrown by kube itself.

  const myNamespace = myKube.namespace('myNamespace');
  
  myNamespace.def(function (a) {
    return a;
  }); //throws "Function name not defined" error
  

mountModule(fn(kube, arg))

mountModule is a special function that allows you to define functions on a global scale instead of limiting yourself to a namespace. Use of a new namespace is always preferred but sometimes to apply the DRY rule, you must define something globally.

import kube from 'kube';
import globalActions from './gobalActions'

const myKube = new Kube();

myKube.mountModule(globalActions);

myKube.globalActions.someGlobalAction();

loadModule(fn)

The loadModule(fn) function is a small wrapper around fn.call that injects the this scope into the function. This function is different from mountModule(fn) as it does not mount the module onto the Kube instance.

import kube from 'kube';
import initScript from './initScript'

const myKube = new Kube();

myKube.loadModule(initScript);

FAQ

Why is every function defined with def() a promise ?

It is very benificial to have your entire flow be asynchronous. This way you can be sure every step of your application finishes and prevent things such as file access before the file is created and other races that you would otherwise had to deal with