🦸‍♂️Superman

superman

Create items in a class object easily!

Examples

class.js
const { Superman } = require('coreplus')('superman');

class Item extends Superman {
    constructor(x, y, width, height, id) {
        super(x, y, width, height, id);
    }
}

console.log(new Item(10, 20, 240, 190, 'block'));
$ node class.js
Item { x: 10, y: 20, width: 240, height: 190, id: 'block' }
function.js
const { superman } = require('coreplus')('superman');

class Item {
    constructor(x, y, width, height, id) {
        superman(this, x, y, width, height, id);
    }
}

console.log(new Item(10, 20, 240, 190, 'block');

Use

Class

First, require the Superman class using the namespace superman

Then create a class that extends Superman

Then use super to add the arguments

super( ... ); - Arguments: everything you want to add to the object.

Function

First, require the superman function using the namespace superman

Then create a class

Then use superman to add the arguments

superman( Class , ...); - Argument: this keyword.

superman(Class, ... ); - Arguments: everything you want to add to the object.

Last updated