Notoriously Psychedelic Modules

    node-use

    1.0.0 • Public • Published

    Tutorial Video

    Watch on YouTube

    Introduction

    node-use is designed to be an easy approach to global package management, implementing a system that functions similar to traditional include statements, like the ones found in C#, C++, Python, etc.

    Using node-use

    1. Install node-use with NPM
    npm install node-use
    
    1. Require node-use (You only need to do this once at the beginning of your code)
    require('node-use')
    

    node-use PATH

    By default, node-use will search in the lib directory at your code's root when you attempt to use a library. You can add items to the PATH by pushing elements to the __usePATH variable:

    __usePATH.push("path/to/your/lib/folder");
    

    use function

    The use function takes a string, and can be used anywhere in your code, after you have typed require('node-use'). use will search all existing directories in __usePATH.

    use("com.jessedunlap.SomeLibrary");
    

    The above statement would look for the file lib/com/jessedunlap/SomeLibrary.js. Additionally, if the last item in the path specified is a directory, use will automatically search that directory for all .js files.

    Any files found will be added to the global object, allowing them to be utilized globally. The file name is used to determine the key in the global object. (e.g. if the file is named SomeLibrary.js you could then access SomeLibrary by simply writing SomeLibrary.whatever())

    Libraries are written just like node modules, using module.exports. Anything exported from the module will be added to the global value.

    Keywords

    none

    Install

    npm i node-use

    DownloadsWeekly Downloads

    4

    Version

    1.0.0

    License

    MIT

    Last publish

    Collaborators

    • jesse.dunlap