open-index/open-npm huggingface dataset:
npm package: @meltwater/coerce
Description: A simple javascript package for type checking an object
Author: Team Legion
Latest version: 0.4.1

# @meltwater/coerce

[![Build Status](https://cloud.drone.io/api/badges/meltwater/coerce/status.svg)](https://cloud.drone.io/meltwater/coerce)
A simple javascript package for type checking an object

# Install

```bash
npm i --save @meltwater/coerce
```

# Usage

```javascript
class ValidatedObject {
    constructor({ value }) {
        if(typeof value !== string) {
            throw new TypeError(`options.value must be a string. Provided value: ${value}`);
        }

        this.value = value;
        Object.freeze(this);
    }
}

const badValue = { value: 1234 };
coerce(badValue, ValidatedObject, 'Booooooom!');
// This will throw a TypeError with the message 'Booooooom!'

const goodValue = { value: 'so good' };
const typedValue = coerce(goodValue, ValidatedObject, 'Booooooom');
// This will return a new object that is an instanceof ValidatedObject with typedValue.value === 'so good'
```

# API reference

<!-- Generated by documentation.js. Update this documentation by updating the source code. -->

### Table of Contents

*   [coerce](#coerce)
    *   [Parameters](#parameters)
*   [coerceArray](#coercearray)
    *   [Parameters](#parameters-1)

## coerce

If `value` is an instance of `Type`, this function returns it.
Otherwise this function attempts to construct a new instance
`Type` using `value` as a constructor parameter.

### Parameters

*   `value` **any** The value to coerce
*   `Type` **any** The type to return the object as.
*   `message` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The error message if coercion fails

<!---->

*   Throws **[TypeError](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypeError)** If the value is not coercable.

Returns **any** Instance of provided Type

## coerceArray

Apply `coerce` to an array for a single type.

### Parameters

*   `values` **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<any>** The array of values to coerce
*   `Type` **any** The type each object should be
*   `message` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** The error message if coercion fails

<!---->

*   Throws **[TypeError](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypeError)** If `values` is not an array
*   Throws **[TypeError](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/TypeError)** One of the array values is not coercable.

Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)\<any>** Array of instances of provided `Type`
npm package: @meltwater/esi-include-plugin
Description: General plugin logic for esi:include script or source injection
Author: Team Cosmos
Latest version: 1.0.4

# esi-include-plugin
[![Build Status](https://drone.meltwater.io/api/badges/meltwater/esi-include-plugin/status.svg)](https://drone.meltwater.io/meltwater/esi-include-plugin)

General plugin logic for esi:include script or source injection

## What is it? 
This generic "plugin" is to handle esi:include injection based on configuration. There are two main "modes" in which this utility will replace tags in html. 
* Production Mode: The plugin will replace the html tags with the correctly configured esi:include tag.
* Local or Dev Mode: Here lies the great strength of this plugin. When running in a local or dev mode the plugin will fetch the configured remote src and inject the contents in place of the tag, effectively emulating the esi:include logic. 

## How to use it? 
Use a script like the following example and call it as part of an npm script.
` "start": ""`

```javascript
(async function esiIncludeScript(){
  const esiIncludeModule = require('@meltwater/esi-include-plugin');

await esiIncludeModule({
  files: ['dist/index.hmtl'],
  verbose: false,
  esi: [
    {name: 'includeThing', src: 'http://myincludeurl.com/asset', noStore: true, onError: 'continue', authorization: 'ImAFakeToken', maxwait: '500'},
  ]
});
})();

```

In your html place the following comment tag where you'd like the injection to take place
```html
<!--esi-include-webpack-plugin name=includeThing-->
```

A more advanced example that can handle more fun stuff like specifying files and handling different source file urls based on a stage.
```javascript 
(async function esiIncludeScript(){
  const esiIncludeModule = require('@meltwater/esi-include-plugin');
  const argv = require('yargs').argv;

  let config = argv.stage === 'prod' ?
  {
    includeThing: 'https://mystagingurl.com/asset'
  } : {
    includeThing: 'https://myprodurl.com/asset'
  }

  if(argv.files) {
    config.files = argv.files.split(',')
  } else {
    config.files = ['./src/index.html']
  }

await esiIncludeModule({
  files: config.files,
  verbose: false,
  esi: [
    {name: 'includeThing', src: config.includeThing, noStore: true, onError: 'continue', authorization: 'ImAFakeToken', maxwait: '500'},
  ]
});
})();

```
npm package: @meludi/eslint-config-base
Description: Shareable configuration for javascript eslint
Author: Milad Al-Ani
Latest version: 0.3.0

# @meludi/eslint-config-base

[![NPM Package][eslint-config-base-npm-badge]][eslint-config-base-npm-link]
[![GitHub issues][eslint-config-base-issues-badge]][eslint-config-base-issues-link]
[![GitHub license][eslint-config-license-badge]][eslint-config-license-link]

This package provides [ESLint](https://eslint.org/) settings as an shareable javascript eslint configuration.

## Installation

Install the package with:

```sh
$ npm i -D @meludi/eslint-config-base

```

Find out and install `peerDependencies`.

```sh
$ npm info "@meludi/eslint-config-base@latest" peerDependencies
```

## Entry points

- @meludi/eslint-config-base

## Usage

If you did not already have `.eslintrc.js` configuration file in the root of your project create it.

Add the following to your `.eslintrc.js`:

```js
// .eslintrc.js
module.exports = {
  root: true,

  extends: ['@meludi/eslint-config-base'],

  // Adjust it to your project
  // https://eslint.org/docs/latest/use/configure/language-options#specifying-environments
  env: {
    browser: true,
    es6: true,
    node: true,
  },
  parserOptions: { ecmaVersion: 2020 },

  // optional
  // https://www.npmjs.com/package/eslint-import-resolver-custom-alias
  settings: {
    'import/resolver': {
      'eslint-import-resolver-custom-alias': {
        alias: {
          '@': './src',
        },
      },
    },
  },
};
```

### NPM script

Add the following script to your `package.json` for easy usage:

```json
"scripts": {
  "lint:js": "eslint './**/*.{js}'",
  "lint:js:fix": "npm run lint:js -- --fix",
}
```

### Configuration

You can overwrite, extend and unset rules in your `.eslintrc.js`

> [Configuring ESLint](https://eslint.org/docs/user-guide/configuring)

## Recommendation

Use prettier to format your files: [@meludi/eslint-config-prettier](https://www.npmjs.com/package/@meludi/eslint-config-prettier)

Add the following config files to the root of your project:

- [.eslintignore](https://eslint.org/docs/latest/use/configure/ignore)
- [.editorconfig](https://editorconfig.org/)

### VS Code

Copy [.vscode.example](https://github.com/meludi/eslint-config/tree/master/packages/eslint-config-base/.vscode.example) to the root of your project and rename it to `.vscode`.

## LICENSE

[MIT](LICENSE)

[eslint-config-license-badge]: https://img.shields.io/github/license/meludi/eslint-config
[eslint-config-license-link]: https://github.com/meludi/eslint-config/blob/main/LICENSE
[eslint-config-base-npm-badge]: https://img.shields.io/npm/v/@meludi/eslint-config-base.svg
[eslint-config-base-npm-link]: https://www.npmjs.com/package/@meludi/eslint-config-base
[eslint-config-base-issues-badge]: https://img.shields.io/github/issues/meludi/stylelint-config/package:%20eslint-config-base?label=issues
[eslint-config-base-issues-link]: https://github.com/meludi/stylelint-config/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3A+eslint-config-base%22
npm package: @meludi/eslint-config-prettier
Description: Shareable configuration for prettier eslint
Author: Milad Al-Ani
Latest version: 0.3.0

# @meludi/eslint-config-prettier

[![NPM Package][eslint-config-prettier-npm-badge]][eslint-config-prettier-npm-link]
[![GitHub issues][eslint-config-prettier-issues-badge]][eslint-config-prettier-issues-link]
[![GitHub license][eslint-config-license-badge]][eslint-config-license-link]

This package provides [Prettier](https://prettier.io) settings as an shareable configuration.

## Installation

Install the package with:

```sh
$ npm i -D @meludi/eslint-config-prettier

```

Find out and install `peerDependencies`.

```sh
$ npm info "@meludi/eslint-config-prettier@latest" peerDependencies
```

## Entry points

- @meludi/eslint-config-prettier
- @meludi/eslint-config-prettier/vue

## Usage

If you did not already have `.eslintrc.js` and `prettier.config.js` configuration files in the root of your project create them.

Add the following to your `.eslintrc.js`:

```js
// .eslintrc.js
module.exports = {
  extends: [
    // ... other configs

    // Make sure to put prettier last, so it gets the chance to override other configs.
    '@meludi/eslint-config-prettier',

    // Vue
    // '@meludi/eslint-config-prettier/vue',
  ],
};
```

Add the following to your `prettier.config.js`:

```js
// prettier.config.js
module.exports = require('@meludi/eslint-config-prettier/prettier.config');
```

### NPM script

Add the following script to your `package.json` for easy usage:

```json
"scripts": {
  "format": "prettier --write './**/*.{js,jsx,ts,tsx,vue,md,mdx,json}'"
}
```

## Recommendation

Add the following config files to the root of your project:

- [.prettierignore](https://prettier.io/docs/en/ignore.html)
- [.editorconfig](https://editorconfig.org/)

### VS Code

Copy [.vscode.example](https://github.com/meludi/eslint-config/tree/master/packages/eslint-config-prettier/.vscode.example) to the root of your project and rename it to `.vscode`.

## LICENSE

[MIT](LICENSE)

[eslint-config-license-badge]: https://img.shields.io/github/license/meludi/eslint-config
[eslint-config-license-link]: https://github.com/meludi/eslint-config/blob/main/LICENSE
[eslint-config-prettier-npm-badge]: https://img.shields.io/npm/v/@meludi/eslint-config-prettier.svg
[eslint-config-prettier-npm-link]: https://www.npmjs.com/package/@meludi/eslint-config-prettier
[eslint-config-prettier-issues-badge]: https://img.shields.io/github/issues/meludi/stylelint-config/package:%20eslint-config-prettier?label=issues
[eslint-config-prettier-issues-link]: https://github.com/meludi/stylelint-config/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3A+eslint-config-prettier%22
npm package: @meludi/eslint-config-vue
Description: Shareable configuration for vue eslint
Author: Milad Al-Ani
Latest version: 0.3.0

# @meludi/eslint-config-vue

[![NPM Package][eslint-config-vue-npm-badge]][eslint-config-vue-npm-link]
[![GitHub issues][eslint-config-vue-issues-badge]][eslint-config-vue-issues-link]
[![GitHub license][eslint-config-license-badge]][eslint-config-license-link]

This package provides [ESLint](https://eslint.org/) settings as an shareable vue eslint configuration.

## Installation

Install the package with:

```sh
$ npm i -D @meludi/eslint-config-vue

```

Find out and install `peerDependencies`.

```sh
$ npm info "@meludi/eslint-config-vue@latest" peerDependencies
```

## Entry points

- @meludi/eslint-config-vue/vue2
- @meludi/eslint-config-vue/vue3

## Usage

If you did not already have `.eslintrc.js` and configuration file in the root of your project create them.

Add the following to your `.eslintrc.js`:

```js
// .eslintrc.js
module.exports = {
  root: true,

  extends: [
    '@meludi/eslint-config-vue/vue2', // or '@meludi/eslint-config-vue/vue3'
  ],

  // Adjust it to your project
  // https://eslint.org/docs/latest/use/configure/language-options#specifying-environments
  env: {
    browser: true,
    es6: true,
    node: true,
  },

  // optional
  // https://www.npmjs.com/package/eslint-import-resolver-custom-alias
  settings: {
    'import/resolver': {
      'eslint-import-resolver-custom-alias': {
        alias: {
          '@': './src',
        },
      },
    },
  },
};
```

### NPM script

Add the following script to your `package.json` for easy usage:

```json
"scripts": {
  "lint:js": "eslint './**/*.{js,vue}'",
  "lint:js:fix": "npm run lint:js -- --fix"
}
```

### Configuration

You can overwrite, extend and unset rules in your `.eslintrc.js`

> [Configuring ESLint](https://eslint.org/docs/user-guide/configuring)

## Recommendation

Use prettier to format your files: [@meludi/eslint-config-prettier](https://www.npmjs.com/package/@meludi/eslint-config-prettier)

Add the following config files to the root of your project:

- [.eslintignore](https://eslint.org/docs/latest/use/configure/ignore)
- [.editorconfig](https://editorconfig.org/)

### VS Code

Copy [.vscode.example](https://github.com/meludi/eslint-config/tree/master/packages/eslint-config-vue/.vscode.example) to the root of your project and rename it to `.vscode`.

#### Volar configuration

[volar](https://marketplace.visualstudio.com/items?itemName=Vue.volar)

## LICENSE

[MIT](LICENSE)

[eslint-config-license-badge]: https://img.shields.io/github/license/meludi/eslint-config
[eslint-config-license-link]: https://github.com/meludi/eslint-config/blob/main/LICENSE
[eslint-config-vue-npm-badge]: https://img.shields.io/npm/v/@meludi/eslint-config-vue.svg
[eslint-config-vue-npm-link]: https://www.npmjs.com/package/@meludi/eslint-config-vue
[eslint-config-vue-issues-badge]: https://img.shields.io/github/issues/meludi/stylelint-config/package:%20eslint-config-vue?label=issues
[eslint-config-vue-issues-link]: https://github.com/meludi/stylelint-config/issues?q=is%3Aopen+is%3Aissue+label%3A%22package%3A+eslint-config-vue%22
npm package: @meludi/sprite-it
Description: Combines multiple named SVG files into one sprite.svg using <symbol>.
Author: Milad Al-Ani
Latest version: 1.0.1

# @meludi/sprite-it

[![NPM Package][npm-badge]][npm-link]
[![GitHub Workflow Status][workflow-badge]][workflow-link]
[![GitHub issues][issues-badge]][issues-link]
[![GitHub license][license-badge]][license-link]
[![Commitizen friendly][commitizen-badge]][commitizen-link]

Combines multiple named SVG files into one `sprite.svg` using `<symbol>`.

Based on [svgstore](https://github.com/svgstore/svgstore).

## Install

```sh
$ npm i -D @meludi/sprite-it
```

## Prepare

Add the following file to your project root: `.sprite-it.js`:

```js
module.exports = {
  /**
   * Default setup
   *
   */
  setup: {
    inputDir: 'example/icons', // Path to your svg icons folder
    outputDir: 'dist/public', // sprite.svg will be generated in this folder
    spriteName: 'sprite.svg', // Name of your generated sprite.svg
  },

  /**
   * Default presets
   *
   * Check out
   * {@link https://github.com/svg/svgo SVGO} and
   * {@link https://github.com/svg/svgo#default-preset SVGO default-preset}.
   */
  presets: {
    minifyStyles: true,
    removeUselessDefs: true,
    removeNonInheritableGroupAttrs: true,
    removeTitle: true,
    cleanupAttrs: true,
    removeMetadata: true,
    removeDoctype: true,
    removeXMLProcInst: true,
    collapseGroups: true,
  },
};
```

It is also recommended to add the following script to your `package.json` for easy usage:

```json
"scripts": {
  "sprite-it": "sprite-it"
}
```

## Usage

Run it

```sh
$ npm run sprite-it
```

Use it

```html
<svg role="img">
  <use xlink:href="/outputDir/sprite.svg#name-of-your-svg-icon"></use>
</svg>
```

## Example

> [Implementation code of sprite-it](https://github.com/meludi/sprite-it/tree/main/example)

### CLI

Use `--record` or `-r` to map and compare generated icons. The mapping is saved to the file `.sprite-it.manifest.json`.

Use `--manifest your-manifest-file.json` or `-m your-manifest-file.json` to override the default file name `.sprite-it.manifest.json`.

#### More options

```sh
$ npm run sprite-it -- --help
```

## LICENSE

[MIT](LICENSE)

[commitizen-badge]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg
[commitizen-link]: http://commitizen.github.io/cz-cli/
[doc-badge]: https://img.shields.io/badge/docs-readme-orange.svg?style=flat-square
[npm-badge]: https://img.shields.io/npm/v/@meludi/sprite-it.svg
[npm-link]: https://www.npmjs.com/package/@meludi/sprite-it
[issues-badge]: https://img.shields.io/github/issues/meludi/sprite-it
[issues-link]: https://github.com/meludi/stylelint-config/issues
[license-badge]: https://img.shields.io/github/license/meludi/sprite-it
[license-link]: https://github.com/meludi/sprite-it/blob/main/LICENSE
[workflow-badge]: https://img.shields.io/github/actions/workflow/status/meludi/sprite-it/ci.yml
[workflow-link]: https://github.com/meludi/sprite-it/actions/workflows/ci.yml