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

global-object-guard

v0.0.4

Published

`global-object-guard` is a utility module which provides straight-forward, powerful functions for working with global objects in JavaScript. Although originally designed for use with [Node.js](http://nodejs.org), it can not used in the browser.

Readme

global-object-guard lets you control and Manage Global Object

global-object-guard is a utility module which provides straight-forward, powerful functions for working with global objects in JavaScript. Although originally designed for use with Node.js, it can not used in the browser.

global-object-guard provides around 4 functions that include the usual 'functional' suspects (Create, getDifference, rePositionGlobalObject, refreshGlobalObject). All these functions assume you follow the Node.js convention. This will help the developer to track their global object in node and allow them to check the status of the global object and also helps them to clean the global object.

Quick Example

// Require this Package
var GlobalObjectGuard = require('global-object-guard');

//My All Global Object Settings
_appSetting = {
    PORT: 2000,
    HOST: "http://localhost"
};

_otherServerSetting = {
    //So on...
};
//--------------------------------------------

// Just Apply GlobalObjectGuard
var gb = GlobalObjectGuard.Create(global);

// Do your code .......

// Some time Mistake get happen
obj = {name: "Kashish", age: 24};

// Don't worry just check the Global Pollution if you want.
var result = gb.getDifference();
console.log("Checking Global Object Pollution: ", result);
// Output: Checking Global Object Pollution:  { obj: [ { name: 'Kashish', age: 24 } ] }

// You can RePosition Your Global Object State
// This will Set Your Current Global State as a default State
// (NOTE: ALL THE GLOBAL POLLUTION BECOME THE PART OF GLOBAL OBJECT)
gb.rePositionGlobalObject(global);

// Recheck the Status
result = gb.getDifference();
console.log("After RePosition the Global Object: " + JSON.stringify(result));
// Output: After RePosition the Global Object: {}

// Lets do some mistake
(function () {
    person = {address: "B4-90 US"}
})();

result = gb.getDifference();
console.log("Opes Just hit the global object: " + JSON.stringify(result));
// Output: Opes Just hit the global object: {"person":[{"address":"B4-90 US"}]}

// Let this GlobalObjectGuard take care this cleaning work.
gb.refreshGlobalObject();

// Check the status. Every Thing is Clean Now.
result = gb.getDifference();
console.log("Everything is clean by GlobalObjectGuard: " + JSON.stringify(result));
// Output: Everything is clean by GlobalObjectGuard: {}

Download

The source is available for download from GitHub. Alternatively, you can install using Node Package Manager (npm):

Installation

$ npm install global-object-guard