open-index/open-npm huggingface dataset:
npm package: @natlibfi/eslint-config-melinda-backend
Description: ESLint config for Melinda's backend applications
Author: The National Library of Finland
Latest version: 3.0.6

# ESLint config for Melinda's backend applications

ESLint config for Melinda's backend applications

Note: Updating [eslint-plugin-functional](https://www.npmjs.com/package/eslint-plugin-functional) to version 6.0.0 breaks eslint-config-melinda-backend (situation 21.9.2023).

## License and copyright

Copyright (c) 2020-2024 **University Of Helsinki (The National Library Of Finland)**

This project's source code is licensed under the terms of **MIT** or any later version.
npm package: @natlibfi/eslint-config-melinda-frontend
Description: ESLint config for Melinda's frontend applications
Author: The National Library of Finland
Latest version: 2.0.2

# ESLint config for Melinda's frontend applications

ESLint config for Melinda's frontend applications

## License and copyright

Copyright (c) 2022, 2024 **University Of Helsinki (The National Library Of Finland)**

This project's source code is licensed under the terms of **MIT** or any later version.
npm package: @natlibfi/express-validate-content-type
Description: Express.js middleware for validating content type 
Author: The National Library of Finland
Latest version: 3.0.2

# Express.js middleware for validating content type  [![NPM Version](https://img.shields.io/npm/v/@natlibfi/express-validate-content-type.svg)](https://npmjs.org/package/@natlibfi/express-validate-content-type) [![Build Status](https://travis-ci.org/NatLibFi/express-validate-content-type-js.svg)](https://travis-ci.org/NatLibFi/express-validate-content-type-js)

Express.js middleware for validating content type. Very simple but often sorely needed. Sends response with status code 415 (`Unsupported Media Type`) if content type doesn't match. Use Express's `req.is` behind the scenes.

# Usage
## ES modules
```js
import validateContentType from '@natlibfi/express-validate-content-type';
app.post('/', validateContentType({type: 'application/json'}), (req, res) => {...});
```
## Node.js require
```js
const {default: validateContentType} = require('@natlibfi/express-validate-content-type');
app.post('/', validateContentType({type: 'application/json'}), (req, res) => {...});
```

## License and copyright

Copyright (c) 2019, 2024-2026 **University Of Helsinki (The National Library Of Finland)**

This project's source code is licensed under the terms of **MIT license**
npm package: @natlibfi/fixugen
Description: Generate Node.js unit tests from fixtures and callbacks
Author: The National Library of Finland
Latest version: 3.0.1

# Generate Node.js unit tests from fixtures and callbacks
[![NPM Version](https://img.shields.io/npm/v/@natlibfi/fixugen.svg)](https://npmjs.org/package/@natlibfi/fixugen) [![Node Version](https://img.shields.io/node/v/@natlibfi/fixugen.svg)]()

[Mocha](https://mochajs.org/) is used a unit testing framework. Invoke fixugen in a .spec file with Mocha environment injected as usual.

Provides test callbacks with [Fixura's](https://www.npmjs.com/package/@natlibfi/fixura) functions to fetch test fixtures.

## Usage
The test fixture directory is parsed as follows: Each subdirectory becomes a unit test group (Mocha's `describe`) and inner subdirectories each represent individual tests (Mocha's `it`).

```js
import generateTests from '@natlibfi/fixugen';

generateTests({
  path: [__dirname, '..', 'test-fixtures'],
  callback: ({getFixture}) => {
    const expectedValue = getFixture('value.txt');
    const value = generateSomething();
    expect(value).to.equal(expectedValue);
  }
});
```

### Options
- **callback**: A callback function passed to Mocha's `it`. Receives Fixura's function as arguments.
  - **dirName**: callback gets dirName variable that is one folder up
- **path**: An array of path components which make up a path to the test fixtures directory
- **recurse**: Whether to recurse into the subdirectories of **path**. If `false` the last directory of the path is used as the name of the Mocha's describe-call and it's direct subdirectories are used as unit test directories. Defaults to **true**
- **fixura**: Options that are passed to Fixura.
- **useMetadataFile**: If set to true, reads and parses a file named `metadata.json` in each unit test directory. The content must be a JSON object and it's properties as passed to the unit test callback function.
  - If a property `description` is present, it is used as the test's description (Defaults to *false* and folder name is used).
  - If a property `skip` is present, it decides if test is skipped (Defaults to *false*).
  - If a property `only` is present, it decides if this/these tests are only run (Defaults to *false*).
- **hooks**: An object which maps the following properties to Mocha's corresponding callbacks: **after**, **before**, **afterEach**, **beforeEach**

### Example metadata.json
```json
{
  "description": "Example description of test",
  "skip": false,
  "only": false
}
```

## License and copyright

Copyright (c) 2020, 2023-2026 **University Of Helsinki (The National Library Of Finland)**

This project's source code is licensed under the terms of **MIT** or any later version.
npm package: @natlibfi/fixugen-http-client
Description: Generate unit tests for HTTP clients with fixugen
Author: The National Library of Finland
Latest version: 4.0.3

# Generate unit tests for HTTP clients with fixugen

Generate unit tests with fixugen and mocks HTTP responses [nock](https://www.npmjs.com/package/nock). Useful for modules that export a Javascript interface for i.e. REST APIs.

Uses [fixugen's](https://www.npmjs.com/package/@natlibfi/fixugen) **useMetadataFile** so your fixture directories must contain **metadata.json** file.

# Usage
```js
import 'fetch' from 'node-fetch';
import {expect} from 'chai';
import generateTests from '@natlibfi/fixugen-http-client';

generateTests({
  callback,
  path: [__dirname, '..', 'test-fixtures']
});

function callback({getFixture}) {
  // The base URL is always http://foo.bar
  const response = await fetch('http://foo.bar');
  expect(response.status).to.equal(200);
}
```
# Configuration
The following optional properties are supported in the factory function:
- **mocha**: Mocha options
- **fixura:** Fixura options
- **recurse**: Fixugen's *recurse* option. Defaults to **true**

## metadata.json
An array property **requests** must be present in **metadata.json** file. It supports the following properties:
- **status**: HTTP status code (Number). **Mandatory**.
- **method**: HTTP method in lowercase. **Mandatory**.
- **url**: URL of the request. This is only the location and parameters part of the actual URL. The base URL is always `http://foo.bar`. Must start with `/`. **Mandatory**.
- **query**: An object representing requests query parameters (Note: these can also be given as string as part of **url**)
- **requestHeaders**: An object representing requests headers.
- **responseHeaders**: An object representing response headers.

This configuration is also passed to the callback as the property **requests**.

## Request and response payloads
The fixture directory for each unit test can have request- and response payload fixtures which must match the following filename pattern:
`/^request[0-9]+`
`/^response[0-9]+`

Where `[0-9]+` denotes the order in which requests and responses are mocked (at least for single digits). Note that if unit test has several requests, request and response payload fixtures are matched to these in order, regardless of the digit used in file name. (Ie if we have three requests and request1.txt and response3.txt fixtures, both request1.txt and response3.txt get mapped to first request and rest of the request do not have request or response payload fixtures available.)

## License and copyright

Copyright (c) 2020-2026 **University Of Helsinki (The National Library Of Finland)**

This project's source code is licensed under the terms of **MIT** or any later version.
npm package: @natlibfi/fixugen-http-server
Description: Generate unit tests for HTTP servers with fixugen
Author: The National Library of Finland
Latest version: 2.0.3

# Generate unit tests for HTTP servers with fixugen
[![NPM Version](https://img.shields.io/npm/v/@natlibfi/fixugen-http-server.svg)](https://npmjs.org/package/@natlibfi/fixugen-http-server) [![Node Version](https://img.shields.io/node/v/@natlibfi/fixugen-http-server.svg)]()


Generates unit tests with fixugen. Starts a HTTP server which is tested with generic HTTP request and response expectations.

Uses [fixugen's](https://www.npmjs.com/package/@natlibfi/fixugen) **useMetadataFile** so your fixture directories must contain **metadata.json** file.

# Usage
```js
import generateTests from '@natlibfi/fixugen-http-server';
import startApp from './app.js';

generateTests({
  callback: () => startApp(),
  path: [import.meta.dirname, '..', '..', 'test-fixtures', 'app']
});

```
# Configuration
An array property **requests** must be present in **metadata.json** file. It supports the following properties:
- **status**: HTTP status code (Number). **Mandatory**.
- **method**: HTTP method in lowercase. **Mandatory**.
- **path**: URL path. Defaults to `/`
- **requestHeaders**: An object representing requests headers.
- **responseHeaders**: An object representing response headers.

This configuration is also passed to the callback as the property **requests**.

# Request and response payloads
The fixture directory for each unit test can have request- and response payload fixtures which must match the following filename pattern:
`/^request[0-9]+`
`/^response[0-9]+`

# Formatting the response
Pass a callback to the exported function to format response headers and payload:
```js
generateTests({
  formatResponse,
  callback: () => startApp(),
  path: [__dirname, '..', '..', 'test-fixtures', 'app']
});

// Note: version > 2 requires response as input for formatResponse instead of headers and payload
function formatResponse(response) {
  const payload = await response.text(); // or which ever method is used for reading payload
  const newHeaders = doSomethingWithHeaders();
  return { payload, headers: newHeaders };
}
```


Where `[0-9]+` denotes the index number of the fixture (Requests and responses are mocked in that order).

## License and copyright

Copyright (c) 2020, 2022-2025 **University Of Helsinki (The National Library Of Finland)**

This project's source code is licensed under the terms of **MIT** or any later version.
npm package: @natlibfi/issn-verify
Description: Verify ISSN (International Standard Serial Number)
Latest version: 2.0.2

# issn-verify [![NPM Version](https://img.shields.io/npm/v/@natlibfi/issn-verify.svg)](https://npmjs.org/package/@natlibfi/issn-verify)

**This software is fork of https://github.com/malantonio/issn-verify with updated dependencies**

checks if an issn number is valid with regex and by confirming the check digit. regex and algorithm via [http://en.wikipedia.org/wiki/International\_Standard\_Serial\_Number](http://en.wikipedia.org/wiki/International_Standard_Serial_Number)

## usage

### via node/io.js

```javascript
var issn = require('issn-verify');
var test = "0000-000X";

if ( issn(test) ) {
    // do something with a valid issn
} else {
    // do something with an invalid issn
}
```

### in html
```html
<script src="/path/to/issnVerify.js"></script>
<script>
    var input = document.getElementById('issn')
      , issn = null
      ;

    input.addEventListener('blur', function(e) {
        issn = e.target.value;
        if ( issn && !issnVerify(issn) ) {
            // do something
        }
    });
</script>
```

## License and copyright
**This software is fork of https://github.com/malantonio/issn-verify with updated dependencies**

Copyright (c) 2018, 2023-2026 **University Of Helsinki (The National Library Of Finland)**

This project's source code is licensed under the terms of **MIT License** or any later version.