JSPM

enquire

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 371
  • Score
    100M100P100Q19985F

an environment based replacement for node.js require

Package Exports

  • enquire

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (enquire) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

enquire

an environment based replacement for node.js require

Installation

$ npm install enquire

why

enquires task is simple; wrap the node.js require module to provide environment based modularisation.

this module should be useful for the following scenarios

 - abstract away some io bound resource in order to simplify a dev or test environment
 - environment configuration that requires code execution

Usage

Example 1; with module request, default NODE_ENV

given the following module structure

/some_module/
    index.js
/some_module-development/
    index.js

when we request some_module with default NODE_ENV

 var module = enquire('some_module');

then return some_module

 module = some_module

Example 2; with module request, development NODE_ENV

given the following module structure

/some_module/
    index.js
/some_module-development/
    index.js

when we request some_module with NODE_ENV set to "development"

 process.env.NODE_ENV = "development";
 var module = enquire('some_module');

then return some_module-development

 module = some_module-development

Example 3; with module request, environment parameter override

given the following module structure

/some_module/
    index.js
/some_module-development/
    index.js

when we request some_module overriding environment parameter as "development"

 var module = enquire('../test/doubles', "development");

then return some_module-development

 module = some_module-development