open-index/open-npm huggingface dataset:
npm package: @includable/middleware-health
Description: Health check and metrics middleware.
Author: Thomas Schoffelen
Latest version: 1.0.1

# middleware-health

This package adds a `/health` endpoint that can be used for status checks and lists some request metrics:

```json
{
   "status": 200,
   "friendlyName": "OK",
   "environment": "production",
   "uptime": 80374,
   "requests": 208,
   "responseTime": 0.001
}
```

## Installation

```sh
npm i @includable/middleware-health
```

## Usage

```js
const express = require('express')
const health = require('@includable/middleware-health')

app.use(health())

app.listen(process.env.PORT || 3000, () => console.log(`Example app running.`))
```
npm package: @includable/middleware-https
Description: Redirect to HTTPS middleware.
Author: Thomas Schoffelen
Latest version: 1.0.0

# middleware-https

Simple force HTTPS redirect middleware, meant for use behind a proxy (e.g. Heroku).

## Installation

```sh
npm i @includable/middleware-https
```

## Usage

```js
const express = require('express')
const https = require('@includable/middleware-https')

app.use(https('example.com')) // leave out parameter to apply to all domains

app.listen(process.env.PORT || 3000, () => console.log(`Example app running.`))
```
npm package: @includable/open-browser
Description: Opens the user's favorite browser.
Author: Thomas Schoffelen
Latest version: 1.1.0

# Open browser

Very simple utility function that opens the browser, with some smartness built in:

- It uses the `BROWSER` environment variable to determine what browser to open.
- `BROWSER` can be set to a script file name ending in `.js` to call that script with the URL instead of opening the browser.
- When using Google Chrome on Mac and a tab with the same URL is already open, it will focus and reload that tab instead of opening a new tab.

## Installation

```sh
npm i @includable/open-browser
```

## Usage

```js
const openBrowser = require('@includable/open-browser')

openBrowser('https://www.includable.com/')
```
npm package: @includable/serverless-middleware
Description: Default serverless middleware for some of our projects.
Author: Thomas Schoffelen
Latest version: 2.5.0

# Serverless Middleware

A helper for writing APIs using AWS Lambda functions.

### Features

- Dependency injection for easy unit testing.
- Pretty JSON error output, with status codes automatically determined based on error message.
- Easy access to query strings and JSON body properties.
- Serverless warmup plugin support.
- OpenTelemetry support and additional span attributes, for use with [opentelemetry-lambda](https://github.com/open-telemetry/opentelemetry-lambda).

---

## Installation

```shell
yarn add @includable/serverless-middleware
```

## Example usage

```js
import { middleware, auth } from "@includable/serverless-middleware";

const dependencies = {
  // dependencies for the dependency injector
};

export const app = async (
  { query, path, body },
  { currentUser /* dependences */ },
) => {
  // if `auth` is included in the second param of `middleware`, currentUser
  // will be an object in the form of `{ id, groups, email, ... }`

  // your business logic goes here

  return {
    success: true,
    text: "Hello, world!",
  };
};

export const handler = middleware(app, [auth]).register(dependencies);
```

## Options

### Warmup support

Out of the box this middleware setup supports the [serverless-plugin-warmup](https://github.com/FidelLimited/serverless-plugin-warmup)
serverless plugin.

Simply install the serverless plugin, no other changes to your code necessary.
The middleware will automatically prevent code execution on warmup requests.

### OpenTelemetry span enrichment

If an active OpenTelemetry span is detected, event and response properties will automatically be added.

<br /><br />

---

<div align="center">
	<b>
		<a href="https://includable.com/consultancy/?utm_source=serverless-middleware">Get professional support for this package →</a>
	</b>
	<br>
	<sub>
		Custom consulting sessions availabe for implementation support and feature development.
	</sub>
</div>
npm package: @includable/topics
Description: Client library for Includable Topics.
Author: Thomas Schoffelen
Latest version: 1.4.0

# Topics

**Super simple websocket message broadcasting.**

Topis is a service built into the
[Includable Platform](https://includable.com/platform?utm_source=topics-js),
making it easy for Includable app developers to use websocket functionality.

Note however that when using this library, the namespace shared by your
topics is shared by all users of the library. So make sure to make
your topic name something unique that won't collide with other users.

The best approach for this is to use a reverse-DNS style string, like
`com.thomasschoffelen.mytopic`.

## Installation

```bash
npm i @includable/topics
```

## Usage

See [`example.js`](example.js).

### API

The Topics class exposes the following (static) functions. All of these
functions return a `Promise` object.

#### `Topics.sub`

Subscribe to a topic.

```js
Topics.sub('my-topic-name', (message) => {
    console.log('Received message on my-topic-name: ' + message)
})
```

Note that topics can be subscribed to only once, but you can use this
method multiple times to attach multiple callbacks to the same topic.

#### `Topics.unsub`

Unsubscribe from a topic.

```js
Topics.unsub('my-topic-name')
```

#### `Topics.broadcast`

Broadcast a message to a topic. These messages should always be plain
(stringify-able) JS objects.

```js
Topics.broadcast('my-topic-name', {'hello': 'world'})
```

#### `Topics.start`

Connect to the Topics server. It is usually not necessary to call this
manually, since it will be called automatically on your first `sub()`
call.

```js
Topics.start()
```

#### `Topics.stop`

Disconnect from the Topics server and remove all subscriptions.

```js
Topics.stop()
```

### Options

#### `Topics.setDebug`

Boolean - set this to true to send logs to stdout. Default `false`.

```js
// do this at the top of your script:

Topics.setDebug(true)
```

#### `Topics.setTimeout`

Number - set the connection timeout in ms. Default `10000`.

```js
// do this at the top of your script:

Topics.setTimeout(15000)
```
npm package: @includedaniel/fibonacci
Description: 📦 package who finds a correspondent fibonacci term
Author: Daniel Nunes da Silva
Latest version: 1.0.16

# Fibonacci Sequence with Memoization

[![main](https://github.com/includeDaniel/fibonacci/actions/workflows/main.yml/badge.svg)](https://github.com/includeDaniel/fibonacci/actions/workflows/main.yml)

[![npm version](https://img.shields.io/npm/v/@includedaniel/fibonacci.svg?style=flat)](https://www.npmjs.com/package/@includedaniel/fibonacci)

[![codecov](https://codecov.io/gh/includeDaniel/fibonacci/branch/main/graph/badge.svg?token=JZWXY20HCS)](https://codecov.io/gh/includeDaniel/fibonacci)

This is a JavaScript module that calculates the Fibonacci sequence up to a given number n using memoization. The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones, usually starting with 0 and 1.

## Instalation

To use the fibonacci function with memoization, use npm to install the package:

```npm
    npm i @includedaniel/fibonacci

```

## Usage

To use the fibonacci function with memoization, require the module in your JavaScript file:

```JavaScript
    const fibonacci = require('./fibonacci');

    const result = fibonacci(10);
    console.log(result); // Output: 55
```

The fibonacci function takes two parameters:

.'n' (required): The number up to which the Fibonacci sequence should be calculated.
.'prev' (optional): A 'Map' object used for memoization, which stores previously calculated Fibonacci numbers to improve performance. If not provided, a new Map will be created internally.
If 'n' is a positive integer, the function will return the Fibonacci number at position 'n' in the sequence. If 'n' is less than or equal to 0, an error will be thrown.

## Memoization

Memoization is a technique that allows the function to remember (or cache) the results of previous function calls, so that if the function is called again with the same inputs, it can return the cached result instead of recalculating it. This can significantly improve the performance of the function, especially for recursive algorithms like the Fibonacci sequence.

In this implementation, a 'Map' object is used as the memoization cache. When the 'fibonacci' function is called with a particular value of 'n', it first checks if the memoization cache ('prev') already contains the result for that value. If so, it retrieves the result from the cache and returns it immediately. This avoids redundant calculations and improves the overall efficiency of the Fibonacci function.

If the result for the given value of 'n' is not found in the cache, the function calculates it by recursively calling itself for the previous two Fibonacci numbers ('fibonacci(n - 1, prev)' and 'fibonacci(n - 2, prev)'), and then adds the two results together. The calculated result is stored in the cache for future use before being returned.

## License

This project is licensed under the MIT License.