# platformenv

> This is a microlibrary with a single function `platformenv.define(global)`, that sets a number of predicates on the global object:`isNodeJs`, `isDevServer`, `isTesting`, and maybe more in the future. Mainly used with solapp apps. Include as: `require("platformenv").define global if typeof isNodeJs != "boolean"` in coffeescript, to make sure it is optimised away in uglifyjs. (The whole reason to have a library that sets properties on the global object is that they can be optimised away, including dead code removal, by uglifyjs when they are defined by the preprocessor).

Latest version **0.0.1** (published 2014-01-11) · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2014-01-11 |
| First published | 2014-01-11 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Rasmus Erik Voel Jensen |
| Maintainers | rasmuserik |

## Links

- npm: https://www.npmjs.com/package/platformenv
- Repository: http://github.com/rasmuserik/platformenv
- npm.io page: https://npm.io/package/platformenv

## Dependencies (1)

- [solapp](https://npm.io/package/solapp.md) *

## Recent versions

- 0.0.1 (latest) — 2014-01-11

## README

# platformenv
[![ci](https://secure.travis-ci.org/rasmuserik/platformenv.png)](http://travis-ci.org/rasmuserik/platformenv)

This is a microlibrary with a single function `platformenv.define(global)`, that sets a number of predicates on the global object:`isNodeJs`, `isDevServer`, `isTesting`, and maybe more in the future.

Mainly used with solapp apps.

Include as: `require("platformenv").define global if typeof isNodeJs != "boolean"` in coffeescript, to make sure it is optimised away in uglifyjs.
(The whole reason to have a library that sets properties on the global object is that they can be optimised away, including dead code removal, by uglifyjs when they are defined by the preprocessor).

    exports.about =
      title: "platformenv"
      description: """
        This is a microlibrary with a single function `platformenv.define(global)`, that sets a number of predicates on the global object:`isNodeJs`, `isDevServer`, `isTesting`, and maybe more in the future.
    
        Mainly used with solapp apps.
    
        Include as: `require("platformenv").define global if typeof isNodeJs != "boolean"` in coffeescript, to make sure it is optimised away in uglifyjs.
        (The whole reason to have a library that sets properties on the global object is that they can be optimised away, including dead code removal, by uglifyjs when they are defined by the preprocessor).
        """
      npmjs: true
      webjs: true
    

# Main

    if typeof isNodeJs != "boolean"
      exports.define = (global) ->
        global.isNodeJs = if process?.versions?.node then true else false
        global.isDevServer = typeof isDevServer != "undefined" && isDevServer
        global.isTesting = if isNodeJs then process.argv.slice(2) else location.hash.slice(1).split "/"
      exports.define global
    


----

Autogenerated README.md, edit platformenv.coffee to update [![repos](https://ssl.solsort.com/_solapp_rasmuserik_platformenv.png)](https://github.com/rasmuserik/platformenv)

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