# isprod

> Determine if runmode is production.

Latest version **1.1.0** (published 2016-04-07) · ISC license · 0 weekly downloads

## Install

```sh
npm install isprod
pnpm add isprod
yarn add isprod
bun add isprod
```

## 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.1.0 |
| Published | 2016-04-07 |
| First published | 2016-04-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Linkeo |
| Maintainers | linkeo |
| Keywords | env, args, runmode |

## Links

- npm: https://www.npmjs.com/package/isprod
- Repository: https://github.com/linkeo/isprod
- Homepage: https://github.com/linkeo/isprod#readme
- Issues: https://github.com/linkeo/isprod/issues
- npm.io page: https://npm.io/package/isprod

## Alternatives

- [replicas-cli](https://npm.io/package/replicas-cli.md) — 3.0K weekly downloads
- [env-contract](https://npm.io/package/env-contract.md) — 133 weekly downloads
- [@openveo/api](https://npm.io/package/@openveo/api.md) — 61 weekly downloads
- [@ryniaubenpm2/cumque-error-reiciendis](https://npm.io/package/@ryniaubenpm2/cumque-error-reiciendis.md) — 54 weekly downloads
- [ts-global-type-extra](https://npm.io/package/ts-global-type-extra.md) — 11 weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-04-07
- 1.0.0 — 2016-04-06

## README

## Install

```sh
npm install --save isprod
```

## Usage

```
env.prod:   RUNMODE=prod|product|production
        or  NODE_ENV=prod|product|production

env.dev:    RUNMODE=dev|develop|development
        or  NODE_ENV=dev|develop|development

arg.prod:   --prod|--product|--production

arg.dev:    --dev|--develop|--development

priority:   arg.prod > arg.dev > env.prod > env.dev
```


arg.prod    | arg.dev   | env.prod  | env.dev   |    | result
------------|-----------|-----------|-----------|----|-------
no          | no        | no        | no        |    | false
no          | no        | no        | yes       |    | false
no          | no        | yes       | no        |    | true
no          | no        | yes       | yes       |    | true
no          | yes       | no        | no        |    | false
no          | yes       | no        | yes       |    | false
no          | yes       | yes       | no        |    | false
no          | yes       | yes       | yes       |    | false
yes         | no        | no        | no        |    | true
yes         | no        | no        | yes       |    | true
yes         | no        | yes       | no        |    | true
yes         | no        | yes       | yes       |    | true
yes         | yes       | no        | no        |    | true
yes         | yes       | no        | yes       |    | true
yes         | yes       | yes       | no        |    | true
yes         | yes       | yes       | yes       |    | true


```js
var is_prod = require('isprod'); // boolean
```

## Example

Config.js

```js
var common = {
    appName: "App Name",
    mailSender: {
        displayName: 'Notify',
        service: 'QQ',
        auth: {
            user: 'xxxxxx@qq.com',
            pass: 'xxxxxxxxxxxxx'
        }
    }
};

var dev = {
    server: {
        domain: 'http://localhost:8080',
        port: 8080,
        httpsPort: 8443
    },
    mongodb: {
        url: "mongodb://localhost/test",
        options: {
            server: {
                poolSize: 5,
                socketOptions: {
                    keepAlive: 300
                }
            }
        }
    },
    redis: {
        host: "localhost",
        port: 6379
    }
};

var prod = {
    server: {
        domain: 'http://should.set.it.in.config.js',
        port: 8083
    }
};

Object.assign = require('object-assign');

if (require('isprod')) {
    module.exports = Object.assign({}, common, prod);
} else {
    module.exports = Object.assign({}, common, dev);
}
```

Server.js

```js
...

server.listen(require('./Config.js').server, callback);

...
```

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