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

astral-angular-annotate

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-angular-annotate

AngularJS DI annotation pass for astral

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5K
increased by10.9%
Maintainers
1
Weekly downloads
 
Created
Source

Astral Angular Annotator

A pass for Astral to generate AngularJS [DI annotations](TODO: find docs) automatically.

For a tool CLI, see `[ngmin](TODO: link).

Usage

Below is an example parsing, annotating, and generating JavaScript code. Note that this requires the esprima, escodegen, astral, and astral-angular-annotator npm packages.

var esprima = require('esprima'),
  escodegen = require('escodegen'),
  astral = require('astral')();

// register angular annotator pass
require('astral-angular-annotator')(astral);

var inputCode = "angular.module('myMod').controller('FooCtrl', function ($scope) {" +
"  // ..." +
"});";

var ast = esprima.parse(inputCode, {
  tolerant: true
});

astral.run(ast);

var generatedCode = escodegen.generate(ast, {
  format: {
    indent: {
      style: '  '
    }
  }
});

console.log(generatedCode);

// logs:
//
// angular.module('myMod').controller('FooCtrl', ['$scope', function ($scope) {
//   // ...
// });

API

You can also access each of the individual passes like this:

This might be handy for more fine-tuned control.

License

MIT

Keywords

FAQs

Package last updated on 02 Jul 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