open-index/open-npm huggingface dataset:
npm package: @johnfoderaro/apaw
Description: Amazon Product Advertising API 5.x Wrapper
Author: John Foderaro
Latest version: 1.0.1

# Apaw

## Amazon Product Advertising API 5.x Wrapper

**Apaw** is a dependency-free Node.js wrapper around version 5.x of the Amazon Product Advertising API (PAAPI). This module handles making the AWS Signature Version 4 signed HTTP requests for the PAAPI service. For more detailed information on the Amazon Product Advertising API and how to use it, [please read Amazon's documentation](https://webservices.amazon.com/paapi5/documentation/).

## Installation
- `npm i @johnfoderaro/apaw`

## Example
```javascript
const Apaw = require('@johnfoderaro/apaw');

const apaw = Apaw({
  host: 'webservices.amazon.com',
  region: 'us-east-1',
  key: 'AKIDEXAMPLE',
  secret: 'wJalrXUtnFEMI/K7MDENG+bPxRfiCYEXAMPLEKEY',
});

(async () => {
  try {
    const results = await apaw.request('SearchItems', {
      Keywords: 'Harry',
      Marketplace: 'www.amazon.com',
      PartnerTag: 'xyz-20',
      PartnerType: 'Associates',
      Resources: [
        'Images.Primary.Small',
        'ItemInfo.Title',
        'Offers.Listings.Price',
      ],
      SearchIndex: 'All',
    });
    console.log(results);
  } catch (e) {
    console.error(e);
  }
})();
```

## Usage
### Apaw(parameters).request(operation, payload)
The `Apaw` factory function returns an object with the method `request`. Below is a summary of the required arguments for both functions:

- `parameters` is an object that must include the following:

```javascript
{
  host: String,
  region: String,
  key: String,
  secret: String,
}
```

For information on `host` and `region`, please consult the [PAAPI "Host and Region" documentation](https://webservices.amazon.com/paapi5/documentation/common-request-parameters.html#host-and-region).

`key` represents "Access Key" and `secret` represents "Secret Key" PAAPI credentials. For information on these credentials, please consult the [PAAPI](https://webservices.amazon.com/paapi5/documentation/register-for-pa-api.html).

- `operation` is a case sensitive string that must be a valid operation as outlined by the PAAPI documentation.

```javascript
'SearchItems'
```

- `payload` is an object that must contain valid request key/values as outlined by the PAAPI documentation.

```javascript
{
  Keywords: 'Harry',
  Marketplace: 'www.amazon.com',
  PartnerTag: 'xyz-20',
  PartnerType: 'Associates',
  Resources: [
    'Images.Primary.Small',
    'ItemInfo.Title',
    'Offers.Listings.Price',
  ],
  SearchIndex: 'All',
}
```

For information on `operation` and how to properly create and format the `payload` object, please consult [PAAPI "Operations" documentation](https://webservices.amazon.com/paapi5/documentation/operations.html).

The `request` method Rejects errors emitted by the Node `https` module or Resolves an object with the following shape:

```javascript
{
  data: String,
  headers: Object,
  status: Number,
}
```

- `data` is the stringified HTTP response body
- `headers` is an object containing the response headers
- `status` is a number representing the HTTP response status code 

## License
MIT
npm package: @johngw/filter-map
Description: Filters and maps an array in 1 loop
Latest version: 1.0.1

# @johngw/filter-map

> Filters and maps an array in 1 loop

```typescript
filterMap(
  [1, 2, 3, 4, 5, 6, 7, 8, 9],
  (x) => x > 5,
  (x) => `${x} bottles`
)
/*
  [
    '6 bottles',
    '7 bottles',
    '8 bottles',
    '9 bottles',
  ]
*/
```
npm package: @johngw/filter-reduce
Description: Filters and reduces an array in 1 loop
Latest version: 1.0.0

# @johngw/filter-reduce

> Filters and reduces an array in 1 loop

```typescript
filterReduce(
  [1, 2, 3, 4, 5, 6, 7, 8, 9],
  0,
  (_, x) => x < 5,
  (sum, x) => sum + x
)
// 10
```
npm package: @johngw/google-ad-manager-api
Description: Compose and react upon redux actions
Author: John Wright
Latest version: 7.0.0
Deprecated: This project has transferred ownership. Please install @dmgt/google-ad-manager-api instead.

# @johngw/google-ad-manager-api

A fully typed library to access Google's Ad Manager.

## Installation

```
npm install google-auth-library @johngw/google-ad-manager-api
```

## Usage

### Simple queries

```typescript
import {
  GoogleAdManager,
  In,
  Not,
  Like,
  query,
} from '@johngw/google-ad-manager-api'
import { JWT } from 'google-auth-lbrary'

const jwt = new JWT({
  key: 'MY_JWT_KEY',
  email: 'MY_JWT_EMAIL',
  scopes: ['https://www.googleapis.com/auth/dfp'],
})

const api = new GoogleAdManager({
  applicationName: 'MY_APPLICATION_NAME',
  networkCode: 123456789,
  authorize: () => jwt.authorize(),
})

const client = await api.createLineItemServiceClient()

const [response] = await query(client, 'getLineItemsByStatementAsync', {
  limit: 10,
  where: {
    orderId: In(1, 2, 3),
    id: Not(11222),
    name: Like('foo %'),
    orderName: 'Foo',
  },
})

expect(response.rval?.results).toHaveLength(10)
```

The following will produce the same result albeit more verbose:

```typescript
import {
  LineItemService,
  In,
  Not,
  Like,
  pql,
} from '@johngw/google-ad-manager-api'

const [response] = await client.getLineItemsByStatementAsync({
  filterStatement: {
    query: pql<LineItemService.LineItems>({
      limit: 10,
      where: {
        orderId: In(1, 2, 3),
        id: Not(11222),
        name: Like('foo %'),
        orderName: 'Foo',
      },
    }),
  },
})
```

You can also type the `pql` function with JSDocs:

```javascript
/**
 * @typedef {import('@johngw/google-ad-manager-api').PQL<
 *   import('@johngw/google-ad-manager-api').LineItemService.LineItems
 * >} LineItemsPQL
 */

const [response] = await client.getLineItemsByStatementAsync({
  filterStatement: {
    query: /** @type {LineItemsPQL} */ (pql)({
      limit: 10,
      where: {
        orderId: In(1, 2, 3),
        id: Not(11222),
        name: Like('foo %'),
        orderName: 'Foo',
      },
    }),
  },
})
```

### Paginated queries

When quering large amounts of data, you'd generally want to use GAM's pagination feature. Use the `iterate` function to help iterate through all individual items in paginated queries.

```typescript
import { GoogleAdManager, iterate, query } from '@johngw/google-ad-manager-api'
import { JWT } from 'google-auth-lbrary'

const jwt = new JWT({
  key: 'MY_JWT_KEY',
  email: 'MY_JWT_EMAIL',
  scopes: ['https://www.googleapis.com/auth/dfp'],
})

const api = new GoogleAdManager({
  applicationName: 'MY_APPLICATION_NAME',
  networkCode: 123456789,
  authorize: () => jwt.authorize(),
})

const client = await api.createLineItemServiceClient()

for await (const result of iterate({
  executeQuery: (limit, offset) =>
    query(client, 'getLineItemsByStatementAsync', {
      limit,
      offset,
    }),
})) {
  console.info(result)
}
```
npm package: @johngw/outerface
Description: Typescript static interface
Author: John Wright
Latest version: 2.0.2

# @johngw/outerface

Create static interfaces for your Typescript classes.

## Installation

```
npm install @johngw/outerface
```

## Use

Use the `@outerface` class decorator, with an `Outerface` extended interface to declare your static properties and methods.

```typescript
interface ComparableStatic<T> extends Outerface<T> {
  compare(a: T, b: T): number
}

@outerface<ComparableStatic<TableCell>>()
class TableCell {
  readonly value: number

  constructor(value: number) {
    this.value = value
  }

  // This static method is required and the program will not compile
  // without it.
  static compare(a: TableCell, b: TableCell): number {
    return a.value - b.value
  }
}
```

The `Outerface` interface requires a type parameter that is the instance type of the class.
npm package: @johngw/react-component-mock
Description: A simple way to mock react components when testing.
Author: John Wright
Latest version: 2.1.2

# react-component-mock

A simple way to mock react components when testing.

The module creates a new component which will render a string representation of the component and it's props

## Install

```
npm i -D @johngw/react-component-mock
```

When working on the source code:

```
npm i
npx husky install
```

## Usage (Jest)

```typescript
// App.tsx

import React from 'react'
import Hello from './Hello'

export default function App() {
  return <Hello name="World" />
}
```

```typescript
// __mocks__/Hello.tsx

import reactComponentMock from '@johngw/react-component-mock'

export default reactComponentMock('Hello')
```

```typescript
// __tests__/App.test.tsx

import React from 'react'
import { render } from '@testing-library/react'
import App from '../App'

jest.mock('../Hello')

test('App', () => {
  const { container } = render(<App />)
  expect(container).toMatchInlineSnapshot(`
    {Hello name=\`World\`}
  `)
})
```
npm package: @johnhom/el-load-select
Description: el-load-select 基于element-ui 二次封装的select组件
Author: johnhom
Latest version: 1.0.0

# `@johnhom/el-load-select`

> TODO: description

## Usage

```
const elLoadSelect = require('@johnhom/el-load-select');

// TODO: DEMONSTRATE API
```
npm package: @johnhooks/dollar
Description: ## Purpose I created this module to write my own payroll system. Dollar values are stored as integers ($VALUE * 100). Factions of a cent below .005 are rounded down, otherwise rounded up.
Author: John Hooks
Latest version: 0.1.2

# Johns TypeScript Dollar Implementation

## Purpose
I created this module to write my own payroll system. Dollar values
are stored as integers ($VALUE * 100). Factions of a cent below .005
are rounded down, otherwise rounded up.
npm package: @johnie/saywhat
Description: A simple, optimized JS library &amp; node.js module for matching short, human-quality input to a list of possibilities.
Author: Johnie Hjelm
Latest version: 1.0.0

# saywhat [![Build Status](https://travis-ci.org/johnie/saywhat.svg?branch=master)](https://travis-ci.org/johnie/saywhat)

> Module for matching short, human-quality input to a list of possibilities.

## Install

```
$ npm install saywhat
```

## Usage

```js
const sayWhat = require('saywhat');

sayWhat('unicrns', ['unicorns', 'rainbows']);
//=> 'unicorns'
```


## API

### sayWhat(input, list, [options])

#### input

Type: `string`

The string input to match.

#### list

Type: `array`

An array of strings or objects to match against.

#### options

Type: `Object`

Options are set on the sayWhat function object. You may change them at any time.

### Options

#### threshold

By default, the method will only return strings whose edit distance is less than 40% (0.4x) of their length.
For example, if a ten-letter string is five edits away from its nearest match, the method will return null.

You can control this by setting the "threshold" value on the sayWhat options. For example, to set the
edit distance threshold to 50% of the input string's length:

```js
sayWhat('unicrns', ['unicorns', 'rainbows'], {threshold: 0.5});
```

To return the nearest match no matter the threshold, set this value to null.

#### thresholdAbsolute

This option behaves the same as threshold, but instead takes an integer number of edit steps. For example,
if thresholdAbsolute is set to 20 (the default), then the method will only return strings whose edit distance
is less than 20. Both options apply.

#### caseSensitive

By default, the method will perform case-insensitive comparisons. If you wish to force case sensitivity, set
the "caseSensitive" value to true:

```js
sayWhat('unicrns', ['unicorns', 'rainbows'], {caseSensitive: true});
```

#### nullResultValue

By default, the method will return null if there is no sufficiently close match. You can change this value here.

#### returnWinningObject

By default, the method will return the winning string value (if any). If your list contains objects rather
than strings, you may set returnWinningObject to true.

```js
sayWhat('unicrns', ['unicorns', 'rainbows'], {returnWinningObject: true});
```

This option has no effect on lists of strings.

#### returnFirstMatch
  
By default, the method will search all values and return the closest match. If you're simply looking for a "good-
enough" match, you can set your thresholds appropriately and set returnFirstMatch to true to substantially speed
things up.

## License

MIT © [Johnie Hjelm](https://jh.je)
npm package: @johniexu/utils
Description: some kinds of utils in JavaScript
Author: JohnieXu
Latest version: 0.0.9

## directory
```bash
├─ .babelrc
├─ .eslintrc
├─ package-lock.json
├─ package.json
├─ bin
│    └─ hello.js       // 对应package.json中bin的路径, 即npx运行的bin脚本
├─ dist
│    └─ utils.js       // babel编译后的文件
├─ src
│    └─ utils.js       // 源文件
├─ test          
│    ├─ index.html
│    └─ utils.test.js  // 测试文件
├─ yarn-error.log
└─ yarn.lock
```

## install

```bash
npm i -g @johniexu/utils // 全局安装
xutils-hello // Hello, I am JohnieXu!🎉
```

## npx

```bash
npx @johniexu/utils // Hello, I am JohnieXu!🎉
```
npm package: @johnkelly-t/dropdown-menu
Description: A simple, dependency-free dropdown menu using vanilla JS and CSS. Easily customizable and ready to plug into any web project.
Author: John Kelly Temeña
Latest version: 1.0.1

# @johnkelly-t/dropdown-menu
A lightweight, customizable dropdown component built with plain HTML, CSS, and JavaScript. This package provides the essential behavior and basic styling, allowing you to easily extend and personalize the design with your own CSS.

## 📦 Installation
To install via npm:
```bash
npm install @johnkelly-t/dropdown-menu
```

## 🛠️ Usage
To use dropdown-menu, recreate the required HTML structure and apply the provided class names to ensure proper functionality. While you can replace the default div elements with other HTML elements, keep in mind that doing so may affect the styling, depending on the element you choose.

**Basic HTML Structure**

```html
<div class="dropdown-trigger" id="hover">
  Dropdown
  <div class="dropdown-menu">
    <button class="dropdown-item">Item 1</button>
    <div class="dropdown-item">Item 2</div>
    <div class="dropdown-item">Item 3</div>
  </div>
</div>
```

**Javascript**
Import the setupDropdown function to initialize the dropdown in your project:
```javascript
import { setupDropdown } from "@johnkelly-t/dropdown-menu"
```

Pass the dropdown element and the trigger type ("hover" or "click") as arguments to activate the dropdown. Use "hover" for hover-triggered dropdowns, or "click" for click-triggered dropdowns.
```javascript
let dropdownElement = document.querySelector(".dropdown");
    
setupDropdown(dropdownElement, "hover");
```

## 🎨 Customizations

### Dropdown Menu alignment
By default, the dropdown menu aligns to the left side of the trigger when the content exceeds the dropdown-trigger width. To change this behavior, you can pass a third argument to setupDropdown() with either "right" or "center" to adjust the alignment.

*example*

![Screenshot_23](https://github.com/user-attachments/assets/eaf801a0-8834-4710-a2ec-8ad2defa2bbc)

```javascript
setupDropdown(dropdownElement, "hover", "center")
```

*Result:*
The dropdown menu will now be centered relative to the dropdown trigger.
![Screenshot_20](https://github.com/user-attachments/assets/fbff620e-af2b-4b37-90ee-4a0888ec5ea8)


### Styling
You can easily customize the appearance by overriding the default CSS classes:

- `.dropdown-trigger`
- `.dropdown-menu`
- `.dropdown-item`
- `.dropdown-item:hover`

**Example**
```css
.dropdown-trigger {
    color: rgb(8, 89, 143);
}

.dropdown-menu {
    border: 1px solid #5f5f5;
    padding: 2px;
}

.dropdown-item {
    border-radius: 3px;
    color: #555;
}

.dropdown-item:hover {
    background: #acd4e8;
}
```

![image](https://github.com/user-attachments/assets/ec3337f1-5785-49c8-9fc9-d2eabfa989d2)