# command-join

> Escape and join command-line arguments, cross-platform.

Latest version **3.0.0** (published 2019-05-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install command-join
pnpm add command-join
yarn add command-join
bun add command-join
```

## 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 | 3.0.0 |
| Published | 2019-05-23 |
| First published | 2015-12-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4.0.0 |
| Dependencies | 1 |
| Unpacked size | 10.5 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 6 |
| Author | Sean Genabe |
| Maintainers | seangenabe |
| Keywords | argv, cli, command, escape, join, shell |

## Links

- npm: https://www.npmjs.com/package/command-join
- Repository: https://github.com/seangenabe/command-join
- Homepage: https://github.com/seangenabe/command-join#readme
- Issues: https://github.com/seangenabe/command-join/issues
- npm.io page: https://npm.io/package/command-join

## Dependencies (1)

- [@improved/node](https://npm.io/package/@improved/node.md) ^1.0.0

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 3.0.0 (latest) — 2019-05-23
- 2.0.1 — 2019-05-23
- 2.0.0 — 2017-02-08
- 1.1.1 — 2016-09-28
- 1.1.0 — 2016-09-28
- 1.0.1 — 2015-12-06
- 1.0.0 — 2015-12-06
- 1.0.0-2 — 2015-12-05

## README

# command-join

Escape command-line arguments, cross-platform.

[![npm](https://img.shields.io/npm/v/command-join.svg?style=flat-square)](https://www.npmjs.com/package/command-join)
[![Build Status](https://img.shields.io/travis/seangenabe/command-join/master.svg?style=flat-square)](https://travis-ci.org/seangenabe/command-join)
[![devDependency Status](https://img.shields.io/david/dev/seangenabe/command-join.svg?style=flat-square)](https://david-dm.org/seangenabe/command-join#info=devDependencies)
[![node](https://img.shields.io/node/v/command-join.svg?style=flat-square)](https://nodejs.org/en/download/)

If you like this package, be sure to star its repo, and please consider [donating](https://seangenabe.netlify.com/donate).

## Usage

```typescript
import { commandJoin } from "command-join"
```

### `commandJoin(arg: string | string[]): string`

Escapes each command-line argument and joins them into a string that can then be executed, e.g. via `child_process.exec`.

If a string is passed, an array containing the string will instead be processed.

**Example**

```javascript
const command = commandJoin(['a', "b\\", "'c"])
command
// output on Windows: a "b\\" 'c
// output on Linux: a 'b\' \'c
```

See the tests for more convoluted examples.

## Migrating

**Migrating to v3**:
```diff
- const commandJoin = require("command-join")
+ const { commandJoin } = require("command-join")
```

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