Wondering what’s next for npm?Check out our public roadmap! »

lego-require

0.0.1 • Public • Published

Get require() like node-requires by lexical analysis

changed name from "searequire"

Installation

npm install lego-require

Api

  • parseDependencies(code:String, callback:Function = null, flag:Boolean = false):String
  • parseDependencies(code:String, flag:Boolean = false):String
    • flag means if use "require.async" like, the result should have a property "flag" of ".async"

Example

js:

require('a');
//require('b');
/require('c')/;
'require("d")';
if(true)/require('e')/;
do /require('f')/.test(s); while(false);

parser output:

{
  "string": "require('a')",
  "path": "a",
  "index": 0,
  "flag": null
}

Keywords

Install

npm i lego-require

DownloadsWeekly Downloads

4

Version

0.0.1

License

none

Homepage

seajs.org/

Last publish

Collaborators

  • avatar