@activeprospect/indexer

1.3.6 • Public • Published

Indexer

This Node.JS module requires a directory of JavaScript (or CoffeeScript) files and makes the associated modules available. It can be used to extend a specified module.

Build Status

Usage

Assume the following directory structure:

zoo
|-- ape.js
|-- donkey.js
|-- zebra.js

Add an index file (zoo/index.js) which delegates to the indexer module:

var path = require('path');

var index = require('indexer');

// index all the files in the same directory and extend this module
index(__dirname, module);

Then to use the zoo module:

var zoo = require('zoo');

zoo.ape    // returns the module defined in zoo/ape.js
zoo.donkey // returns the module defined in zoo/donkey.js
zoo.zebra  // returns the module defined in zoo/zebra.js

Reference

This module exports a single function with the following parameters:

  • dirname — the directory of files to index (.js and .coffee files will be indexed)
  • module — (optional) export each module in dirname to this module.
  • ignoreModules — the rest of the parameters passed to the function are module names to ignore (i.e. index(__dirname, module 'ape', 'donkey') will only export the zebra module)

The object returned by the function has a property for each module in the dirname.

Dependencies (0)

    Dev Dependencies (8)

    Package Sidebar

    Install

    npm i @activeprospect/indexer

    Weekly Downloads

    238

    Version

    1.3.6

    License

    MIT

    Unpacked Size

    9.35 kB

    Total Files

    8

    Last publish

    Collaborators

    • dusan.pantelic.ap
    • greenasgrassap
    • jevensen
    • daniel.gershin
    • celolb
    • rafael.uchoa
    • jarrodbmiller
    • terbepetra
    • matteo.pandolfi
    • ericyd_ap
    • ivisilva
    • henriquelaki
    • carlo.anselmi
    • stefano.santonocito
    • carlhannusch
    • robdll
    • jorgemarrufo
    • apshoebkhan
    • samullen-ap
    • dpjones09
    • josevsp
    • johnb2
    • rickymcmurtrey
    • jgrayson03
    • apadmin
    • alexkwolfe
    • kellym
    • cgrayson
    • steveodom
    • ap_luisferreira
    • alisimbanegavi
    • benjmartin
    • sammarten
    • gabriel.roldan.ap
    • stwf-ap