{"library":"preceptor-core","title":"Preceptor Core Components","description":"Preceptor-Core is a foundational JavaScript library designed to provide shared components for the Preceptor test runner and aggregator ecosystem. It exposes a `Base` object intended for inheritance, featuring an `extend` method that supports a `__super` call mechanism for methods, mimicking classical inheritance patterns. Additionally, it offers a `utils` module with common utility functions like `deepExtend` and `combine`, and a centralized `log` management system. Currently at version 0.10.1, the package appears to be unmaintained, with its last update several years ago. Its primary use case was as an internal dependency for the Preceptor project. As such, it does not have an active release cadence and is likely incompatible with modern Node.js versions or ES module environments.","language":"javascript","status":"abandoned","last_verified":"Sun Apr 19","install":{"commands":["npm install preceptor-core"],"cli":null},"imports":["const core = require('preceptor-core');","const Base = require('preceptor-core').Base;","const { utils } = require('preceptor-core');"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"const core = require('preceptor-core');\n\nconst BaseObject = core.Base;\n\n// Create a new constructor inheriting from Base\nconst MyComponent = BaseObject.extend(\n  function MyComponent(name) {\n    this.__super(name); // Call parent constructor if needed, though Base's constructor is minimal\n    this.name = name;\n    this.init();\n  },\n  {\n    // Prototype properties\n    init: function() {\n      console.log(`MyComponent initialized: ${this.name}`);\n      this.emit('ready', this.name);\n    },\n    greet: function() {\n      console.log(`Hello from ${this.name}!`);\n    },\n    // Example of overriding and calling super\n    destroy: function() {\n      console.log(`${this.name} is being destroyed.`);\n      this.__super(); // Call the parent's destroy if it existed\n      this.removeAllListeners();\n    }\n  },\n  {\n    // Static properties\n    TYPE: 'MyComponentType'\n  }\n);\n\nconst instance = new MyComponent('MyFancyComponent');\ninstance.on('ready', (name) => console.log(`Event: ${name} is ready!`));\ninstance.greet();\ninstance.destroy();\n\n// Example of using utils\nconst { deepExtend } = core.utils;\nconst obj1 = { a: 1, b: { c: 2 } };\nconst obj2 = { b: { d: 3 }, e: 4 };\nconst merged = deepExtend({}, obj1, obj2);\nconsole.log('Deep merged object:', merged);","lang":"javascript","description":"Demonstrates installing, requiring, and using `preceptor-core`'s `Base` object for inheritance with its `extend` method, including `__super` calls, and an example of `deepExtend` from the `utils` module.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}