🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

astral-pass

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

astral-pass

Pass system for Astral

0.1.0
latest
Source
npm
Version published
Weekly downloads
4.8K
11.1%
Maintainers
1
Weekly downloads
 
Created
Source

Astral Pass

Pass helper for Astral that simplifies traversal.

Example

Below is a simple example.

var myPass = require('astral-pass')();

myPass.name = 'myPass';
myPass.prereqs = [ /* other pass names here */ ];

myPass.
  when({
    // ... AST chunk
  }).
  when(function (chunk, info) {
    // return true or false
  }).
  do(function (chunk, info) {

  });

More Complicated Passes

You can introduce more complicated behavior by composing passes. This is done by modifying a pass's prereqs property.

var astralPass = require('astral-pass');

// p1 needs some info to do its transformations

var p1 = astralPass();
p1.name = 'myPass';
p1.prereqs = [ 'p2' ];

p1.
  when( ... ).
  do( ... );

// p2 gathers the info for p1

var p2 = astralPass();
p2.name = 'myPass';

p2.
  when( ... ).
  do( ... );

I recommend namespacing passes with :.

License

MIT

Keywords

astral

FAQs

Package last updated on 05 Jun 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