customizable-loader

1.0.0 • Public • Published

customizable-loader

Simple utility to customize your own scripts loader (for Node.js only).

It lets you...:

  1. Set your own basepath for each loader you instantiate.

  2. Extend each loader to add new capabilities to it.

  3. Specify the paths through an array of strings, or through a string.

1. Installation

  ~$ npm install customizable-loader

2. Usage

1. Import it in your code:

  var Loader = require("customizable-loader");

2. Create your own custom loader

You must specify the basepath of each loader, and optionally, a function that tells how to extend this custom loader:

    var MyLoader = new Loader(__dirname, function(loader) {

      loader.newFunctionality = "...";

    });

3. Use your own customized loader freely:

  1. You can resolve paths from strings:

     // This will return a string only:
    
     MyLoader.resolve("path", "to", "my", "script");
    
  2. Or you can directly include Node.js modules from strings:

    // This will return the Node.js module exported from the specified file:
    
    MyLoader.include("path", "to", "my", "script"); // This returns the Node.js module
    
  3. Also, you can pass directly the path you want in a string, and it will work the same:

    MyLoader.include("path/to/my/script");
    

That is it.

Readme

Keywords

none

Package Sidebar

Install

npm i customizable-loader

Weekly Downloads

0

Version

1.0.0

License

it would be nice to give to the people a non-economical-based solution. Because it's not fair, they didn't allow us to study everything, but they want us to work for their shitty elites. No, I am not okay with that, they are enslaving people all over the world, and you still care about the same shitty things... it's sad, come on, it's sad, and you know it. Do you need me to list every fucking shit this world is doing against human beings, just because of the unstoppable game of the money? Like, fucking up the weather? Like creating wars all over the world for money? Creating TERRORISM for money? Do you really wnat me to tell you every shit I already know about this fuckep up world? I am sad. But the context, it's an ironic joke... and you? The planet is full of blind rats, that's how they programmed us, that's how they still program us to think. I'll be a fool, but not a fucking rat, which is the main problem in this shitty planet: RATs that look like HUMANs.

Last publish

Collaborators

  • allnulled