0.1.0 • Published 5 years ago

pambda-by-env v0.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

pambda-by-env

Pambda switching by env.

Installation

npm i pambda-by-env

Usage

import { compose, createLambda } from 'pambda';
import { env } from 'pambda-by-env';

export const handler = createLambda(
  compose(
    env('DEBUG', next => (event, context, callback) => {
      // Do something for debugging.
    })
  )
);

env(name, truePambda, falsePambda)

  • name
    • A name of environment variable for switching.
  • truePambda
    • A pambda when an environment variable is true.
    • If this argument is an object, a pambda of the property corresponding to the environment variable is called.
  • falsePambda
    • A pambda when an environment variable is false.

Undefined, emptry string, 'no' and 'false' are evaluated as false.

License

MIT

0.1.0

5 years ago

0.0.1

7 years ago