Registry / web-framework / core-object

core-object

JSON →
library3.1.5jsnpmunverified

CoreObject is a JavaScript library providing a lightweight, robust implementation of an OOP Class model. It was primarily developed for and used within the Ember-CLI ecosystem to define and extend classes, facilitating a structured approach to object-oriented programming in JavaScript. The package supports Node.js environments from version 4 onwards. While the latest public version is 3.1.5, its last major update was published approximately nine years ago, indicating that the project is currently abandoned. Consequently, there is no active release cadence, and it is not recommended for new projects seeking ongoing maintenance, security updates, or modern JavaScript features. Its primary value now lies in its historical context within legacy Ember-CLI applications, where it continues to function as a core utility.

npm install core-object
INSTALL
IMPORT
SIG · CORE-OBJECT
C
core-object
web-frameworkjavascriptv3.1.5
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.

CoreObject
import CoreObject from 'core-object';
import { CoreObject } from 'core-object';
While a CJS module, Node.js ESM loaders will resolve the `module.exports` as the default import. There are no named exports.
CoreObject
const CoreObject = require('core-object');
const { CoreObject } = require('core-object');
CoreObject exports a single class as its default CommonJS export, not an object with named properties.
BasicClass
class BasicClass extends CoreObject {}
class BasicClass extends require('core-object') {}
Best practice is to import/require CoreObject first, then extend it, for clarity and consistency.

This quickstart demonstrates defining a base class, extending it, creating instances, and dynamically adding methods using `reopen`.

import CoreObject from 'core-object'; // Define a base class const Animal = CoreObject.extend({ init() { this._super(...arguments); this.name = 'Unnamed'; }, sayHello() { console.log(`Hello, I am ${this.name}.`); } }); // Extend the base class const Dog = Animal.extend({ init(name) { this._super(...arguments); this.name = name || 'Fido'; }, bark() { console.log(`${this.name} says Woof!`); }, sayHello() { this._super(...arguments); this.bark(); } }); // Create instances const genericAnimal = Animal.create(); genericAnimal.sayHello(); // Output: Hello, I am Unnamed. const myDog = Dog.create('Buddy'); myDog.sayHello(); // Output: Hello, I am Buddy.\nBuddy says Woof! myDog.bark(); // Output: Buddy says Woof! // Demonstrating `reopen` for adding methods dynamically Dog.reopen({ fetch() { console.log(`${this.name} is fetching!`); } }); myDog.fetch(); // Output: Buddy is fetching!
Debug
Known issues
breakingThe package is effectively abandoned, with its last public release (v3.1.5) over nine years ago. It receives no active maintenance, bug fixes, or security updates.
fix
Migrate to a modern, actively maintained class implementation or inheritance pattern (e.g., native ES6 classes, utilities like `classnames`, or framework-specific solutions). For legacy Ember-CLI projects, consider deeply analyzing the risk of using unmaintained dependencies.
affects: >=3.1.5
gotchaBeing an older CommonJS package, direct usage in pure ESM environments might require specific Node.js configuration or bundler setups to correctly interpret `require()` and `module.exports`. While Node.js often handles CJS imports in ESM, unexpected behaviors can arise, especially with tooling.
fix
Ensure your build tooling (e.g., Webpack, Rollup) is configured to handle CommonJS modules within an ESM project. For Node.js, confirm the `type: "module"` in `package.json` allows interoperability or use dynamic `import()` for problematic cases.
affects: >=1.0.0
gotchaThe `init` method in `CoreObject` classes requires calling `this._super(...arguments)` to ensure proper initialization of parent classes, similar to `super()` in native ES6 classes. Forgetting this call can lead to uninitialized properties or unexpected behavior from inherited constructors.
fix
Always include `this._super(...arguments)` as the first line in any overridden `init` method to ensure the inheritance chain's constructors are properly invoked.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: CoreObject is not a constructor or undefined
Incorrect import statement or module resolution failure in ESM context for a CJS package.
fix
For ESM, use `import CoreObject from 'core-object';`. For CJS, use `const CoreObject = require('core-object');`. Ensure your build/runtime environment correctly resolves CJS modules.
TypeError: this._super is not a function
Attempting to call `this._super()` in a method that does not override a parent method, or `init` method did not properly call `this._super()` in the constructor chain.
fix
Only call `this._super()` when truly overriding a parent method. In `init` methods, always include `this._super(...arguments)` as the first line. If a method is new, remove the `this._super()` call.
Upgrade
Version history
3.1.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
core-object — npm install core-object · libregistry