open-index/open-npm huggingface dataset:
npm package: @netly/eslint-config-base
Description: Custom eslint rule for js and ts file
Author: Dmytro Mysak
Latest version: 1.3.3

# `@netly/eslint-config-base`

> My personal [eslint](https://eslint.org/) config for js and ts at the same time.
> 
What's included:
- typescript-eslint
- @stylistic
- @eslint/js

## Usage

**Install**:

```bash
$ yarn add --dev @netly/eslint-config-base
$ npm i -D @netly/eslint-config-base
```

In `eslint.config.js` file:

```js
import netlyConfig from '@netly/eslint-config-base';

export default [
  ...netlyConfig,
];
```
npm package: @netly/jest-sorted-by
Description: Sort array validation for jest
Author: Dmytro Mysak
Latest version: 1.0.6

# Jest Sorted

Inspired by jest-sorted. This packages extends jest.expect with 1 custom matcher, `toBeSortedBy`

Examples

```js
expect([{ id: 1 }, { id: 2 }, { id: 3 }]).toBeSortedBy({ key: 'id' });
expect([{ count: '10' }, { count: '5' }]).toBeSortedBy({
  key: 'count',
  descending: true,
  coerce: true,
});
```

## Installation

With npm:

```sh
npm install -D @netly/jest-sorted-by  
```

With yarn:

```sh
yarn add -D @netly/jest-sorted-by  
```

## Setup

### Jest >v24

Add `@netly/jest-sorted-by` to your Jest `setupFilesAfterEnv` configuration. [See for help](https://jestjs.io/docs/en/configuration.html#setupfilesafterenv-array)

For example, add the following to your `package.json` at the root level. See [configuring jest](https://jestjs.io/docs/en/configuration) for more info.

```json
"jest": {
  "setupFilesAfterEnv": ["@netly/jest-sorted-by"]
}
```


If you are already using another test framework, like [jest-chain](https://github.com/mattphillips/jest-chain), then you should create a test setup file and `require` each of the frameworks you are using.

For example:

```js
// ./testSetup.js
require('@netly/jest-sorted-by');
require('jest-chain');
require('any other test framework libraries you are using');
```

Then in your Jest config:

```json
"jest": {
  "setupTestFrameworkScriptFile": "./testSetup.js"
}
```


## Usage

#### options

The following options can be passed as an object to alter the assertions behavior

- **descending** : boolean - Asserts the array is sorted in descending order. (Defaults to false)

```js
expect([3, 2, 1]).toBeSortedBy({ descending: true });
```

- **key** : string - Will use the value from the passed key in an array of objects.

```js
expect([{ id: 1 }, { id: 2 }, { id: 3 }]).toBeSortedBy({ key: 'id' });
```

- **strict** : boolean - Fails the assertion if a passed key option does not exist in the object. (Defaults to false) Note: will use undefined for all missing keys and equal values are considered sorted.

```js
expect([{ id: 1 }, { id: 2 }, { id: 3 }]).toBeSortedBy({
  key: 'nothing',
  strict: false,
});
```

- **comparator** : function - A custom function to use for comparison. (Default comparison is a simple greater / less than). In some cases you may want to check values are sorted by a different condition. The function will take 2 elements from the array (a,b) and should return:

  - A negative number if a comes first.
  - A positive number if b comes first.
  - 0 if the values are sorted equally.

See the compareFunction of [Array.prototype.sort](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/sort) for more info.

```js
const doubleDigitsFirst = (a, b) => {
  if (a >= 10 && b < 10) {
    return -1;
  }
  if (b >= 10 && a < 10) {
    return 1;
  }
  return 0;
};

expect([10, 20, 1, 2]).toBeSortedBy({
  compare: doubleDigitsFirst,
});
```
npm package: @netly/node-fetch
Description: Custom node fetch with retry and timeout
Author: Dmytro Mysak
Latest version: 1.1.1

# node-fetch with native fetch + retry + timeout

Inspired by node-fetch-retry-timeout.

Tiny replacement for native **fetch** with additional benefits.

## Installation

`npm i @netly/node-fetch`

## Parameters

Same as in native fetch, but with small extension. Everything is **optional**.

| parameter                                     | type   | description                                | default                                                |
| --------------------------------------------- | ------ | ------------------------------------------ | ------------------------------------------------------ |
| [`retry`](#retry)                             | number | number of times to retry the request       | 3                                                      |
| [`timeout`](#timeout)                         | number | number of ms to wait before request cancel | 20_000                                                 |
| [`retryStrategy`](#retryStrategy)             | Function | exponential backoff strategy               | (times) => Math.min((2 \*\* times - 1) \* 1000, 20000) |
| [`retryOnHttpResponse`](#retryOnHttpResponse) | Function | can retry based on http response statuses  | (response) => response.status >= 500;                  |

### retry

```ts
retry?: number
```

### timeout

```ts
timeout?: number
```

### retryStrategy

Calculates how long to wait before next retry. `times` - the number of retry.
To disable retry strategy: `() => 0`

```ts
retryStrategy: (times: number): number => Math.min((2 ** times - 1) * 1000, 20000);
```

### retryOnHttpResponse

Check if response is desired. If no - throw error and send request one more time.

```ts
retryOnHttpResponse: (response: globalThis.Response) => response.status >= 500;
```

## Example

### For `cjs`

```js
const { default: fetch } = require('@netly/node-fetch');
// or 
const { fetch } = require('@netly/node-fetch');

const response = await fetch('https://www.google.com');
```

### For `esm`

```js
import { fetch } from '@netly/node-fetch';
// or
import fetch from '@netly/node-fetch';

const response = await fetch('https://www.google.com');
```
### For `ts`

```ts
import { fetch } from '@netly/node-fetch';
// or 
import fetch from '@netly/node-fetch';

const response = await fetch('https://www.google.com');
```
npm package: @netly/npm-audit-markdown
Description: Generate a markdown report for NPM Audit
Author: Dmytro Mysak
Latest version: 1.2.0

# @netly/npm-audit-markdown

A simple tool to create an NPM audit report in markdown language. Especially useful to post reports to communicators supporting markdown. Just make more suitable for CI

## Getting Started

```bash script
npm install -g @netly/npm-audit-markdown
```

## Usage

To generate a report, run the following:

```bash script
npm audit --json | @netly/npm-audit-markdown
```

By default the report will be saved to npm-audit.md

If you want to specify the output file, add the --output option:

```bash script
npm audit --json | @netly/npm-audit-markdown --output report.md
```

## CI

```bash script
npm audit --json | npx @netly/npm-audit-markdown --output report.md
```

## Acknowledgements

Forked from https://gitlab.com/engrave/npm-audit-markdown

## Licence
MIT
npm package: @netly/prettier-config
Description: Prettier config with prettier as peerDependencies
Author: Dmytro Mysak
Latest version: 1.3.0

# `@netly/prettier-config`

> My personal [Prettier](https://prettier.io) config.

## Usage

**Install**:

```bash
$ yarn add --dev @netly/prettier-config
$ npm i -D @netly/prettier-config
```

**Edit `package.json`**:

```jsonc
{
  // ...
  "prettier": "@netly/prettier-config"
}
```