open-index/open-npm huggingface dataset:
npm package: @jaortiz117/icon-map
Description: Places icons within an image for animations or mapping
Author: Javier Ortiz
Latest version: 2.2.0

# Icon-Map

[![GitHub issues](https://img.shields.io/github/issues/jaortiz117/icon-map.svg)](https://github.com/jaortiz117/icon-map/issues)[![GitHub issues](https://img.shields.io/npm/v/@jaortiz117/icon-map.svg)](https://github.com/jaortiz117/icon-map/issues)

Simple library for displaying an image within an image. Used in the 6th Gen MoonBuggy GUI from my other repositories. It started as a way to show visual location data from a server not connected to the internet. It received Latitude and Longitude input from a GPS device and sent it over a closed network.


For now I'm just making the library more general to use. This way I can use it for the following years of the competition.

## Install

```
$ npm install @jaortiz117/icon-map
```

## Usage

```js
const iconMap = require("@jaortiz117/icon-map");
//Note: DOM elements must have defined dimensions
//instantiate the map
var map = new iconMap.Map(document.getElementById("parentID"), document.getElementById("iconID"));

var newYPosition = 10;
var newXPosition = 10;

//reposition icon within parent
map.refresh({
  y: newYPosition,
  x: newXPosition
});

```
npm package: @jaouan/eslint-config-no-if
Description: An ESLint plugin that prohibites the use of `if`.
Latest version: 1.0.0

# eslint-config-no-if
An ESLint plugin that prohibites the use of `if`.

## Why would I prohibited `if` ? 🤔
It helps you write code without nested statement. So it increases readability, testability, maintenance and sometimes it accelerates the Single Responsability Principle adoption. 💡

## Usage

```bash
npm install -D eslint @jaouan/eslint-config-no-if
```

In the `.eslintrc` file :
```json
{
  "extends": [
    "@jaouan/eslint-config-no-if"
  ]
}
```

That's all folks! 🎉

## Examples
```javascript
// 👎 KO
if (aBoolean) {
    console.log("foo");
}

// 👍 OK, using operator. 
aBoolean && console.log("foo");
```

```javascript
// 👎 KO
if (aBoolean) {
    console.log("foo");
} else {
    console.log("bar");
}

// OK, using ternary.
aBoolean ? console.log("foo") : console.log("bar");
```

```javascript
// 👎 KO
if (foo === "a") {
  console.log("A");
} else if (foo === "b") {
  console.log("B");
} else if (foo === "c") {
  console.log("C");
} else if (foo === "d") {
  console.log("D");
} else {
  throw new Error("Unknown");
}

// OK, using object.
const fooStrategies = {
    "a": () => console.log("A"),
    "b": () => console.log("B"),
    "c": () => console.log("C"),
    "d": () => console.log("D")
};
const defaultFooStrategie = () => throw new Error("Unknown");
(fooStrategies[foo] ?? defaultFooStrategie)();
```

```javascript
// 🤷 OK, since you cannot throw using operator or ternary.
if (aBoolean) throw new Error("foo);
```
npm package: @japa/api-client
Description: Browser and API testing client for Japa. Built on top of Playwright
Author: Harminder Virk
Latest version: 3.2.1

# @japa/client
> API client to test endpoints over HTTP. Uses superagent under the hood

[![github-actions-image]][github-actions-url] [![npm-image]][npm-url] [![license-image]][license-url] [![typescript-image]][typescript-url]

The API client plugin of Japa makes it super simple to test your API endpoints over HTTP. You can use it to test any HTTP endpoint that returns JSON, XML, HTML, or even plain text.

It has out of the box support for:

- Multiple content types including `application/json`, `application/x-www-form-urlencoded` and `multipart`.
- Ability to upload files.
- Read and write cookies with the option to register custom cookies serializer.
- Lifecycle hooks. A great use-case of hooks is to persist and load session data during a request.
- All other common abilities like sending headers, query-string, and following redirects.
- Support for registering custom body serializers and parsers.

#### [Complete API documentation](https://japa.dev/docs/plugins/api-client)

## Installation
Install the package from the npm registry as follows:

```sh
npm i @japa/api-client

yarn add @japa/api-client
```

## Usage
You can use the assertion package with the `@japa/runner` as follows.

```ts
import { apiClient } from '@japa/api-client'
import { configure } from '@japa/runner'

configure({
  plugins: [apiClient({ baseURL: 'http://localhost:3333' })]
})
```

Once done, you will be able to access the `client` property from the test context.

```ts
test('test title', ({ client }) => {
  const response = await client.get('/')
})
```

[github-actions-url]: https://github.com/japa/api-client/actions/workflows/checks.yml
[github-actions-image]: https://img.shields.io/github/actions/workflow/status/japa/api-client/checks.yml?style=for-the-badge "github-actions"

[npm-image]: https://img.shields.io/npm/v/@japa/api-client.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@japa/api-client "npm"

[license-image]: https://img.shields.io/npm/l/@japa/api-client?color=blueviolet&style=for-the-badge
[license-url]: LICENSE.md "license"

[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[typescript-url]:  "typescript"
npm package: @japa/assert
Description: Assertion module for Japa
Author: Harminder Virk
Latest version: 4.2.0

# @japa/assert
> Assertion library built on top of Chai.assert

[![github-actions-image]][github-actions-url] [![npm-image]][npm-url] [![license-image]][license-url] [![typescript-image]][typescript-url]

An assertion library built on top of [Chai.assert](https://www.chaijs.com/guide/styles/#assert) with small tweaks and additional features like assertion planning.

#### [Complete API documentation](https://japa.dev/docs/plugins/assert)

## Installation
Install the package from the npm registry as follows:

```sh
npm i @japa/assert

yarn add @japa/assert
```

## Usage
You can use the assertion package with the `@japa/runner` as follows.

```ts
import { assert } from '@japa/assert'
import { configure } from '@japa/runner'

configure({
  plugins: [assert()]
})
```

Once done, you will be able to access the `assert` property on the test context.

```ts
test('test title', ({ assert }) => {
  assert.deepEqual({ id: 1 }, { id: 1})
})
```

[github-actions-url]: https://github.com/japa/assert/actions/workflows/checks.yml
[github-actions-image]: https://img.shields.io/github/actions/workflow/status/japa/assert/checks.yml?style=for-the-badge "github-actions"

[npm-image]: https://img.shields.io/npm/v/@japa/assert.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@japa/assert "npm"

[license-image]: https://img.shields.io/npm/l/@japa/assert?color=blueviolet&style=for-the-badge
[license-url]: LICENSE.md "license"

[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[typescript-url]:  "typescript"
npm package: @japa/browser-client
Description: Browser client built on top of Playwright for writing end to end tests
Author: Harminder Virk
Latest version: 2.3.0

# @japa/browser-client

> Browser client to write end to end browser tests. Uses playwright under the hood

[![gh-actions-image]][gh-actions-url] [![npm-image]][npm-url] [![license-image]][license-url] ![typescript-image]

The browser client of Japa is built on top of [Playwright library](https://playwright.dev/docs/library) and integrates seamlessly with the Japa test runner. Following are some reasons to use this plugin over manually interacting with the Playwright API.

- Automatic management of browsers and browser contexts.
- Built-in assertions.
- Ability to extend the `browser`, `context`, and `page` objects using [decorators](#decorators).
- Class-based pages and interactions to de-compose the page under test into smaller and reusable components.
- Toggle headless mode, tracing, and browsers using CLI flags.

#### [Complete documentation](https://japa.dev/docs/plugins/browser-client)

## Installation

Install the package from the npm registry as follows:

```sh
npm i -D playwright @japa/browser-client

yarn add -D playwright @japa/browser-client
```

## Usage

You can use the browser client package with the `@japa/runner` as follows.

```ts
import { assert } from '@japa/assert'
import { browserClient } from '@japa/browser-client'
import { configure, processCliArgs } from '@japa/runner'

configure({
  ...processCliArgs(process.argv.slice(2)),
  ...{
    plugins: [
      assert(),
      browserClient({
        runInSuites: ['browser'],
      }),
    ],
  },
})
```

Once done, you will be able to access the `visit`, `browser` and `browserContext` property from the test context.

```ts
test('test title', ({ browser, browserContext, visit }) => {
  // Create new page
  const page = await browserContext.newPage()
  await page.goto(url)

  // Or use visit helper
  const page = await visit(url)

  // Create multiple contexts
  const context1 = await browser.newContext()
  const context2 = await browser.newContext()
})
```

[gh-actions-image]: https://img.shields.io/github/actions/workflow/status/japa/browser-client/checks.yml?style=for-the-badge
[gh-actions-url]: https://github.com/japa/browser-client/actions/workflows/checks.yml 'Github action'
[npm-image]: https://img.shields.io/npm/v/@japa/browser-client/latest.svg?style=for-the-badge&logo=npm
[npm-url]: https://www.npmjs.com/package/@japa/browser-client/v/latest 'npm'
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[license-url]: LICENSE.md
[license-image]: https://img.shields.io/github/license/japa/browser-client?style=for-the-badge
npm package: @japa/core
Description: Implementation of core APIs for the Japa tests runner
Author: Harminder Virk
Latest version: 10.4.0

# @japa/core
> The core of the Japa tests runners

[![github-actions-image]][github-actions-url] [![npm-image]][npm-url] [![license-image]][license-url] [![typescript-image]][typescript-url]

This repo contains the code for the core of the japa tests runner. You can use it create your tests runner, just like `@japa/runner`.

You can view the documentation on [https://japa.dev](https://japa.dev)

[github-actions-image]: https://img.shields.io/github/actions/workflow/status/japa/core/checks.yml?style=for-the-badge

[github-actions-url]: https://github.com/japa/core/actions/workflows/checks.yml "github-actions"

[npm-image]: https://img.shields.io/npm/v/@japa/core.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@japa/core "npm"

[license-image]: https://img.shields.io/npm/l/@japa/core?color=blueviolet&style=for-the-badge
[license-url]: LICENSE.md "license"

[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[typescript-url]:  "typescript"

<br />
<hr>

![](https://raw.githubusercontent.com/thetutlage/static/main/sponsorkit/sponsors.png)
npm package: @japa/expect
Description: Assertion package built on top of Jest expect
Author: Harminder Virk
Latest version: 3.0.7

# @japa/expect
> Assertion library built on top of jest-expect

[![github-actions-image]][github-actions-url] [![npm-image]][npm-url] [![license-image]][license-url] [![typescript-image]][typescript-url]

An assertion library built on top of [jest-expect](https://jestjs.io/docs/expect).

#### [Complete API documentation](https://japa.dev/docs/plugins/expect)

## Installation
Install the package from the npm registry as follows:

```sh
npm i @japa/expect
```

```sh
yarn add @japa/expect
```

## Usage
You can use the assertion package with the `@japa/runner` as follows.

```ts
import { expect } from '@japa/expect'
import { configure } from '@japa/runner'

configure({
  plugins: [expect()]
})
```

Once done, you will be able to access the `expect` property on the test context.

```ts
test('test title', ({ expect }) => {
  expect(100).toBeWithinRange(90, 110)
})
```

[github-actions-url]: https://github.com/japa/expect/actions/workflows/checks.yml "github-actions"

[github-actions-image]: https://img.shields.io/github/actions/workflow/status/japa/expect/checks.yml?style=for-the-badge

[npm-image]: https://img.shields.io/npm/v/@japa/expect.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@japa/expect "npm"

[license-image]: https://img.shields.io/npm/l/@japa/expect?color=blueviolet&style=for-the-badge
[license-url]: LICENSE.md "license"

[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[typescript-url]:  "typescript"
npm package: @japa/expect-type
Description: Write assertions for TypeScript types
Author: Harminder Virk
Latest version: 2.0.4

# @japa/expect-type

> Write assertions for TypeScript types

[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url]

The `expect-type` plugin of Japa helps you write assertions against the TypeScript types. There is no runtime behavior with the `expect-type` plugin and you need to compile your code to view the assertion errors.

The plugins wraps [expect-type](https://www.npmjs.com/package/expect-type) under the hood.

#### [Complete API documentation](https://japa.dev/docs/plugins/expect-type)

## Installation

Install the package from the npm registry as follows:

```sh
npm i @japa/expect-type
```

```sh
yarn add @japa/expect-type
```

## Usage

You can use this package with the `@japa/runner` as follows.

```ts
import { expectTypeOf } from '@japa/expect-type'
import { configure } from '@japa/runner'

configure({
  plugins: [expectTypeOf()],
})
```

Once done, you will be able to access the `expectTypeOf` property on the test context.

```ts
test('test title', ({ expectTypeOf }) => {
  expectTypeOf({ foo: 'bar' }).toEqualTypeOf<{ foo: string }>()
})
```

[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/japa/expect-type/checks.yml?style=for-the-badge
[gh-workflow-url]: https://github.com/japa/expect-type/actions/workflows/checks.yml 'Github action'
[npm-image]: https://img.shields.io/npm/v/@japa/expect-type/latest.svg?style=for-the-badge&logo=npm
[npm-url]: https://www.npmjs.com/package/@japa/expect-type/v/latest 'npm'
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[license-url]: LICENSE.md
[license-image]: https://img.shields.io/github/license/japa/expect-type?style=for-the-badge
npm package: @japa/file-system
Description: File system plugin for writing assertions for files and directories
Author: Harminder Virk
Latest version: 3.0.0

# @japa/file-system

> File system plugin for Japa

[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url]

The file system plugin allows you to easily manage files and directories during tests and write assertions against them.

#### [Complete API documentation](https://japa.dev/docs/plugins/file-system)

## Installation

You can install the plugin from the npm packages registry as follows.

```sh
npm i -D @japa/file-system
```

## Usage

The next step is registering the plugin inside the `plugins` array.

```ts
import { fileSystem } from '@japa/file-system'

configure({
  plugins: [fileSystem()],
})
```

Once the plugin has been registered, you can access the `fs` property from the test context. The `fs` property exposes the helper functions to **read** and **write** files. For example:

```ts
test('read rc file', async ({ fs }) => {
  await fs.write(
    'rc.json',
    JSON.stringify({
      foo: 'bar',
    })
  )

  await runMethodThatNeedsRcFile()
})
```

[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/japa/file-system/checks.yml?style=for-the-badge
[gh-workflow-url]: https://github.com/japa/file-system/actions/workflows/checks.yml 'Github action'
[npm-image]: https://img.shields.io/npm/v/@japa/file-system/latest.svg?style=for-the-badge&logo=npm
[npm-url]: https://www.npmjs.com/package/@japa/file-system/v/latest 'npm'
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[license-url]: LICENSE.md
[license-image]: https://img.shields.io/github/license/japa/file-system?style=for-the-badge
npm package: @japa/openapi-assertions
Description: OpenAPI Assertions plugin for Japa
Author: Harminder Virk
Latest version: 0.1.2

# @japa/openapi-assertions

<br />

[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url]

## Introduction

This package contains the OpenAPI Assertion tests that used to be included in `@japa/assert`

## Installation

Install the package from the npm registry as follows:

```sh
npm i -D @japa/openapi-assertions

yarn add -D @japa/openapi-assertions
```

## Official Documentation

You can use the assertion package with the `@japa/runner` as follows, registering an OpenAPI Schema:

```ts
import { openapi } from '@japa/openapi-assertions'

configure({
  plugins: [
    openapi({
      schemas: [new URL('../api-spec.json', import.meta.url)],
    }),
  ],
})
```

In tests you can validate API responses using the `assert.isValidApiResponse` method.

```ts
test('get users', ({ assert }) => {
  const response = await supertest(baseUrl).get('/users')
  assert.isValidApiResponse(response)
})
```

## Contributing

One of the primary goals of japa is to have a vibrant community of users and contributors who believes in the principles of the framework.

We encourage you to read the [contribution guide](https://github.com/japa/.github/blob/main/docs/CONTRIBUTING.md) before contributing to the framework.

## Code of Conduct

In order to ensure that the japa community is welcoming to all, please review and abide by the [Code of Conduct](https://github.com/japa/.github/blob/main/docs/CODE_OF_CONDUCT.md).

## License

@japa/openapi-assertions is open-sourced software licensed under the [MIT license](LICENSE.md).

[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/japa/openapi-assertions/checks.yml?style=for-the-badge
[gh-workflow-url]: https://github.com/japa/openapi-assertions/actions/workflows/checks.yml 'Github action'
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[typescript-url]: "typescript"
[npm-image]: https://img.shields.io/npm/v/@japa/openapi-assertions.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@japa/openapi-assertions 'npm'
[license-image]: https://img.shields.io/npm/l/@japa/openapi-assertions?color=blueviolet&style=for-the-badge
[license-url]: LICENSE.md 'license'
npm package: @japa/plugin-adonisjs
Description: A bridge between AdonisJS and Japa
Author: Harminder Virk
Latest version: 5.2.0

# @japa/plugin-adonisjs

<br />

[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url]

## Introduction

The `@japa/plugin-adonisjs` is a plugin to test AdonisJS applications with Japa. It contributes AdonisJS specific methods and properties with the [APIClient](https://japa.dev/docs/plugins/api-client), [BrowserClient](https://japa.dev/docs/plugins/browser-client), and the [TestContext](https://japa.dev/docs/test-context).

## Official Documentation

The documentation is available on the [AdonisJS website](https://docs.adonisjs.com/guides/testing/introduction)

## Contributing

One of the primary goals of Japa is to have a vibrant community of users and contributors who believes in the principles of the framework.

We encourage you to read the [contribution guide](https://github.com/japa/.github/blob/main/docs/CONTRIBUTING.md) before contributing to Japa.

## Code of Conduct

In order to ensure that the Japa community is welcoming to all, please review and abide by the [Code of Conduct](https://github.com/japa/.github/blob/main/docs/CODE_OF_CONDUCT.md).

## License

Japa Plugin AdonisJS is open-sourced software licensed under the [MIT license](LICENSE.md).

[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/japa/plugin-adonisjs/checks.yml?style=for-the-badge
[gh-workflow-url]: https://github.com/japa/plugin-adonisjs/actions/workflows/checks.yml 'Github action'
[npm-image]: https://img.shields.io/npm/v/@japa/plugin-adonisjs/latest.svg?style=for-the-badge&logo=npm
[npm-url]: https://www.npmjs.com/package/@japa/plugin-adonisjs/v/latest 'npm'
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[license-url]: LICENSE.md
[license-image]: https://img.shields.io/github/license/japa/plugin-adonisjs?style=for-the-badge
npm package: @japa/preset-adonis
Description: Preset for AdonisJS
Author: virk,japa
Latest version: 1.2.0

# AdonisJS Preset
> Bundled with opinionated plugins and reporters.

[![github-actions-image]][github-actions-url] [![npm-image]][npm-url] [![license-image]][license-url] [![typescript-image]][typescript-url]

Instead of installing individual plugins and reporters, this preset bundles them within a single package.

## Installation
Install the package from the npm registry as follows:

```sh
npm i @japa/preset-adonis
```

## Usage

Use the plugins as follows.

```ts
import { assert, specReporter, runFailedTests } from '@japa/preset-adonis'

configure({
  plugins: [assert(), runFailedTests()],
  reporters: [specReporter()]
})
```

[github-actions-image]: https://github.com/japa/preset-adonis/actions/workflows/test.yml
[github-actions-url]: https://img.shields.io/github/workflow/status/japa/preset-adonis/test?style=for-the-badge "github-actions"

[npm-image]: https://img.shields.io/npm/v/@japa/preset-adonis.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@japa/preset-adonis "npm"

[license-image]: https://img.shields.io/npm/l/@japa/preset-adonis?color=blueviolet&style=for-the-badge
[license-url]: LICENSE.md "license"

[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[typescript-url]:  "typescript"
npm package: @japa/preset-sails
Description: Bundled with opinionated plugins and reporters for Sails
Author: Kelvin Omereshone Oghenerhoro
Latest version: 1.0.0
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# Sails preset

> Bundled with opinionated plugins and reporters

Instead of installing individual plugins, reporters and starting the Sails server, this preset bundles them within a single package and exposed setup Sails for you.


```sh
npm i @japa/preset-sails --save-dev
```


## Usage

Use the plugins as follows.

```js
const { presetSails, assert, runFailedTests, specReporter, apiClient } = require('preset-sails')

configure({
  plugins: [presetSails(), assert(), runFailedTests(), apiClient('http://localhost:3333')],
  reporters: [specReporter]
})
```
npm package: @japa/run-failed-tests
Description: Run only failed japa tests
Author: virk,japa
Latest version: 1.1.1

# @japa/run-failed-tests
> Japa plugin to run only failed tests

[![github-actions-image]][github-actions-url] [![npm-image]][npm-url] [![license-image]][license-url] [![typescript-image]][typescript-url]

The `@japa/run-failed-tests` plugin runs only the failed tests on subsequent runs.

Here's how it works under the hood.

- You ran the tests suite, and a couple of tests failed.
- On the next run, only the failed test will run.
- If all tests are green, the next run will execute all the tests.

```sh
npm i @japa/run-failed-tests 
```

```ts
import { runFailedTests } from '@japa/run-failed-tests'

configure({
  plugins: [runFailedTests()]
})
```

[github-actions-image]: https://img.shields.io/github/actions/workflow/status/japa/run-failed-tests/test.yml?style=for-the-badge
[github-actions-url]: https://github.com/japa/run-failed-tests/actions/workflows/test.yml "github-actions"

[npm-image]: https://img.shields.io/npm/v/@japa/run-failed-tests.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@japa/run-failed-tests "npm"

[license-image]: https://img.shields.io/npm/l/@japa/run-failed-tests?color=blueviolet&style=for-the-badge
[license-url]: LICENSE.md "license"

[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[typescript-url]:  "typescript"
npm package: @japa/runner
Description: A simple yet powerful testing framework for Node.js
Author: Harminder Virk
Latest version: 5.3.0

# @japa/runner
> A simple yet powerful testing framework for Node.js

[![github-actions-image]][github-actions-url] [![npm-image]][npm-url] [![license-image]][license-url] [![typescript-image]][typescript-url]

Japa comes with everything you need to test your backend applications. Be it writing JSON API tests using an Open API schema or writing browser tests using Playwright.

Unlike other testing frameworks born out of the frontend ecosystem, Japa focuses only on testing backend applications and libraries. Therefore, Japa is **simpler**, **faster**, and **bloatware free**.

Japa

#### 💁 Please visit https://japa.dev for documentation

<br />
<hr>

**Featured sponsors**

<table>

<tr>
<td>

<a href="https://route4me.com/?utm_source=adonisjs.com">
  <img src="https://raw.githubusercontent.com/thetutlage/static/refs/heads/main/featured_sponsors/logos/route4me.jpg" />
</a>

</td>

<td>

<a href="https://ezycourse.com/?utm_source=adonisjs.com">
  <img src="https://raw.githubusercontent.com/thetutlage/static/refs/heads/main/featured_sponsors/logos/ezycourse.jpg" />
</a>

</td>

</tr>

<tr>

<td>

<a href="https://meteor.software/g6h?utm_source=adonisjs.com">
  <img src="https://raw.githubusercontent.com/thetutlage/static/refs/heads/main/featured_sponsors/logos/galaxy.jpg" />
</a>

</td>

<td>

<a href="https://www.lambdatest.com/?utm_source=adonisjs.com">
  <img src="https://raw.githubusercontent.com/thetutlage/static/refs/heads/main/featured_sponsors/logos/lambdatest.jpg" />
</a>

</td>

</tr>

<tr>

<td>

<a href="https://relancer.com/?utm_source=adonisjs.com">
  <img src="https://raw.githubusercontent.com/thetutlage/static/refs/heads/main/featured_sponsors/logos/relancer.jpg" />
</a>

</td>

<td>

</td>

</tr>

</table>

![](https://raw.githubusercontent.com/thetutlage/static/main/sponsorkit/sponsors.png)

[github-actions-image]: https://img.shields.io/github/actions/workflow/status/japa/runner/checks.yml?style=for-the-badge "github-actions"

[github-actions-url]: https://github.com/japa/runner/actions/workflows/checks.yml

[npm-image]: https://img.shields.io/npm/v/@japa/runner.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@japa/runner "npm"

[license-image]: https://img.shields.io/npm/l/@japa/runner?color=blueviolet&style=for-the-badge
[license-url]: LICENSE.md "license"

[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[typescript-url]:  "typescript"
npm package: @japa/snapshot
Description: Snapshot testing plugin for Japa
Author: japa, Julien Ripouteau
Latest version: 2.0.10

# @japa/snapshot

> Snapshot testing plugin for Japa

[![gh-workflow-image]][gh-workflow-url] [![npm-image]][npm-url] ![][typescript-image] [![license-image]][license-url]

Snapshot testing plugin for Japa. This plugin allows you to write snapshot tests for your application.

#### [Complete API documentation](https://japa.dev/docs/plugins/snapshot)

## Installation

Install the package from the npm registry as follows:

```sh
npm i @japa/snapshot

pnpm i @japa/snapshot

yarn add @japa/snapshot
```

## Usage

You can use this package with the `@japa/runner` as follows.

```ts
import { snapshot } from '@japa/snapshot'
import { configure } from '@japa/runner'

configure({
  plugins: [snapshot()],
})
```

Once done, you will be able to use the 2 new matchers added, either on expect or assert

```ts
test('test title', ({ expect, assert }) => {
  // with @japa/assert
  assert.snapshot('1').match()

  // with @japa/expect
  expect('1').toMatchSnapshot()
})
```

[gh-workflow-image]: https://img.shields.io/github/actions/workflow/status/japa/snapshot/actions/checks.yml?style=for-the-badge
[gh-workflow-url]: https://github.com/japa/snapshot/actions/workflows/checks.yml 'Github action'
[npm-image]: https://img.shields.io/npm/v/@japa/snapshot/latest.svg?style=for-the-badge&logo=npm
[npm-url]: https://www.npmjs.com/package/@japa/snapshot/v/latest 'npm'
[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[license-url]: LICENSE.md
[license-image]: https://img.shields.io/github/license/japa/snapshot?style=for-the-badge
npm package: @japa/spec-reporter
Description: Spec reporter for japa test runner
Author: virk,japa
Latest version: 1.3.3

# @japa/spec-reporter
> Spec reporter for Japa tests runner

[![github-actions-image]][github-actions-url] [![npm-image]][npm-url] [![license-image]][license-url] [![typescript-image]][typescript-url]

Spec reporter displays a detailed output for the executed tests.

![](assets/spec-reporter-output.png)

## Installation
Install the package from the npm registry as follows.

```sh
npm i -D @japa/spec-reporter

# yarn
yarn add -D @japa/spec-reporter
```

## Usage
You can use the spec reporter with the `@japa/runner` as follows.

```ts
import { configure } from '@japa/runner'
import { specReporter } from '@japa/spec-reporter'

configure({
  reporters: [specReporter()]
})
```

[github-actions-image]: https://img.shields.io/github/actions/workflow/status/japa/spec-reporter/test.yml?style=for-the-badge

[github-actions-url]: https://github.com/japa/spec-reporter/actions/workflows/test.yml "github-actions"

[npm-image]: https://img.shields.io/npm/v/@japa/spec-reporter.svg?style=for-the-badge&logo=npm
[npm-url]: https://npmjs.org/package/@japa/spec-reporter "npm"

[license-image]: https://img.shields.io/npm/l/@japa/spec-reporter?color=blueviolet&style=for-the-badge
[license-url]: LICENSE.md "license"

[typescript-image]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
[typescript-url]:  "typescript"
npm package: @japan-d2/api
Description: API client implementation based on @japan-d2/schema-api-endpoint
Author: AOKI Yuto
Latest version: 0.8.2

# api

API client implementation based on [@japan-d2/schema-api-endpoint](https://github.com/japan-d2/js-schema-api-endpoint)

# install

```bash
npm install @japan-d2/api
```

or

```bash
yarn add @japan-d2/api
```

# usage

TODO

# example

TODO

# license

MIT
npm package: @japan-d2/cra-template
Description: The base TypeScript template for Create React App.
Author: Hidetaka Ooki
Latest version: 0.6.0

# cra-template

This is the TypeScript template for [Create React App](https://github.com/facebook/create-react-app).

To use this template, add `--template @japan-d2` when creating a new app.

For example:

```
npx create-react-app my-app --template @japan-d2

# or

yarn create react-app my-app --template @japan-d2
```

## VSCode

Install [Debugger for Chrome](https://marketplace.visualstudio.com/items?itemName=msjsdiag.debugger-for-chrome).

```
code --install-extension msjsdiag.debugger-for-chrome
```
npm package: @japan-d2/error-handler
Description: A type-safe error handling library that can automatically re-throw unhandled errors.
Author: AOKI Yuto
Latest version: 0.0.4

# error-handler

A type-safe error handling library that can automatically re-throw unhandled errors.

# install

```bash
npm install @japan-d2/error-handler
```

or

```bash
yarn add @japan-d2/error-handler
```

# usage

## Error Class Designing

NOTE: It does not work when transpiring to es5 or lower.

```typescript
class BaseError extends Error {
  constructor () {
    super(code)
    this.name = this.constructor.name
  }
}

class NetworkError extends BaseError {}
```

## Handling

```typescript
import { handleExpectedErrors } from '@japan-d2/error-handler'

try {
  throw new NetworkError()
} catch (error) {
  handleExpectedErrors(error, ({ handleError }) => {
    handleError(Error, (e) => {
      // only first matched handler will be called
      expectedToCall()
    })
    handleError(NetworkError, (e) => {
      doNotCall()
    })
  })
}
```

## Pass-Through

```typescript
import { handleExpectedErrors } from '@japan-d2/error-handler'

try {
  throw new NetworkError()
} catch (error) {
  handleExpectedErrors(error, ({ handleError, pass }) => {
    handleError(Error, (e) => {
      // umm... I give up handling.
      pass()
    })
    handleError(NetworkError, (e) => {
      // to be called
      expectedToCall()
    })
  })
}
```

## Result

Returning a value in `handleError` will also propagate to the return value of `handleExpectedErrors`.

```typescript
import { handleExpectedErrors } from '@japan-d2/error-handler'

try {
  throw new NetworkError()
} catch (error) {
  return handleExpectedErrors(error, ({ handleError, pass }) => {
    handleError(Error, (e) => {
      return {
        statusCode: 500,
        body: JSON.stringify({
          message: e.message,
        })
      }
    })
  })
}
```

## Options

### throwIfUnhandled: boolean (default = true)

```typescript
import { handleExpectedErrors } from '@japan-d2/error-handler'

try {
  (undefined as any).hello()
} catch (error) {
  handleExpectedErrors(error, ({ handleError }) => {
    handleError(NetworkError, (e) => {
      console.error(e)
    })
  }, { throwIfUnhandled: false })

  // please handle manually...
}
```

# license

MIT
npm package: @japan-d2/gcd
Description: compute Greatest Common Divisor (GCD)
Author: AOKI Yuto
Latest version: 0.0.8

# gcd

Compute the greatest common divisor using
[Euclid's algorithm](https://en.wikipedia.org/wiki/Greatest_common_divisor#Using_Euclid.27s_algorithm).

# install

```bash
npm install @japan-d2/gcd
```

or

```bash
yarn add @japan-d2/gcd
```

# how to use

## example

```ts
import gcd from '@japan-d2/gcd'
console.log(gcd(721, 161))
```

### Output

```
7
```

## methods

### gcd(a: number, b: number): number

Return the greatest common divisor of the integers `a` and `b` using Euclid's algorithm.

# BigInt support

## example

```ts
import gcd from '@japan-d2/gcd/lib/bigint'
console.log(gcd(721n, 161n))
```

### Output

```
7n
```

## methods

### gcd(a: bigint, b: bigint): bigint

Return the greatest common divisor of the integers `a` and `b` using Euclid's algorithm.

# license

MIT
npm package: @japan-d2/id2
Description: the ID converter that can convert between IDs with different orders and character types and unique numeric sequences.
Author: AOKI Yuto
Latest version: 0.0.4

# id2

the ID converter that can convert between IDs with different orders and character types and unique numeric sequences.

# install

```bash
npm install @japan-d2/id2
```

or

```bash
yarn add @japan-d2/id2
```

# example

## Human Readable ID

### Instantiate

```ts
const id2 = new ID2.Converter({
  format: ID2.Converter.format('XXXX-00000', {
    X: 'ACFHJKPRSTUVWXYZ',
    0: '234567'
  })
})
```

### Convert number to string

```ts
id2.stringify(0)
// => 'AAAA-22222'
id2.stringify(1)
// => 'AAAA-22223'
id2.stringify(1234567)
// => 'AATY-65553'
id2.stringify(id2.numberOfAvailableIDs - BigInt(1))
// => 'ZZZZ-77777'
```

### Convert string to number

```ts
id2.parse('AAAA-22222')
// => 0n
id2.parse('AAAA-22223')
// => 1n
id2.parse('AATY-65553')
// => 1234567n
id2.parse('ZZZZ-77777')
// => 509607935n
```

## UUID v4

### Instantiate

```ts
import ID2 from '@japan-d2/id2'
const id2 = new ID2.Converter({
  format: ID2.Converter.format('RRRRRRRR-RRRR-4RRR-rRRR-RRRRRRRRRRRR', {
    R: '0123456789abcdef',
    r: '89ab'
  })
})
```

### Convert number to string

```ts
id2.stringify(0)
// => '00000000-0000-4000-8000-000000000000'
id2.stringify(BigInt('3881947731413173145134900932847109277'))
// => 'bae8b334-a84b-4d25-ba49-3b943cfc849d'
id2.stringify(id2.numberOfAvailableIDs - BigInt(1))
// => 'ffffffff-ffff-4fff-bfff-ffffffffffff'
```

### Convert string to number

```ts
id2.parse('00000000-0000-4000-8000-000000000000')
// => 0n
id2.parse(BigInt('3881947731413173145134900932847109277'))
// => 3881947731413173145134900932847109277n
id2.parse('ffffffff-ffff-4fff-bfff-ffffffffffff')
// => 5316911983139663491615228241121378303n
```

# classes

## class Converter

#### new Converter (options: Options)

##### `Options`

###### `format`

for ID pattern `[A-Z]{3}-[0-9]{4}`

```ts
new ID2.Converter({
  format: [
    {
      characters: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
      repeats: 3
    },
    {
      characters: '-',
    },
    {
      characters: '0123456789',
      repeats: 4
    }
  ]
})
```

Or use the more manageable pattern helper.

```ts
// Same format as above.
new ID2.Converter({
  format: ID2.Converter.format('XXX-0000', {
    X: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ',
    0: '0123456789'
  })
}
```

#### stringify (n: number | bigint): string

Converts the given number to a string.

#### parse (id: string): bigint

Converts the given id to a number.

#### lengthOfID: number

ID length specified by format.

#### numberOfAvailableIDs: number

Maximum number of IDs specified by format.

# license

MIT
npm package: @japan-d2/random-bigint
Description: A random number generator that generates random BigInt with the specified seed and maximum value using Xorshift.
Author: AOKI Yuto
Latest version: 0.0.5

# random-bigint

A random number generator that generates random BigInt with the specified seed and maximum value using [Xorshift](https://en.wikipedia.org/wiki/Xorshift).

# install

```bash
npm install @japan-d2/random-bigint
```

or

```bash
yarn add @japan-d2/random-bigint
```

# example

```ts
import { RandomGenerator } from '@japan-d2/random-bigint'

const random = new RandomGenerator({
  seed: BigInt(123456789), // accepts any positive integer
  limit: BigInt(10) ** BigInt(64) // for example, 64 digits maximum
})

random.next()
// => 5637762571260449273030132647656691852295390566410681230793181046n
random.next()
// => 4457241536950578442517528619126578343447503233842310925555103992n
random.next()
// => 9489098265339258643990268960842203575162730303587018422124828169n
random.next()
// => 5945162572438736028849931049929240611671488712663034771122619621n
```
# classes

## class RandomGenerator

#### new RandomGenerator (options: Options)

##### `Options`

###### `seed: bigint`

seed for random generator.

###### `limit: bigint`

limit of random values.

###### `discards: number`

discard first n values. (default = 100)

#### next (): bigint

returns random value and advance the state of the generator.

#### look (): bigint

look the next random number **without** changing the state of the generator

# license

MIT
npm package: @japan-d2/rho
Description: JavaScript implementation that compute prime factors using Pollard's rho algorithm
Author: AOKI Yuto
Latest version: 0.0.10

# rho

Compute prime factors using [Pollard's rho algorithm](https://en.wikipedia.org/wiki/Pollard%27s_rho_algorithm).

# install

```bash
npm install @japan-d2/rho
```

or

```bash
yarn add @japan-d2/rho
```

# how to use

## example

```ts
import rho from '@japan-d2/rho'
console.log(rho(451341))
```

### Output

```
[3, 3, 11, 47, 97]
```

## methods

### rho(n: number): number[]

Returns the prime factors of `n` sorted in ascending order.

# BigInt support

## example

```ts
import rho from '@japan-d2/rho/lib/bigint'
console.log(rho(451341n))
```

### Output

```
[3n, 3n, 11n, 47n, 97n]
```

## methods

### rho(n: bigint): bigint[]

Returns the prime factors of `n` sorted in ascending order.

# license

MIT
npm package: @japan-d2/schema-api-endpoint
Description: API endpoint specification based on @japan-d2/schema
Author: AOKI Yuto
Latest version: 0.10.1

# schema-api-endpoint

API endpoint specification based on @japan-d2/schema

# install

```bash
npm install @japan-d2/schema-api-endpoint
```

or

```bash
yarn add @japan-d2/schema-api-endpoint
```

# usage

```
const schema = endpointSchema({
  summary: 'test endpoint',
  description: 'this is test endpoint',
  request: {
    query: d => d.string('name'),
    body: d => d.string('data'),
    headers: d => d.string('authorization')
  },
  response: {
    body: d => d.string('data'),
    headers: d => d.string('cache-control')
  }
})

schema.request.toJSONSchema()
schema.response.toJSONSchema()
```

# license

MIT
npm package: @japan-d2/scrambler
Description: Converts an integer to another integer that is unpredictable and reversible.
Author: AOKI Yuto
Latest version: 0.0.5

# @japan-d2/scrambler

Converts an integer to another integer that is unpredictable and reversible.

# install

```bash
npm install @japan-d2/scrambler
```

or

```bash
yarn add @japan-d2/scrambler
```

# how to use

## find two numbers

1. Decide the number of digits (ex. 4)
2. Decide one **first odd number (n1)** that fits in the number of digits (ex. 1101)
3. Formulate

`1101x - (10^4)y = 1`

4. Enter the formula into [Wolfram|Alpha](https://www.wolframalpha.com/) and get an integer solution

`x = 10000 n + 8901, y = 1101 n + 980, n element Z`

5. Get the **second odd number (n2)**

`8901`

## example

```ts
import { createScrambler } from '@japan-d2/scrambler'

const scrambler = createScrambler({
  digits: 4,
  n1: BigInt(1101),
  n2: BigInt(8901),
  seed: 123456789,
  stages: 10
})

const from = BigInt(1)
const to = scrambler.scramble(from)
const restored = scrambler.restore(to)

console.log({
  from,
  to,
  restored
})
```

### Output

```
{
  from: 1n,
  to: 4055n,
  restored: 1n
}
```

## methods

### createScrambler(options): Scrambler

Return the scrambler.

#### Options

##### digits: number

number of digits in space.

##### n1: number, n2: number

Odd number pair that satisfies `(n1 * n2) % (10 ** digits) === 1`.

##### seed: number

Seed value for swap table creation.

##### stages: number

Number of swap/slide stages.

# license

MIT
npm package: @japikey/authenticate
Description: Library to authenticate an API key, in the browser or backend
Author: Anil Kulkarni
Latest version: 0.4.0

# @japikey/authenticate

This package is used whenever you have an API key, and you want to check to see if it's valid and the claims stored within it

This package understands api keys created by the @japikey/japikey library. Since these keys use public/private key cryptography,
it depends on the caller providing the public key. This can either be done manually, or via a URL such as `.well-known/jwks.json`

This package is part of the @japikey constellation of packages. See @japikey/japikey for more details

# Usage

Given a known issuer (the server that generated your api key), you can set the issuer to that URL
Then, if your server is implementing the JWKS scheme of this repository, you can use `createGetJWKS` to get the correct
public key for the token.

The authenticate method takes the public key, and uses jose.jwtVerify() to validate the api key

```ts
import { createGetJWKS, authenticate } from '@japikey/authenticate';
const issuer = new URL('https://example.com');
const getJWKS = createGetJWKS(issuer);
await authenticate(my_auth_token, { getJWKS, baseIssuer });
```

The authenticate method will throw a `JapikeyError` upon failure. See @japikey/shared for more details about error handling.

In addition, you can also use the `shouldAuthenticate` method to determine if the access token appears to be a japikey (based on its unverified claims)

```ts
import { shouldAuthenticate } from '@japikey/authenticate';
const issuer = new URL('https://example.com');
const isJapikey = shouldAuthenticate(my_auth_token, issuer);
```
npm package: @japikey/shared
Description: Shared utilities for JAPIKey
Author: Anil Kulkarni
Latest version: 0.4.0

# @japikey/shared

This package contains definitions and errors used throughout the japikey ecosystem. Some of these definitions are re-exported from @japikey/japikey for convenience. You can use either import as desired.

This package is part of the @japikey constellation of packages. See @japikey/japikey for more details

# Error handling

All exceptions in the japikey ecosystem are wrapped in a defined set of errors. This lets you have specific error handling code depending on the type of error (even if it's from an underlying library (e.g. jose)). The errors are also aimed at being HTTP-endpoint friendly. They contain an HTTP status code, and the endpoint libraries are equipped to turn these errors into proper, JSON-based responses

All errors derive from JapikeyError:

```ts
export class JapikeyError extends Error {
  constructor(
    public code: StatusCode,
    public errorType: errorType,
    message?: string,
    options?: ErrorOptions
  ) {
    super(message, options);
  }
}
```

Other error types just help to refine the code, errorType.

# Database utilities

The shared library also defines the interface for all of the Database drivers. Any driver wishing to easily interact with japikey must implement these methods:

```ts
export type DatabaseDriver = {
  ensureTable: () => Promise<void>;
  insertApiKey: (apiKey: ApiKeyRow) => Promise<void>;
  getApiKey: (kid: string) => Promise<ApiKeyRow | null>;
  findApiKeys: (
    user_id: string,
    limit?: number,
    offset?: number
  ) => Promise<ApiKeyRow[]>;
  revokeApiKey: (filter: { user_id: string; kid: string }) => Promise<void>;
  close: () => Promise<void>;
  [TRUNCATE_TABLE_ONLY_USE_FOR_UNIT_TESTS]: () => Promise<void>;
};
```
npm package: @japikey/sqlite
Description: SQLite driver for japikey
Author: Anil Kulkarni
Latest version: 0.4.0

# @japikey/sqlite

This implements the DatabaseDriver methods for saving and retreiving japikey information from a database. You can either use these methods yourself, or you can pass the driver into existing endpoint library (such as @japikey/express) to handle it for you

This package is part of the @japikey constellation of packages. See @japikey/japikey for more details

# Usage

```ts
import SqliteDriver from '@japikey/sqlite';
const db = new SqliteDriver(':memory:'); // or your path-to-disk
await db.ensureTable();
// More db operations
```
npm package: @japl65/elementinspector
Description: Una herramienta universal para monitorear en tiempo real la estructura de aplicaciones web
Author: japl65
Latest version: 1.0.4

# ElementInspector

Una herramienta universal para monitorear en tiempo real la estructura de aplicaciones web, rastrear clicks y generar reportes detallados.

## Instalación

### Opción 1: Incluir directamente en HTML

```html
<script src="https://unpkg.com/@japl65/elementinspector@1.0.3/dist/element-inspector.min.js"></script>
```

### Opción 2: Instalar vía npm

```bash
npm install @japl65/elementinspector
```

## Uso Rápido

```javascript
import { activateInspector, deactivateInspector } from '@japl65/elementinspector';

// Activar el inspector
activateInspector();

// Desactivar el inspector
deactivateInspector();
```

## Características

- Activación/desactivación con atajo de teclado (Ctrl+Shift+I)
- Resaltado de elementos al pasar el cursor
- Información detallada de elementos con Alt+clic
- Modo de prueba integrado
- Historial y control de versiones

## Documentación

Para documentación completa, consulta [DOCUMENTATION.md](DOCUMENTATION.md)

## Licencia

MIT