New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

helpers

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

helpers

helper functions for Node.js

  • 0.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
907
increased by39.11%
Maintainers
1
Weekly downloads
 
Created
Source

node-helpers

some simple functions for Node.js to help in normalizing requiring modules across platforms and when run from external scripts such as testing frameworks or npm.

why

Running "npm test" does not resolve '.' correctly on my windows x64 pc and I got tired of copying and pasting the boilerplate in this little module just to be able to require my submodules easily. This module is only (possibly) relevant if you care whether your tests run properly on Windows or not and want to save some minor repetitive effort.

installation

npm install helpers

usage

var h = require('helpers')(__dirname, exports);

methods

suppose you have a directory structure like

/lib
  - index.js
  - myLib1.js
  - myLib2.js

then the following examples could be taken from index.js:

sub

require a module by name relative to the current module's directory

var myLib1 = h.sub('myLib1');
// myLib1 = whatever myLib1.js is exporting
exp

export a module by name relative to the current module's directory

h.exp('myLib1');
// exports.myLib1 = whatever myLib1.js is exporting
mixin

export the properties of a module within the current module

h.mixin('myLib1');
// basically the same as if you cut and paste myLib1.js into the current module

If the above is not clear take a look at the test.js file. It is short and easy to understand.

####tests To run the tests you will need to have mocha installed, then just cd into the dir node-helpers is installed and type:

mocha
license: MIT

see LICENSE.txt for more info

FAQs

Package last updated on 26 Feb 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc