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

oxy-utility

v1.2.0

Published

oxy-utility is your go-to solution for logging and tracking functionalities in JavaScript applications. Monitor function execution times, and take control of your code's performance effortlessly.

Downloads

74

Readme

Oxy-utility: Empowering Your JS With Insights

Oxy-utility is your go-to solution for logging and tracking functionalities in JavaScript applications. Monitor function execution times, and take control of your code's performance effortlessly. Best used with Zustand Controller Architecture.

Features

  • Beautiful Console Logs: Enhances debugging experience with visually appealing and informative console logs.
  • Execution Stats: Provides detailed statistics on function execution times, aiding in performance analysis.
  • Execution Grouping/Chaining: Automatically groups chained function executions for better visibility and understanding of execution chains.
  • Exportable Stats: Easily export statistics data to JSON or CSV formats for further analysis or reporting.
  • Benchmarking: Compare old and new stats with benchmarking functionality, facilitating performance regression testing.
  • Easy Setup: Quick and hassle-free setup process ensures seamless integration into your projects.
  • Lightweight: Pure JavaScript implementation with no external dependencies, keeping your project lean and efficient.
  • Production Ready: With OxyLocker, Oxy can be used in production for rapid debugging.
  • Record (Experimental): Experimental feature to record function arguments and responses, useful for testing automation and debugging.

Setup

  1. Install oxy-utility using npm or yarn: npm install oxy-utility
  2. Use it on your Controller / Object of functions
import { Oxy, OxyLocker } from "oxy-utility";
const oxy = Oxy({ // set up the config - 
	enable: true, // isTestEnv()
	log: true, 
	stats: true, 
	group: true, 
	record: true, 
	fnPrefix: "Controller" 
});

// Oxify your controller and thats it.
export const Controller: IController = oxy.oxyfy({
...bearController,
...pandaController,
})

// Optional - lock Oxy, useful for use in production.
// Use your custom unlocking mechanism
const  OxyUnlockFn  = (userInput) => {
	const  token  =  decodeJWT(getAuthToken())
	if (yourLogicToUnlock()) {
		console.log("Authenticated - "  +  token.userId)
		return true
	}
	return false
}

const  lockedOxy  =  OxyLocker(oxy, OxyUnlockFn, "Oxy");
declare  global {
	interface  Window {
		Oxy:  any
	}
}

// export to window for using it.
window.Oxy  =  lockedOxy

Configuration:

  • enable: Indicating whether Oxy should be enabled (true by default). Setting it to false will turn off Oxy completely.
  • log: Indicating whether console.log statements should be enabled (true by default). If set to false, console.log statements will be disabled.
  • group: Indicating whether Oxy should attempt to group chained controllers if they are triggered simultaneously (true by default).
  • stats: Indicating whether statistics tracking should be enabled (true by default).
  • record: Indicating whether Oxy should record every function's arguments and responses (false by default). // (experimental)
  • fnPrefix: A string representing the prefix added to console.log statements ("Controller" by default).

Usage

  • unlock(userInput): If you are using OxyLocker, you will need to 1st unlock it to access the below methods.
  • viewConfig(): Retrieve the current configuration settings.
  • saveConfig(): Save the current configuration settings.
  • resetConfig(): Reset the configuration settings.
  • enable(): Enable a specific feature. Default will enable Oxy
  • disable(): Disable a specific feature. Default will disable Oxy
  • getStats(): Retrieve statistics about function execution times.
  • resetStats(): Reset the statistics.
  • exportStats(fileFormat, formatTime): Export statistics data in a specified file format (default: CSV).
  • benchmarkStats(): Benchmark the statistics.
  • getDeviceInfo(): Retrieve device information.
  • getRecords(): Retrieve recorded data.
  • exportRecords(maxSize): Export recorded data (default maximum size: 10000).
  • getErrors(): Retrieve error stack.
  • getProxy(): Retrieve the proxy object.
  • oxyfy(): Apply interception to an object.

Note: saveConfig() will store Oxy's configuration in the browser's localStorage, ensuring that once configured, your settings persist even after a page refresh. This seamless storage mechanism enhances usability, particularly in production environments.

Whats Next ?

In the pipeline for Oxy:

  • Oxy Extension: Stay tuned for the upcoming extension release, promising enhanced functionality and efficiency.
  • Zustand Middleware: Log updates in your zustand store, this will be plugged into the upcoming extension
  • Zustand Controller Boilerplate: Simplifying state management with a dedicated boilerplate for the Zustand Controller Architecture.
  • Theme Config: Enable customization of theme for the console.logs
  • Enhanced Stats: Expect more comprehensive statistical tracking features.
  • TypeScript Integration: Transitioning to TypeScript for improved type safety and developer experience.
  • Expanded Functionality: Exporting additional utility functions for broader application support.

Keep an eye out for updates as Oxy evolves to empower your JavaScript projects even further.

Feature Requests/Report Issues

Found an issue or have a cool idea? We'd love to hear from you! Feel free to raise any issues or submit feature requests on our GitHub repository. Your feedback helps us improve Oxy and make it even better for everyone. Together, let's make Oxy the best it can be!

Contribution

Oxy is an open-source project and welcomes contributions from the community. Whether it's bug fixes, new features, or enhancements, your contributions are valuable. To contribute, simply clone the repository, create a feature branch for your changes, and submit a pull request. Let's collaborate and make Oxy the go-to solution for JavaScript logging and tracking functionalities. Join us in shaping the future of Oxy!

Like Oxy?

If you find Oxy useful, consider giving it a GitHub star to show your support. Your appreciation motivates us to continue improving and expanding its capabilities. Thank you for being part of the Oxy community!