Registry / web-framework / o3
library0.4.2jsnpmunverified

The `o3` package, also known as Ozone, is a JavaScript class framework designed to bring enhanced object-oriented programming capabilities to ES5 environments. Released as version 1.0.3, its last significant update was over five years ago, indicating it is no longer actively maintained and can be considered abandoned. It aimed to provide class-like inheritance and structure at a time when native ES6 classes were not widely supported, offering an alternative to transpilers like Babel or TypeScript for class definitions. The framework requires an ES5-compatible environment, specifically relying on `Object.create` and ES5 property enumeration features. Its primary differentiator was enabling robust class inheritance in older runtimes without needing a build step. Due to its age and the universal adoption of native ES6 classes, its utility in modern JavaScript development is minimal.

npm install o3
INSTALL
IMPORT
SIG · O3
O
o3
web-frameworkjavascriptv0.4.2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

o3
const o3 = require("o3");
import o3 from 'o3';
The primary way to import the entire o3 module in CommonJS environments, which is its intended use case.
Class
const { Class } = require("o3");
const Class = require("o3");
The `Class` constructor is a named export (or property of the main module object) within `o3`. Directly requiring `o3` gives you the main object, from which `Class` can be destructured or accessed as `o3.Class`.
Class
const Class = o3.Class; // after const o3 = require('o3');
import { Class } from 'o3';
As an ES5-focused library primarily designed for CommonJS, ESM `import` syntax is not supported and will fail to resolve the module or its exports.

Demonstrates defining a base class and an inheriting class using o3's `Class` and `extend` methods, showcasing object instantiation and method calls.

const o3 = require("o3"); const Class = o3.Class; // Define a base class inheriting from Object const BasePerson = Class(Object, { prototype: { // Constructor function constructor: function BasePerson(name) { this.name = name; }, // A method sayHello: function() { console.log(`Hello, my name is ${this.name}.`); } } }); // Define a derived class using the inherited extend method const Employee = BasePerson.extend({ prototype: { constructor: function Employee(name, position) { // Call the super constructor BasePerson.prototype.constructor.call(this, name); this.position = position; }, // Override or add new methods sayHello: function() { console.log(`Hello, I'm ${this.name} and I'm a ${this.position}.`); }, work: function() { console.log(`${this.name} is working.`); } } }); const person = new BasePerson("Alice"); person.sayHello(); const employee = new Employee("Bob", "Software Engineer"); employee.sayHello(); employee.work();
Debug
Known issues
breakingThe `o3` framework is strictly designed for ES5 compatible environments. It will not function correctly in older JavaScript engines (e.g., IE8 or below) lacking `Object.create` or full ES5 property enumeration support.
fix
Ensure your target environment supports ECMAScript 5. This framework is not suitable for pre-ES5 environments.
affects: >=1.0.0
deprecatedThe `o3` package is no longer actively maintained, with its last publish occurring over five years ago. Users should consider alternatives like native ES6+ classes or modern transpilers (e.g., Babel, TypeScript) which provide robust and actively supported class functionalities.
fix
For new projects, prefer native ES6+ class syntax. For existing projects, evaluate migration to modern patterns or be aware of potential security and compatibility issues due to lack of maintenance.
affects: >=1.0.0
gotchaThe framework explicitly does not support Opera due to issues with its Karma test launcher at the time of development. While it might function, official compatibility is not guaranteed.
fix
Avoid using o3 in applications where Opera browser compatibility is a critical requirement.
affects: >=1.0.0
gotchaWhen inheriting from native classes like `Error`, special care must be taken with the constructor and `Error.captureStackTrace` to ensure correct stack trace capturing and `this` context binding.
fix
Always include `Error.captureStackTrace(this, this.constructor);` in custom Error class constructors when extending `Error` to preserve correct stack information. Ensure `this` context is correctly bound when calling super constructors via `call` or `apply`.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: Object.create is not a function
The JavaScript environment is not fully ES5 compatible and lacks the `Object.create` method, which `o3` relies on heavily for inheritance.
fix
Upgrade your JavaScript engine or ensure polyfills for ES5 features are loaded before initializing `o3`. However, the framework is not recommended for environments requiring extensive polyfilling.
TypeError: Cannot read properties of undefined (reading 'Class')
The `o3` module was not successfully required or imported, meaning the `o3` object is `undefined` when attempting to access `o3.Class`.
fix
Verify that `require('o3')` is correctly resolving the package. Check your `node_modules` directory and ensure the package is installed. If using a bundler, confirm its configuration allows CommonJS imports.
TypeError: (0 , _o3.Class) is not a function
Attempting to use ES Modules `import { Class } from 'o3';` syntax with `o3`, which is primarily a CommonJS module and does not expose `Class` via named ESM exports.
fix
Use CommonJS `require` syntax: `const { Class } = require('o3');` or `const o3 = require('o3'); const Class = o3.Class;`.
Upgrade
Version history
0.4.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources