# stdapi

> Standard Application Programming Interface Base Class

Latest version **1.1.5** (published 2021-01-09) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2021-01-09 |
| First published | 2017-07-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 72.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Dr. Ralf S. Engelschall |
| Maintainers | rse |
| Keywords | standard, api, event, hook, options |

## Links

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

## Dependencies (5)

- [ducky](https://npm.io/package/ducky.md) 2.7.3
- [promise](https://npm.io/package/promise.md) 8.1.0
- [latching](https://npm.io/package/latching.md) 1.0.11
- [eventemitter3](https://npm.io/package/eventemitter3.md) 4.0.7
- [object-assign](https://npm.io/package/object-assign.md) 4.1.1

## Alternatives

- [async-exit-hook](https://npm.io/package/async-exit-hook.md) — 3.7M weekly downloads
- [evnty](https://npm.io/package/evnty.md) — 7.2K weekly downloads
- [eleventy-plugin-asciidoc](https://npm.io/package/eleventy-plugin-asciidoc.md) — 3.5K weekly downloads
- [@jswork/next-get2get](https://npm.io/package/@jswork/next-get2get.md) — 945 weekly downloads
- [@dashersw/axon](https://npm.io/package/@dashersw/axon.md) — 934 weekly downloads

## Recent versions

- 1.1.5 (latest) — 2021-01-09
- 1.1.4 — 2020-10-11
- 1.1.3 — 2019-12-22
- 1.1.2 — 2019-06-16
- 1.1.1 — 2019-04-26
- 1.1.0 — 2018-12-22
- 1.0.9 — 2018-09-01
- 1.0.8 — 2018-08-10
- 1.0.7 — 2018-07-07
- 1.0.6 — 2018-06-23
- 1.0.5 — 2018-05-11
- 1.0.4 — 2018-05-06
- 1.0.3 — 2018-04-30
- 1.0.2 — 2018-04-22
- 1.0.1 — 2018-04-06
- … 9 more at https://npm.io/package/stdapi/versions

## README

StdAPI
======

Standard Application Programming Interface Base Class

<p/>
<img src="https://nodei.co/npm/stdapi.png?downloads=true&stars=true" alt=""/>

<p/>
<img src="https://david-dm.org/rse/stdapi.png" alt=""/>

About
-----

This is a small JavaScript library for the Browser and Node.js,
providing a base class for a standard Application Programming
Interface (API) based on the usual functionalities constructor options, event emitting
and hook latching. Internally, the functionality
is directly based on [Ducky](https://duckyjs.com) `options`,
[EventEmitter3](https://github.com/primus/eventemitter3) and
[Latching](https://github.com/rse/latching).
The purpose of this base class is to reduce the necessary
boilerplate code for implementing standard APIs.

Installation
------------

```shell
$ npm install stdapi
```

Usage
-----

```js
class MyClass extends StdAPI {
    constructor (options) {
        super(options, {
            name: [ "string" ],
            foo: [ "string", "bar" ],
            bar: {
                baz:  [ "number", 42 ]
                quux: [ "boolean", () => true ]
            }
        })
    }
    foo (arg) {
        this.debug(1, "foo called")
        arg = this.hook("foo", "pass", arg)
        void (arg) /* ... */
        this.emit("foo done")
        return this
    }
}
```

Application Programming Interface (API)
---------------------------------------

Please just see the [very small implementation](src/stdapi.js) itself.

License
-------

Copyright (c) 2017-2021 Dr. Ralf S. Engelschall (http://engelschall.com/)

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

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