Skip to content

JamesMartinus/Include

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 

Repository files navigation

Include

Include is a script that allows the importing of ES6 Classes into Node.js, I made this module for convenience and make it easier to break up code and, in the future, use namespaces.

Usage

Sample class.js

export class Foo{
    constuctor(){
        this.property = ""
    }
    aFunction(){
        return this.property;
    }
    static aStaticFunction(value){
        console.log(value);
    }
}

In Node.js

const { include } = require('include');
include('class.js');

const foo = new Foo();

The script supports the import statement from within the ES6 class

Sample anotherclass.js

import { BrowserWindow } from "electron";

import { Foo } from "./class";

export class Bar{
    constructor(){
        this.window = new BrowserWindow();
        this.foo = new Foo();
    }
}

About

Script designed to import ES6 classes

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published