Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

mlar

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mlar

Module Loader and Resolver

  • 0.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
63
increased by43.18%
Maintainers
1
Weekly downloads
 
Created
Source

🌵🌴A simple Experiment🌴🌵

Module Loader And Resolver

Simple UTIL to help manage loading/resolving requires in large code bases. [ require("../../../xyz/blabla/iek.js") :pensive: require('mlar')('iek') :smile: ]

Usage

Requires that an r.json file be present in the root directory of your project. r.json is just a path map of your libraries, services, routes e.t.c. Anything "require-able" basically.

Sample r.json content

{
	"create_api":"/services/apis/create",
	"models":"/models/sequelize",
	"utils":"/libs/utils"
}

create_api ===== Module Alias /services/apis/create ===== Path to module

A few assumptions:

  • Every path in r.json is relative to the root directory of your project
  • The Module alias are not in conflict with any 3rd party libraries installed using NPM
  • If the module alias is not present in r.json, mlar assumes it's a third party library and attempts a direct require.

In-code example

// Single use
var sequelize_models = require('mlar')('models'); //sequelize_models is now whatever was exported at /models/sequelize
var crypto = require('mlar')('crypto'); //same as doing require('crypto');

//Multi use
var modules = require('mlar')(['models', 'utils', 'crypto']);
//modules.models, modules.utils, modules.crypto e.t.c.

FAQs

Package last updated on 09 Dec 2017

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