# userscript-meta

> Parse and stringify Userscript metadata.

Latest version **1.0.1** (published 2016-10-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install userscript-meta
pnpm add userscript-meta
yarn add userscript-meta
bun add userscript-meta
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2016-10-22 |
| First published | 2016-10-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 7 |
| Author | pd4d10 |
| Maintainers | pd4d10 |
| Keywords | userscript, metadata, parse, stringify |

## Links

- npm: https://www.npmjs.com/package/userscript-meta
- Repository: https://github.com/pd4d10/userscript-meta
- Homepage: https://github.com/pd4d10/userscript-meta#readme
- Issues: https://github.com/pd4d10/userscript-meta/issues
- npm.io page: https://npm.io/package/userscript-meta

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2016-10-22
- 1.0.0 — 2016-10-21
- 0.0.1 — 2016-10-20

## README

# userscript-meta

[![Build Status](https://travis-ci.org/pd4d10/userscript-meta.svg?branch=master)](https://travis-ci.org/pd4d10/userscript-meta)
[![codecov](https://codecov.io/gh/pd4d10/userscript-meta/branch/master/graph/badge.svg)](https://codecov.io/gh/pd4d10/userscript-meta)
[![npm](https://img.shields.io/npm/v/userscript-meta.svg)](https://www.npmjs.com/package/userscript-meta)
[![license](https://img.shields.io/npm/l/userscript-meta.svg)](https://www.npmjs.com/package/userscript-meta)

Parse and stringify Userscript metadata.

## Installation

```sh
npm install userscript-meta --save
```

## API

### parse(string)

parse userscript metadata to an object.

```js
const userscript = require('userscript-meta')

userscript.parse(`
  // ==UserScript==
  // @name Userscript name
  // @version 1.0
  // @match http://www.example.com/*
  // @match http://www.example.org/*
  // ==/UserScript==
`)
```

equals to

```js
{
  name: 'Userscript name',
  version: '1.0',
  // Field which has multiple value will parsed to an array
  match: [
    'http://www.exmaple.com/*',
    'http://www.exmaple.org/*',
  ]
}
```

### stringify(object)

```js
const userscript = require('userscript-meta')

userscript.stringify({
  name: 'Userscript name',
  version: '1.0',
  match: [
    'http://www.exmaple.com/*',
    'http://www.exmaple.org/*',
  ]
})
```

equals to

```js
// ==UserScript==
// @name Userscript name
// @version 1.0
// @match http://www.example.com/*
// @match http://www.example.org/*
// ==/UserScript==
```

## license

MIT

---
_Source: https://npm.io/package/userscript-meta · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
