# explicit

> System to explicitly specify the way a method works.

Latest version **0.1.3** (published 2019-07-17) · ISC license · 0 weekly downloads

## Install

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

## 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.1.3 |
| Published | 2019-07-17 |
| First published | 2014-08-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 26.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Martin Heidegger |
| Maintainers | leichtgewicht |
| Keywords | augmentation, extension, documentation, annotation |

## Links

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

## Dependencies (1)

- [@hapi/joi](https://npm.io/package/@hapi/joi.md) ^15.1.0

## Alternatives

- [@cantoo/pdf-lib](https://npm.io/package/@cantoo/pdf-lib.md) — 297.9K weekly downloads
- [datatables.net-buttons](https://npm.io/package/datatables.net-buttons.md) — 200.1K weekly downloads
- [@ckeditor/ckeditor5-export-pdf](https://npm.io/package/@ckeditor/ckeditor5-export-pdf.md) — 167.0K weekly downloads
- [scanbot-web-sdk](https://npm.io/package/scanbot-web-sdk.md) — 15.0K weekly downloads
- [@syncfusion/ej2-angular-pdfviewer](https://npm.io/package/@syncfusion/ej2-angular-pdfviewer.md) — 8.8K weekly downloads

## Recent versions

- 0.1.3 (latest) — 2019-07-17
- 0.1.2 — 2018-07-13
- 0.1.1 — 2016-01-31
- 0.1.0 — 2015-04-19
- 0.0.3 — 2014-08-31
- 0.0.2 — 2014-08-29
- 0.0.1 — 2014-08-13

## README

[![build status](https://travis-ci.org/explicitjs/explicit.svg?branch=master)](https://travis-ci.org/explicitjs/explicit)
[![Code Climate](https://codeclimate.com/github/explicitjs/explicit/badges/gpa.svg)](https://codeclimate.com/github/explicitjs/explicit)
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)

# Explicit.js

Explicit.js allows explicitl annotation, documentation and augmentation of JavaScript methods.

```bash
npm i explicit joi -S
```

## Usage

```JavaScript
var explicit = require("explicit"),
    joi = require("joi");

var object = explicit({
    foo: {
        $args: [
            joi.string().meta("bar")
        ],
        $: function (bar) {
            console.info(bar);
        }
    }
});

object.foo(1); // 1
object.foo.valid(1); // will fail because the first argument is not allowed to be a string
object.foo.validObject({
    bar: "Hello World"
}); // "Hello World"
```

For single method definition add the  ```$one``` parameter.

```JavaScript
var foo = explicit({
    $one: true,   
    $args: [
        joi.string().meta("bar")
    ],
    $: function (bar) {
        console.info(bar);
    }
});

foo(1); // 1
foo.valid(1); // will fail because the first argument has to be a string
foo.validObject({
    bar: "Hello World"
}); // "Hello World"
```

And in case you want to make the assertion required you add the ```$assert``` parameter.

```JavaScript
var foo = explicit({
    $one: true,
    $assert: true, 
    $args: [
        joi.string().meta("bar")
    ],
    $: function (bar) {
        console.info(bar);
    }
});
foo(1); // will fail because the first argument has to be a string
```

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