own-or-env

WebJar for own-or-env

License

License

ISC
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

own-or-env
Last Version

Last Version

1.0.1
Release Date

Release Date

Type

Type

jar
Description

Description

own-or-env
WebJar for own-or-env
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/isaacs/own-or-env

Download own-or-env

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/own-or-env/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>own-or-env</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/own-or-env/
implementation 'org.webjars.npm:own-or-env:1.0.1'
// https://jarcasting.com/artifacts/org.webjars.npm/own-or-env/
implementation ("org.webjars.npm:own-or-env:1.0.1")
'org.webjars.npm:own-or-env:jar:1.0.1'
<dependency org="org.webjars.npm" name="own-or-env" rev="1.0.1">
  <artifact name="own-or-env" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='own-or-env', version='1.0.1')
)
libraryDependencies += "org.webjars.npm" % "own-or-env" % "1.0.1"
[org.webjars.npm/own-or-env "1.0.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : own-or jar [1.0.0,2)

Project Modules

There are no modules declared in this project.

own-or-env

Use an objects own property, or an environment variable. Optionally treat as a boolean if the env should be set to 1 or 0.

API

ownOrEnv(object, field, env, boolean)

Use the object[field] if it's an own property, otherwise use the named environent variable. If boolean is set to true, then cast to a boolean flag.

USAGE

// will set doTheThing to true based on config.doThing, falling back
// to reading process.env.DO_THING, where '0' is treated as false.
var doTheThing = ownOrEnv(config, 'doThing', 'DO_THING', true)

// just treat this one as a string, not a boolean flag
var file = ownOrEnv(config, 'file', 'MY_FILE')

Versions

Version
1.0.1