# optcase

> optcase

Latest version **0.0.5** (published 2015-11-04) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

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

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.0.5 |
| Published | 2015-11-04 |
| First published | 2015-11-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | tnRaro |
| Maintainers | tnraro |
| Keywords | overloading, arguments |

## Links

- npm: https://www.npmjs.com/package/optcase
- Repository: https://github.com/tnRaro/optcase
- Issues: https://github.com/tnRaro/optcase/issues
- npm.io page: https://npm.io/package/optcase

## Recent versions

- 0.0.5 (latest) — 2015-11-04
- 0.0.4 — 2015-11-04
- 0.0.3 — 2015-11-04
- 0.0.2 — 2015-11-04
- 0.0.1 — 2015-11-04
- 0.0.0 — 2015-11-04

## README

optcase
===

.

[![Build Status](https://travis-ci.org/tnRaro/optcase.svg)](https://travis-ci.org/tnRaro/optcase)

# Installation

```sh
$ npm install --save optcase
```

# Usage

```js
import optcase from "optcase";

function who(){
	optcase(arguments)
	.case("string", (name) => {
		console.log(`My name is ${name}.`);
	})
	.case("string", "number", (name, age) => {
		if (age === 1)
			console.log(`My name is ${name}, I'm ${age} year old.`);
		else if (age > 1)
			console.log(`My name is ${name}, I'm ${age} years old.`);
		else
			console.log("I wasn't born yet.");
	})
	.default(() => {
		console.log("Who am I?");
	});
}

who("haruna"); // My name is haruna.
who("haruna", 102); // My name is haruna, I'm 102 years old.
who("girlfriend", -Infinity); // I wasn't born yet.
who(); // Who am I?
```

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