open-index/open-npm huggingface dataset:
npm package: @stephenboyd/post-validator
Description: A lightweight express middleware to make basic post request body validations
Author: StephenABoyd
Latest version: 1.0.3

<h2 align="center">
    A lightweight express middleware to make basic post request body validations
</h2>

## Install
```js
npm install @stephenboyd/post-validator
```

***

## Explanation
<p>
    This package allows you do add simple validations to Express endpoints.
    To do so, just import the package, create your array of required fields, and start the validator.
</p>

***

## Usage
```js
const express = require('express')
const bodyParser = require('body-parser')
const app = express();

app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json())

// Import post-validator
const apiValidator = require('post-validator')
const validator = apiValidator.apiValidator

// Create the validation you want
const baseValidator = [
    {field: 'itemDescription', type: 'string'}, 
    {field: 'itemNumber', type: 'number'}
]

// Add the validator as a middleware
app.post('/', validator(baseValidator), (req, res) => {
    return res.send('hello')
})

// After all endpoints have been set up, initialize the validators
app.use(apiValidator.startValidators)

app.listen(3000, () => {
    console.log('app started')
})
```
npm package: @stephenbunch/bind
Description: A simple decorator to bind a method to its owner.
Author: Stephen Bunch
Latest version: 0.1.1

```js
import bind from '@stephenbunch/bind';

class Foo {
  @bind bar() {
    return this;
  }
}

var foo = new Foo();
expect( foo.bar.call( undefined ) ).to.equal( foo );
```
npm package: @stephenbunch/event
Description: C# style events using ES7 decorators.
Author: Stephen Bunch
Latest version: 0.2.0

# @Event

Ever since I worked with C#, I've missed the simplicity of its support for [multicast delegates](https://msdn.microsoft.com/en-us/library/ms173175.aspx) (aka events). So when I found out about [ES7 decorators](https://github.com/wycats/javascript-decorators), I had to try it out.

```js
import event from '@stephenbunch/event';

class Button {
  @event onClick

  click() {
    this._onClick.raise( 1, 2, 3 );
  }
}

var button = new Button();

var button_onClick = function( a, b, c ) {
  console.log( this, a, b, c );
};

// Add event listener.
button.onClick += button_onClick;

// prints: Button {}, 1, 2, 3
button.click();

// Remove event listener.
button.onClick -= button_onClick;

// prints nothing
button.click();

// TypeError: onClick.raise is not a function
button.onClick.raise( 1, 2, 3 );
```

## What's the big deal?

When the browser gave us events, they gave us unicast delegates. This pattern is also seen in iOS:

```js
window.onresize = function() {};
```

```swift
var locationManager = CLLocationManager();
locationManager.delegate = self;
```

In some situations, the [delegate pattern](https://developer.apple.com/library/ios/documentation/General/Conceptual/DevPedia-CocoaCore/Delegation.html) makes sense. But when we think of events, what we really want is event *observation*, not event handling. We want a one-to-many relationship, not a one-to-one.

Most libraries solve this problem using a pub/sub API:

```js
class EventEmitter {
  on( event, listener ) {}
  off( event, listener ) {}
  emit( event, ...args ) {}
}
```

The problem with this solution is that we lose the semantic meaning of events. Events should part of the definition of the object, not an API detail of the on/off methods. You never see people write objects like this:

```js
class MyObject {
  get( property ) {}
  set( property, value ) {}
}
```

Why would we do the same for events?

Additionally, the invocation of events should be hidden to the public. If an object is truly an event emitter, then publishing (raising) events from the outside makes sense. But when an event emitter is used to provide events on an object, consumers of that object expect *the object* to do all the invocations and *no one else!*

If you were listening for the 'close' event on a socket, you would not expect someone else to raise that event even though the `emit` method is public.

```js
socket.on( 'close', function() {
  // ...
});

// WTF!!!
socket.emit( 'close' );
```
npm package: @stephenchenorg/astro
Description: Stephenchenorg Astro 前端通用套件
Latest version: 11.0.4

# Stephenchenorg Astro 前端通用套件

[![NPM version][ico-version]][link-npm]
[![Software License][ico-license]](LICENSE)
[![Total Downloads][ico-downloads]][link-downloads]

## 安裝

```bash
# npm
npm install @stephenchenorg/astro
# yarn
yarn add @stephenchenorg/astro
# pnpm
pnpm add @stephenchenorg/astro
```

## 文件

https://stephenchenorg-astro.netlify.app

## 開發

```bash
pnpm install
pnpm build
```

## License

[MIT LICENSE](LICENSE.md)

[ico-version]: https://img.shields.io/npm/v/@stephenchenorg/astro?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen?style=flat-square
[ico-downloads]: https://img.shields.io/npm/dt/@stephenchenorg/astro?style=flat-square
[link-npm]: https://www.npmjs.com/package/@stephenchenorg/astro
[link-downloads]: https://www.npmjs.com/package/@stephenchenorg/astro
npm package: @stephenchenorg/astro-graphql
Description: Stephenchenorg Astro 前端 GraphQL 整合串接套件
Latest version: 11.0.4

# Stephenchenorg Astro 前端 GraphQL 整合串接套件

[![NPM version][ico-version]][link-npm]
[![Software License][ico-license]](LICENSE)
[![Total Downloads][ico-downloads]][link-downloads]

## 安裝

```bash
# npm
npm install @stephenchenorg/astro-graphql
# yarn
yarn add @stephenchenorg/astro-graphql
# pnpm
pnpm add @stephenchenorg/astro-graphql
```

## 文件

https://stephenchenorg-astro.netlify.app

## 開發

```bash
pnpm install
pnpm build
```

## License

[MIT LICENSE](LICENSE.md)

[ico-version]: https://img.shields.io/npm/v/@stephenchenorg/astro-graphql?style=flat-square
[ico-license]: https://img.shields.io/badge/license-MIT-brightgreen?style=flat-square
[ico-downloads]: https://img.shields.io/npm/dt/@stephenchenorg/astro-graphql?style=flat-square
[link-npm]: https://www.npmjs.com/package/@stephenchenorg/astro-graphql
[link-downloads]: https://www.npmjs.com/package/@stephenchenorg/astro-graphql
npm package: @stephencweiss/generate-complementary-colors
Description: A tool to generate complementary colors and convert between rgb, hex, and hsl/hsv
Author: Stephen Weiss
Latest version: 0.0.3

[![](https://img.shields.io/github/languages/code-size/badges/shields.svg)]([![](https://img.shields.io/npm/v/npm.svg)]([![](https://img.shields.io/github/manifest-json/v/:user/:repo.svg)](https://github.com/stephencweiss/generate-complementary-colors)))
[![](https://img.shields.io/npm/v/npm.svg)]([![](https://img.shields.io/github/manifest-json/v/:user/:repo.svg)](https://github.com/stephencweiss/generate-complementary-colors))


# Generate Complementary Colors & Convert Color Types

This library has two aims:
1. Make it as easy as possible to generate complementary colors programatically.
2. Convert easily between color types - HSL, HSV, RGB, and Hexidecimal

# Install

`$ npm install @stephencweiss/generate-complementary-colors`

# Usage

```
const { hsvFromRGB, 
        rgbFromHSV, 
        hslFromRGB, 
        rgbFromHSL, 
        baseTenToHex, 
        baseHexToTen, 
        hexFromRGB, 
        rgbFromHex, 
        generateComplementaryColors 
        } = require('@stephencweiss/generate-complementary-colors');

generateComplementaryColors(5)  // Array(5) [Object, Object, Object, Object, Object]
                                // 0:Object {color: "#19e680", pattern: "dash"}
                                // 1:Object {color: "#3b19e6", pattern: "cross-dash"}
                                // 2:Object {color: "#a1e619", pattern: "line-vertical"}
                                // 3:Object {color: "#19e65d", pattern: "dot-dash"}
                                // 4:Object {color: "#195ee6", pattern: "diamond-box"}

generateComplementaryColors(5, .75, .97) // Using optional parameters of saturation and lightness

hsvFromRGB(240, 200, 80) // [45, 0.66666, 0.94118]
rgbFromHSV(45, 0.66666, 0.94118) // [240, 200, 80]

hslFromRGB(240, 200, 80) // [ 45, 0.8421052631578947, 0.6274509803921569 ]
rgbFromHSL(45, 0.8421052631578947, 0.6274509803921569) // [ 240, 200, 80 ]

baseTenToHex(200) // 'c8' 
baseHexToTen('c8') // 200 

hexFromRGB(240, 200, 80) // #f0c850
rgbFromHex('f0c850') // [ 240, 200, 80 ]

```
npm package: @stephengeller/start
Description: Single CLI entrypoint to all your apps!
Author: Stephen Geller @stephengeller
Latest version: 0.2.0

start
=====

Single CLI entrypoint to all your apps!

[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
[![Version](https://img.shields.io/npm/v/start.svg)](https://npmjs.org/package/start)
[![Downloads/week](https://img.shields.io/npm/dw/start.svg)](https://npmjs.org/package/start)
[![License](https://img.shields.io/npm/l/start.svg)](https://github.com/stephengeller/start/blob/master/package.json)

<!-- toc -->
* [Usage](#usage)
* [Commands](#commands)
<!-- tocstop -->
# Usage
<!-- usage -->
```sh-session
$ npm install -g @stephengeller/start
$ start COMMAND
running command...
$ start (-v|--version|version)
@stephengeller/start/0.2.0 darwin-x64 node-v12.18.1
$ start --help [COMMAND]
USAGE
  $ start COMMAND
...
```
<!-- usagestop -->
# Commands
<!-- commands -->

<!-- commandsstop -->
npm package: @stephenhebert/axios-plugins
Description: A collection of Axios plugins for enhanced functionality.
Author: Stephen Hebert
Latest version: 1.1.0

# @stephenhebert/axios-plugins

A collection of Axios plugins for enhanced functionality.

## Features

- **Allow 404 Responses**: Handle 404 responses gracefully without throwing errors.
- **Inflight Cache**: Prevent duplicate requests by caching inflight requests.
- **Get All Pages**: Automatically fetch paginated API results.

## Installation

Install the package via npm:

```bash
npm install @stephenhebert/axios-plugins
```

## Usage

### Allow 404 Responses

Enable the `allow404` plugin to handle 404 responses gracefully:

```ts
import axios from 'axios'
import { allow404 } from '@stephenhebert/axios-plugins'

const client = axios.create({
  plugins: {
    allow404: true,
  },
})

allow404.install(client)

client.get('http://example.com/api/data')
  .then(response => console.log(response.status)) // 404
  .catch(error => console.error(error))
```

### Inflight Cache

Prevent duplicate requests by enabling the `inflightCache` plugin:

```ts
import axios from 'axios'
import { inflightCache } from '@stephenhebert/axios-plugins'

const client = axios.create({
  plugins: {
    inflightCache: true,
  },
})

inflightCache.install(client)

client.get('http://example.com/api/data')
  .then(response => console.log(response.data))
```

### Get All Pages

Automatically fetch all paginated results:

```ts
import axios from 'axios'
import { getAllPages } from '@stephenhebert/axios-plugins'

const client = axios.create()

getAllPages.install(client)

client.get('http://example.com/api/data', {
    plugins: {
      getAllPages: true,
    },
  })
  .then(response => console.log(response.data))
```

### With Abort Controller

Wrap request callback in factory decorator to handle aborting previous requests when subsequent requests are made:

```ts
import axios from 'axios'
import { withAbortController } from '@stephenhebert/axios-plugins'

const client = axios.create()

const fetchData = withAbortController( async (signal) => { 
  try {
    await client.get('http://example.com/api/data', { signal } )
  }
  catch (error) {}
})

fetchData() // starts first request
fetchData() // cancels first request and starts second request


```

## Development

### Build

Run the following command to build the project:

```bash
npm run build
```

### Test

Run the tests using Vitest:

```bash
npm run test
```

### Lint

Lint the codebase using ESLint:

```bash
npm run lint
```

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

## Contributing

Contributions are welcome! Please open an issue or submit a pull request on [GitHub](https://github.com/stephenhebert/axios-plugins).

## Keywords

- axios
- plugins
- middleware
- interceptors
- http
- typescript
- javascript
- api
npm package: @stephenhebert/changelogithub
Description: Generate changelog for GitHub.
Author: Anthony Fu
Latest version: 0.13.11

# changelogithub

[![NPM version](https://img.shields.io/npm/v/changelogithub?color=a1b858&label=)](https://www.npmjs.com/package/changelogithub)

Generate changelog for GitHub releases from [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/), powered by [changelogen](https://github.com/unjs/changelogen).

[👉 Changelog example](https://github.com/unocss/unocss/releases/tag/v0.39.0)

## Features

- Support exclamation mark as breaking change, e.g. `chore!: drop node v10`
- Grouped scope in changelog
- Create the release note, or update the existing one
- List contributors

## Usage

In GitHub Actions:

```yml
# .github/workflows/release.yml

name: Release

permissions:
  contents: write

on:
  push:
    tags:
      - 'v*'

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0

      - name: Set node
        uses: actions/setup-node@v4
        with:
          registry-url: https://registry.npmjs.org/
          node-version: lts/*

      - run: npx changelogithub # or changelogithub@0.12 if ensure the stable result
        env:
          GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
```

It will be trigged whenever you push a tag to GitHub that starts with `v`.

## Configuration

You can put a configuration file in the project root, named as `changelogithub.config.{json,ts,js,mjs,cjs}`, `.changelogithubrc` or use the `changelogithub` field in `package.json`.

## Preview Locally

```bash
npx changelogithub --dry
```

## Why?

I used to use [`conventional-github-releaser`](https://github.com/conventional-changelog/releaser-tools/tree/master/packages/conventional-github-releaser) for almost all my projects. Until I found that it [does NOT support using exclamation marks for breaking changes](https://github.com/conventional-changelog/conventional-changelog/issues/648) - hiding those important breaking changes in the changelog without the awareness from maintainers.

## License

[MIT](./LICENSE) License © 2022 [Anthony Fu](https://github.com/antfu)
npm package: @stephenhebert/datetime-iso8601
Description: A small library to simplify parsing and timezone conversion of computer date formats
Latest version: 1.0.0

# datetime-iso8601

A lightweight TypeScript library for parsing, manipulating, and formatting ISO8601 date-time strings with time zone support.

## Features

- Parse ISO8601 date-time strings
- Manipulate date and time components
- Convert between time zones (IANA and UTC offset)
- Format date-time as ISO8601 strings
- Extract individual date/time components (e.g., weekday)

## Installation

```sh
npm install @stephenhebert/datetime-iso8601
```

## Usage

```typescript
import { DateTimeIso8601 } from '@stephenhebert/datetime-iso8601'

const dt = new DateTimeIso8601('2024-06-01T12:34:56+00:00')

// Get all components
console.log(dt.get())

// Get a specific component
console.log(dt.get('year')) // 2024

// Convert to a different time zone
dt.tz('-05:00')
console.log(dt.toString()) // e.g. "2024-06-01T07:34:56-05:00"

// Update components
dt.update({ hour: 15, minute: 0 })
console.log(dt.toString()) // "2024-06-01T15:00:56-05:00"
```

## API

### `class DateTimeIso8601`

#### `constructor(isoString: string)`

Creates a new instance from an ISO8601 string.

#### `get(key?: string)`

Returns all parsed components or a specific component.

- `year`, `month`, `day`, `hour`, `minute`, `second`, `tzOffsetHour`, `tzOffsetMinute`, `date`, `time`, `tzOffset`, `weekday`, `weekdayIndex`

#### `tz(tzOffset: string): this`

Converts the date-time to the specified time zone offset (e.g., `'+00:00'`, `'-05:00'`).

#### `update(newComponents: Partial<DateTimeComponents>, relative = false): this`

Updates date-time components. If `relative` is `true`, adds values to current components.

#### `toString(): string`

Returns the ISO8601 string representation.

## License

MIT
npm package: @stephenhebert/vue-use-modal
Description: Modal pattern for Vue 3
Author: Stephen Hebert
Latest version: 1.0.3

# vue-use-modal

## Installation

```
> pnpm add @stephenhebert/vue-use-modal
```

## Usage

### App.vue
```
<script setup>
import { ModalContainer } from '@stephenhebert/vue-use-modal'
...
</script>

<template>
  ...
  <ModalContainer />
</template>
```

### Component.vue
```
<script setup>
import { show } from '@stephenhebert/vue-use-modal'

import ModalComponent from '...'

function showMyModal() {
  show(ModalComponent, { prop1, prop2, ...})
}
</script>
```

See [example](example)