npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript.Learn more »

greguire

1.0.2 • Public • Published

greguire

npm

greguire is a package that is good for people, who want to break their code into multiple files, but want shared variables

Installing

npm i greguire

Put this at the begining of your main file:

var _greguire = require("greguire");
var greg = path => {return eval(_greguire(path)) }

Usage

greg(path)

path is the absolute path of the script you want to greguire

greg always returns module.exports

Usage example

index.js

var creativeName = "valueOfVar";
var _greguire = require("greguire");
var greg = path => {return eval(_greguire(path)) }
 
greg(__dirname+"/script.js")();

script.js

module.exports = function(){console.log(creativeName)};

Working demo can be found: here.

Running index.js would result in the output: "valueOfVar"

Keywords

install

npm i greguire

Downloadsweekly downloads

0

version

1.0.2

license

MIT

homepage

gitlab.com

repository

Gitgitlab

last publish

collaborators

  • avatar
Report a vulnerability