# get-grunt-target

> Lookup the target for a grunt task

Latest version **1.0.2** (published 2018-08-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install get-grunt-target
pnpm add get-grunt-target
yarn add get-grunt-target
bun add get-grunt-target
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.2 |
| Published | 2018-08-20 |
| First published | 2015-07-13 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 0 |
| Unpacked size | 9.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Andrew Nichols |
| Maintainers | tandrewnichols |
| Keywords | grunt, target, lookup |

## Links

- npm: https://www.npmjs.com/package/get-grunt-target
- Repository: https://github.com/tandrewnichols/get-grunt-target
- Issues: https://github.com/tandrewnichols/get-grunt-target/issues
- npm.io page: https://npm.io/package/get-grunt-target

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 1.0.2 (latest) — 2018-08-20
- 1.0.1 — 2016-12-29
- 1.0.0 — 2015-07-13

## README

[![Build Status](https://travis-ci.org/tandrewnichols/get-grunt-target.png)](https://travis-ci.org/tandrewnichols/get-grunt-target) [![downloads](http://img.shields.io/npm/dm/get-grunt-target.svg)](https://npmjs.org/package/get-grunt-target) [![npm](http://img.shields.io/npm/v/get-grunt-target.svg)](https://npmjs.org/package/get-grunt-target) [![Code Climate](https://codeclimate.com/github/tandrewnichols/get-grunt-target/badges/gpa.svg)](https://codeclimate.com/github/tandrewnichols/get-grunt-target) [![Test Coverage](https://codeclimate.com/github/tandrewnichols/get-grunt-target/badges/coverage.svg)](https://codeclimate.com/github/tandrewnichols/get-grunt-target) [![dependencies](https://david-dm.org/tandrewnichols/get-grunt-target.png)](https://david-dm.org/tandrewnichols/get-grunt-target)

# get-grunt-target

Lookup the target for a grunt task

## Installation

`npm install --save get-grunt-target`

## Summary

Pass in grunt and the task you're intested in to get back the currently invoked target (if any).

## Usage

You can use this library in a Gruntfile (or alternatively, in a task itself) to do dynamic stuff based on the task. If the task you pass in was not invoked in the current build chain, this function returns null. If the task you pass in was invoked once, it returns the string name of the target it was invoked with (which _could_ be undefined if you invoke a multitask without a target name). If the task you pass in was invoked more than once, it returns an array of string targets.

```js
var getTarget = require('get-grunt-target');

module.exports = function(grunt) {
  var target = getTarget(grunt, 'test');
};
```

When `grunt test:server` is run, `target` will equal `"server"`.

When `grunt test:server test:client` is run, `target` will equal `["server", "client"]`.

## Contributing

I'll be happy to merge any pull request that adds value and has passing tests. Be sure to add a test both for node and for the browser. Tests are run with `grunt`.

---
_Source: https://npm.io/package/get-grunt-target · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
