open-index/open-npm huggingface dataset:
npm package: @kompanie/assert
Description: A dependency-free, buildless assertion library
Latest version: 2.0.0

# Assert 🔍

A dependency-free, buildless assertion library for node.js and the browser.

## Getting Started

At first you need to install the package using the following command:

```console
npm i @kompanie/assert
```

## Usage

The first parameter is usually `actual` while the second parameter is `expected`.

Exceptions to this rule are:

* `Assert.fail()`
* `Assert.isNaN(actual)`
* `Assert.isNotNaN(actual)`
* `Assert.isBetween(actual, min, max)`
* `Assert.rejects(fn, expectedErrorType)`
* `Assert.notRejects(fn, expectedErrorType)`
* `Assert.throws(fn, expectedErrorType)`
* `Assert.notThrows(fn, expectedErrorType)`
* `Assert.isUndefinedOrNull(actual)`
* `Assert.isNotUndefinedOrNull(actual)`

```js
// Equality
Assert.equal(5, 5);
Assert.notEqual(5, 10);

// Deep Equality
Assert.deepEqual({a: 5}, {a: 5});
Assert.notDeepEqual({a: 5}, {a: 10});

// Fail
Assert.fail();

// Includes
Assert.include("Hello World", "Hell");
Assert.include([5, 6, 7], 5);
Assert.notInclude("Hello World", "Foo");
Assert.notInclude([5, 6, 7], 8);

// Instance
Assert.instanceOf(new Date(), Date);
Assert.notInstanceOf({}, Date);

// NaN
Assert.isNaN(NaN);
Assert.isNotNaN(123);

// Number
const tolerance = 0.1;
Assert.approximately(5.01, 5, tolerance);
Assert.isAbove(10, 5);
Assert.isBelow(3, 5);
Assert.isBetween(5, 1, 10);

// Regex
Assert.match("hello123", /hello\d+/u);
Assert.notMatch("hello", /world/u);

// Rejects
const expectedPromiseError = TypeError; // optional
Assert.rejects(async () => { throw new Error(); }, expectedPromiseError);
Assert.notRejects(async () => {}, expectedPromiseError);

// Throws
const expectedErrorType = TypeError; // optional
Assert.throws(() => { throw new Error(); }, expectedErrorType);
Assert.notThrows(() => {}, expectedErrorType);

// Type
Assert.typeOf("hello", "string");
Assert.notTypeOf(123, "string");

// Undefined / Null
Assert.isUndefinedOrNull(null);
Assert.isNotUndefinedOrNull(123);
```

## Tests

This repository includes tests in the `tests` folder, which can be executed via `npm test` and opening the browser at [localhost:8000](http://localhost:8000/tests)
npm package: @kompanie/diener
Description: A compact development web server with live reload support
Latest version: 3.0.0

# Diener 🤵

A compact, dependency-free development web server with live reload support, made for buildless web applications.

## Getting Started

At first you need to install the package using the following command:

```console
npm i @kompanie/diener
```

You can start the server directly without using any command line switches.

```console
npx diener
```

If you want to specifiy the folder and port and enable live reload:
```console
npx diener --folder="./web/" --port=8000 --livereload
```

## Command Line Switches

The development server supports command line arguments.  
**All of them are optional** and come with sensible defaults.

| Switch                 | Description                                                                                                                                     | Default |
|------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|---------|
| `--debouncedelay`      | Time in milliseconds the debounce algorithm waits before triggering a browser reload.                                                           | `200` |
| `--folder`             | The folder that should be watched and served.                                                                                                   | [current working directory of node](https://nodejs.org/api/process.html#processcwd) |
| `--ignore-git`         | Ignores paths and files containing `.git` to prevent reloads from changes inside the `.git` folder.                                             | off |
| `--ignore-nodemodules` | Ignores paths and files containing `node_modules` to prevent reloads from changes inside the `node_modules` folder.                             | off |
| `--index`              | Default file served if only a folder is specified in the URL. Treated as the application entry point, where the livereload script is injected. Should always be an HTML file. | `index.html` |
| `--livereload`         | Reload the browser on file changes inside `--folder`. `.DS_Store` and `.tmp` files will never trigger reloads.                                  | off |
| `--mimemap`            | Path to a JSON map for mapping file extensions to MIME types.                                                                                   | [defaultMimeTypeMap.json](./source/defaultMimeTypeMap.json) |
| `--port`               | The port which should be used for the web server and live reload websocket server.                                                              | `8000` |
| `--verbose`            | Enables verbose logging. Logs file/folder changes, triggered browser reloads and HTTP requests.                                                 | off |

## Test project

This repository includes a small test project in `westWebApp`, which can be used to try out stuff while developing.
It can be executed via `npm start`.
npm package: @kompanie/komponist
Description: Komponist is a compact dependency-free CSS framework for styling standard HTML elements. It also includes components for creating alerts, badges, loading spinners and tabs.
Latest version: 5.0.0

# Komponist 🎹

Komponist is a compact dependency-free CSS framework for styling standard HTML elements.
It also includes components for creating alerts, badges, loading spinners and tabs.

You can check out a demo of all styled elements and features using the [GitHub Pages demo](https://kompanie-dev.github.io/komponist/demo/).

## Components

The following components are supported:

```html
<!-- Alerts -->
<div class="alert">Lorem ipsum dolor sit amet...</div>
<div class="alert success">Lorem ipsum dolor sit amet...</div>

<!-- Badges -->
<span class="badge">Default</span>
<span class="badge error">Error</span>

<!-- Spinner -->
<div style="height: 100px; width: 100px">
    <div class="spinner"></div>
</div>

<!-- Tabs -->
<div class="tabs">
    <button class="tab active">Tab 1</button>
    <button class="tab">Tab 2</button>
    <button class="tab">Tab 3</button>
</div>
```
Keep in mind that Komponist is a pure CSS library.
Therefore the tabs are styled, but if you want proper tab switching, you need to write your own JavaScript code for that.

## Elements

Komponist contains styles for the following elements:

* `<a>`
* `<blockquote>`
* `<body>`
* `<button>`
* `<details> + <summary>`
* `<dialog>`
* `<div>`
* `<h1> - <h6>`
* `<hr>`
* `<img>`
* `<input>`
    * `checkbox`
    * `color`
    * `date`
    * `email`
    * `file`
    * `number`
    * `password`
    * `radio`
    * `range`
    * `tel`
    * `text`
    * `url`
* `<label>`
* `<nav>`
* `<progress>`
* `<select> (+ <option>)`
* `<span>`
* `<table> (+ <td>, <th>)`
* `<textarea>`

To use the styling in your project just apply the correct CSS class (`.a`, `.body`, `.button`, `.details`, `.div`, `.h1`-`.h6`, `.input`, `.label`, `.nav`, `.progress`, `.select`, `.span`, `.textarea`) to the element.

You can take a look at `demo/index.html` to see how elements get styled.
You need to supply CSS variables (themes) for the framework to function properly.
There is a default dark and light theme in `themes/default`.
You can enforce a dark theme by only importing `dark.css`, a light theme by using `light.css` and auto-switching, based on the [users browser preference](https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/At-rules/@media/prefers-color-scheme) using `auto.css`.

## Usage

At first you need to install the package using the following command:

```
npm i @kompanie/komponist
```

After the installation you can include the CSS in your app.

## Getting Started

Execute `npm install` and then use `npm start` to run the demo project.

The site will be available at [localhost:8000](http://localhost:8000).

To create a bundle of the library you can use `npm run build`.

To create a minified bundle of the library use `npm run build-minified`.
npm package: @kompanie/random-string
Description: Generates a random string in the desired length. It also supports seeds and specifiying which letters should be used. This function is not cryptographically secure.
Latest version: 1.0.0

# random-string

Generates a random string in the desired length.
It also supports seeds and specifiying which letters should be used.
This function is not cryptographically secure.

## Usage

At first you need to install the package using the following command:
```
npm i @kompanie/random-string
```

The generate function has three parameters:
* length specifies how long the generated string should be.
* seed is a number, which allows to generate the same string again. Optional.
* allowedCharacters is a string, which specifies all the characters that are allowed in the string. Optional.

```js
// Generate a string containing 5 characters
const result = RandomString.generate(5);

// Generate a string containing 6 characters, using the seed 5
const result = RandomString.generate(6, 5);

// Generate a string containing 7 characters, using the seed 4, using only these characters
const result = RandomString.generate(7, 4, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");

// Generate a string containing 7 characters, using no seed, using only these characters
const result = RandomString.generate(7, null, "ABCDEFGHIJKLMNOPQRSTUVWXYZ");
```
npm package: @kompanie/wavefile-generator
Description: A JavaScript-based generator for 16 and 32 bit .wav files. It takes a `mono` or `stereo` [Web Audio AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) as input and generates an [ArrayBuffer](https://developer.mozilla.org/en-US/doc
Latest version: 1.0.0

# Wavefile Generator

A JavaScript-based generator for 16 and 32 bit .wav files.
It takes a `mono` or `stereo` [Web Audio AudioBuffer](https://developer.mozilla.org/en-US/docs/Web/API/AudioBuffer) as input and generates an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing the wave file.

## Usage

At first you need to install the package using the following command:
```
npm i @kompanie/wavefile-generator
```

```js
import { WaveFileGenerator16Bit, WaveFileGenerator32Bit } from "@kompanie/wavefile-generator";

// For generating 16 Bit WAV files
const waveFileGenerator = new WaveFileGenerator16Bit();

// For generating 32 Bit WAV files
const waveFileGenerator = new WaveFileGenerator32Bit();

const arrayBuffer = waveFileGenerator.generate(audioBuffer);
```

## Getting Started

Execute `npm install` and then use `npm start` to run the demo project.

The site will be available at [localhost:8000](http://localhost:8000).
npm package: @kompanion/style
Description: Tiny snippets of useful javascript code for websites and apps.
Author: Henrique Cavalieri
Latest version: 0.0.2

# Kompanion utils

Tiny snippets of useful javascript code for websites and apps.

```shell
npm i @kompanion/utils
# or
yarn add @kompanion/utils
```

## Utilities

As `@kompanion/utils` is written in Typescript, you get automatic intellisense by default if using editors like VS Code.

### Arrays

#### shuffleArray

Self explanatory. The **only argument** is an `array`:

```js
import { shuffleArray } from '@kompanion/utils';

const emojis = ['😄', '🤨', '🧡', '😝'];
const randomEmoji = shuffleArray(emojis)[0];
```

### DOM-related

#### scrollToId

**Single argument:** `id: string`

Uses the [`scrollIntoView` API](https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView) to smoothly scroll the screen to the object defined by the given `id`. If no object is found, does nothing.

```html
<button onClick="scrollToId('contact')">Get in contact</button>
```

#### getWindowSize

Checks if there's a window object (if it's a browser) and returns an object: `{width: num, height: num}`

## TODO

- Add another `tsconfig` for an ES5 bundle
- Finish documentation