title: How can I extend a class in Node JS by my custom constructor?
body: <p>I have the following in a <code>Node Js</code> model. This file exists in another project that cannot be changed but is locally available to the other projects.</p>
  
  <pre><code>module.exports = {
      base: require('*/cartridge/models/product/decorators/base'),
      availability: require('*/cartridge/models/product/decorators/availability')
  };
  </code></pre>
  
  <p>All the methods here act like <code>constructors</code> of the <code>class Product</code>. Now I want to add another attribute that should be available when I try to access <code>Product.badge</code>. For this, I have tried to extend the above model in the following way:</p>
  
  <pre><code>var indexBase = require('*/cartridge/models/product/decorators/index');
  
  indexBase.badge = require('*/cartridge/models/product/decorators/badge');
  
  module.exports = indexBase;
  </code></pre>
  
  <p>But it seems throw an error, I have tried to log the <code>Badge Type</code>, but I still cannot access the badge type here.</p>
  
  <p>I am calling the above object as the following:</p>
  
  <pre><code>var decorators = require('*/cartridge/models/product/decorators/index');
  decorators.badge(product, variantProduct);
  </code></pre>
  
  <p>I want to know how can I extend an existing class as I want to add a custom <code>constructor</code>?</p>
  
  <p><em>Here only the syntax is based on <code>Node Js</code> but this code is written for SFRA in Salesforce B2C Commerce.</em></p>