Nunnery/remove-dollar-inject

View on GitHub
README.md

Summary

Maintainability
Test Coverage
# remove-dollar-inject

[![Travis](https://img.shields.io/travis/Nunnery/remove-dollar-inject/master.svg?style=for-the-badge)](https://travis-ci.org/Nunnery/remove-dollar-inject)
[![npm](https://img.shields.io/npm/v/remove-dollar-inject.svg?style=for-the-badge)](https://www.npmjs.com/package/remove-dollar-inject)
[![Codecov](https://img.shields.io/codecov/c/gh/Nunnery/remove-dollar-inject.svg?style=for-the-badge)](https://codecov.io/gh/Nunnery/remove-dollar-inject)
[![Greenkeeper badge](https://img.shields.io/badge/Greenkeeper-enabled-brightgreen.svg?style=for-the-badge)](https://greenkeeper.io/)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge)](https://github.com/semantic-release/semantic-release)

> A library for removing \$inject from Angular source files.

## Install

    yarn install -D remove-dollar-inject

or

    npm install --save-dev remove-dollar-inject

## Usage

### ES6

```js
import removeDollarInject from 'remove-dollar-inject';

const input =
  "ExampleService.$inject = ['$q']; angular.module('app.example').service('ExampleService', ExampleService);";
const output = removeDollarInject(input);
console.log(output);
/*
 * angular.module('app.example').service('ExampleService', ExampleService);
 */
```

### ES5

```js
const removeDollarInject = require('remove-dollar-inject');

const input =
  "ExampleService.$inject = ['$q']; angular.module('app.example').service('ExampleService', ExampleService);";
const output = removeDollarInject(input);
console.log(output);
/*
 * angular.module('app.example').service('ExampleService', ExampleService);
 */
```

## API

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### removeDollarInject

Removes any \$inject assignment expressions from a given source string.

Will return an empty string for any null/undefined/void values.

**Parameters**

- `source` **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** String from which to remove any \$inject (optional, default `''`)

Returns **[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String)** Source string without \$inject assignment expressions

## License

MIT (C) [Richard Harrah](https://github.com/Nunnery)