open-index/open-npm huggingface dataset:
npm package: @stegopop/ajax-tap
Description: Listen in on any trusted XHR's made on your webpage. Run functions when your conditions are met.
Author: Nick Adams
Latest version: 1.0.7

# AjaxTap

[![npm version](https://badge.fury.io/js/@stegopop%2Fajax-tap.svg)](https://badge.fury.io/js/@stegopop%2Fajax-tap)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

Listen in on any trusted XHR's made on your webpage. Run functions when your conditions are met.

## Why?

Say we are performing CRUD operation with AJAX through our (or someone else's) API. 

And the API always returns this structure

```
{
    type: String (success|failure),
    message: String (A user-friendly message)
}
```

It's not mandatory that you return JSON. It could be JSON, HTML, XML, or plain Text.

In your main template you could listen to all Ajax requests, and if they have this structure and come from a URL origin you trust, you can display the message at the top of the page.

```js
<script src="/dist/ajax-tap.min.js"></script>
<script>
    (function() {
        new AjaxTap()
            .addResponseEvent({
                trustedMessengers: [ "a-different-domain-you-trust.com" ],
                conditions: function(data) {
                    // The response contains keys for 'type' and 'message'.
                    return (data.type && data.message)
                },
                fire: function(data) {
                    // Display the message at the top of the page.
                    var messages = document.querySelector("#messages");
                    var message = document.createElement("div");
                        message.classList.add(data.type);
                        message.innerText = data.message;
                    messages.appendChild(message);
                }
            })
            .listen();
    })();
</script>
```

## Install

With NPM

```markdown
npm install @stegopop/ajax-tap
```

With a CDN

```html
<script src="https://cdn.jsdelivr.net/npm/@stegopop/ajax-tap"></script>
```

## Browser Support

This project is transpiled to support back to IE11.

## Methods

`addResponseEvent(options)`

Adds a Request Event to the Tap. You can add multiple Request Events to a Tap.
This method returns the Tap so you can chain off of it.
 
Request Event Object Options
 - trustedMessengers (optional): Array
     -  The origin of the calling website is included in trustedMessengers by default.
 - conditions        (required): Function
     - You must provide data as an argument to this function.
     - This function must return true or false.
 - fire              (required): Function
     - You must provide data as an argument to this function.
     - This function must return true or false.

`listen()`

Begin listening to ajax requests for each RequestEvent on the Tap.

`url(str)`

A static helper method to get url properties from a String.

Returns 
 - hostname
 - protocol
 - search
 - port
 - origin
 - string
 - host
 - hash
 - pathname
npm package: @stegripe/biomejs-config
Description: A BiomeJS shareable configuration package that we used in our projects.
Author: Stegripe Development
Latest version: 1.1.0

# biomejs-config
> A BiomeJS [shareable configuration](https://biomejs.dev/) package that we used in our projects.

<div align="center">
<a href="https://www.npmjs.com/package/@stegripe/biomejs-config">
  <img src="https://img.shields.io/npm/v/@stegripe/biomejs-config?maxAge=3600" alt="npm version" ></a>
  <img src="https://img.shields.io/npm/dt/@stegripe/biomejs-config?maxAge=3600" alt="npm downloads">
</div>

## Install
```sh-session
npm install -D @stegripe/biomejs-config # npm
pnpm add -D @stegripe/biomejs-config # pnpm
yarn add -D @stegripe/biomejs-config # yarn
```

## Usage
This package requires BiomeJS Configuration File.

### Configuration
Create an `biome.json/biome.jsonc` file in the root of your project and add the following code:
```json
{
  "extends": ["@stegripe/biomejs-config"]
}
```

### Extending Rules
You can also extend specific rules by adding them to the `biome.json/biome.jsonc` file. For example:
```json
{
    "extends": ["@stegripe/biomejs-config"],
    "linter": {
        "rules": {
            "nursery": {
                "useExplicitType": "off"
            }
        }
    }
}
```

### Unstable Rules
This configuration uses some rules that are still Work-in-Progress (WIP) and categorized under the [`nursery`](https://biomejs.dev/linter/#nursery).

* [`nursery/noFloatingPromises`](https://biomejs.dev/linter/rules/no-floating-promises): DRequire Promise-like statements to be handled appropriately.
* [`nursery/useExplicitType`](https://biomejs.dev/linter/rules/use-explicit-type): Enforce types in functions, methods, variables, and parameters.
npm package: @steijnveer/create-file-based-router
Description: Create a new fbr project. (@steijnveer/file-based-router)
Author: Steijn Veer
Latest version: 0.0.3

# @steijnveer/create-file-based-router

Create a new file-based-router project with one command.

## Usage

```bash
# npm
npm create @steijnveer/file-based-router my-app

# yarn
yarn create @steijnveer/file-based-router my-app

# pnpm
pnpm create @steijnveer/file-based-router my-app

# bun
bun create @steijnveer/file-based-router my-app
```

Or create in the current directory:

```bash
npm create @steijnveer/file-based-router .
```

## License

MIT © Steijn Veer
npm package: @steijnveer/file-based-router
Description: File-based routing for Express with TypeScript support
Author: Steijn Veer
Latest version: 0.0.3

# @steijnveer/file-based-router

Express file-based routing with TypeScript support. Create routes using file system conventions.

## Installation

```bash
# install package
npm install @steijnveer/file-based-router
```

```bash
# or create new project
npm create @steijnveer/creat-file-based-router
```

## Usage

### Using the CLI

Create a `fbr.config.ts` (or `.js` or `.json`) in your project root:

```typescript
export default {
  router: {
    rootDir: '.\\src\\routes',
    basePath: '/',
  },
  server: {
    port: 3000,
  },
  logLevel: 'info'
};
```

Then run:

```bash
fbr dev
```

## File-Based Routing Conventions

- `index.ts` - Does not append the api path
- `route.ts` - Append api path with the filename
- `[param].ts` - Parameter
- `[[param]].ts` - Optional parameter
- `[...slug].ts` - Catch-all
- `{segment}.ts` - Optional segment

All can be prefixed with `[a-z].` for ensuring order of routes in the same dir:
````
routes/
  blog/
    a.latest.ts
    b.[[title]].ts
  departures/
    [from]{-[to]}.ts
  users/
    [id].ts
  a.index.ts <- will be applied first
  z.index.ts <- will be applied last
````

Routes can export:
- `GET`, `POST`, `PUT`, `PATCH`, `DELETE`, `OPTIONS`, `HEAD` - HTTP method handlers
- `ALL` - Catch-all handler for any method

## Example Route File

```typescript
// src/routes/users/[id].ts
import type { Request, Response } from 'express';

export function GET(req: Request, res: Response) {
  const { id } = req.params;
  res.resolve({ user: { id } });
}

export function DELETE(req: Request, res: Response) {
  const { id } = req.params;
  res.resolve({
    message: `Succesfully deleted user.`,
    data: { deleted: id },
  });
}

export function PATCH(req: Request, res: Response) {
  const { id } = req.params;
  res.reject({
    error: new Error('Cannot update user.'),
  });
}
```

## Development

```bash
# Show help
fbr help

# Run dev
fbr dev
```

## License

MIT
npm package: @steilerdev/axios-har-tracker
Description: ![npm](https://img.shields.io/npm/v/axios-har-tracker?color=9cf&style=plastic)
Author: Beata Kruzycka
Latest version: 0.6.0

![npm](https://img.shields.io/npm/v/axios-har-tracker?color=9cf&style=plastic)

This library was designed for gathering HAR files from requests sent using `axios`

# Credits

Inspiration and some pieces of the code comes from [maciejmaciejewski/request-har](https://github.com/maciejmaciejewski/request-har)

# Usage

In order to use this package install it 
```js
npm install axios-har-tracker
```
and import it by 
```js
import { AxiosHarTracker } from 'axios-har-tracker'
```
and `axios` package 
```js
import axios from 'axios';
```
which will be passed into `AxiosHarTracker` constructor:
```js
const axiosTracker = new AxiosHarTracker(axios); 
```

In order to perform an actual request use the axios.get/post/delete... call, examples:
```js
await axios.get('http://httpstat.us/200');
```
or with catching an error
```js
try {
    await axios.get('http://httpstat.us/404');
} catch (error) {
    console.log("An error appears after call to https://httpstat.us/404:", error);
}
```

Every single request is pushed into the object and user can get it by using
```js
const generatedObject = axiosTracker.getGeneratedHar();
```
Object can be saved into a file in any time using e.g.
```js
writeFileSync('example.har', JSON.stringify(generatedObject), 'utf-8');
```