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

angular-extender

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

angular-extender

Extend AngularJS applications by injecting module dependencies at build time

  • 0.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Synopsis

Extend AngularJS applications by injecting module dependencies at build time (using static code transformations).

For example transforms this:

angular.module('moduleName', ['dependency']);

into that

angular.module('moduleName', ['dependency', 'additionalDependency']);

NPM

Build Status Coverage Status

Motivation

Nowadays having a project using Grunt (or any other similar tool) for workflow automation and asset management is not uncommon. So the idea with this small library is to provide a way to implement a simple plugin system for AngularJS applications using only static code transformations. This has two main advantages (compared to extending the module with dynamic tricks):

  • Keeps the code clean from boilerplate
  • The modules can be still declared in any order.

The main use case for such a system is when you have an AngularJS based application and you want to allow third party modules (plugins) to exend you core app without hardcoding those new dependencies.

Usage

var angularExtend = require('angular-extend');

var src = "angular.module('moduleName', ['aModule']);";
var res = angularExtend(src, {moduleName: ['aPlugin']});
/*
res.out will be:

angular.module('moduleName', ['aModule', "aPlugin"]);

res.changed is a boolean and will tell if any extension was applied at all.
*/

Grunt plugin

A grunt plugin using this library will be soon available at https://github.com/mariocasciaro/grunt-angular-extender

Limitations

The transformation will work only if you follow the convention of delaring modules like

angular.module(<string>, [<strings>]);

Using variables or functions to define the module name, will fail.

Contributors

Thanks to olov and his project ng-annotate for the inspiration he gave me to build this little tool.


Bitdeli Badge

Keywords

FAQs

Package last updated on 04 Feb 2015

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