# vmfparser

> A small Valve Map File parser

Latest version **1.2.1** (published 2021-09-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install vmfparser
pnpm add vmfparser
yarn add vmfparser
bun add vmfparser
```

## Health

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

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.1 |
| Published | 2021-09-01 |
| First published | 2014-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 7.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 22 |
| Author | leops |
| Maintainers | leops |
| Keywords | vmf, parser, hammer |

## Links

- npm: https://www.npmjs.com/package/vmfparser
- Repository: https://github.com/leops/vmfparser
- Issues: https://github.com/leops/vmfparser/issues
- npm.io page: https://npm.io/package/vmfparser

## 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.2.1 (latest) — 2021-09-01
- 1.1.1 — 2016-12-30
- 1.1.0 — 2016-06-14
- 1.0.1 — 2016-06-05
- 1.0.0 — 2016-06-05
- 0.1.0 — 2014-09-24

## README

VMFParser
=============

VMF is the format used by the Hammer editor to store maps before their
compilation. Since VMF has a syntax similar to JSON, I decided to write a VMF
parser in JavaScript. I have no idea why.

The code is interesting because it's doesn't have to be a map you're parsing.
You can actually use the VMF format to store any kind of data, JSON like.

See `test/example.js` for an usage example.

## Usage
The module exports a single `parse(input, options)` function. The `input` is a
VMF source string, and `options` is an optional object with the following
properties:

- `ast`: If true, will return the Abstract Syntax Tree instead of the
transformed object.

## Multiple values per-key
This is a unique functionnality of VMF, non-existent in JSON: the ability to
have multiple key with the same name but different values. Here's an example :

```JSON
{
    "someKey": 42,
    "someKey": "someValue"
}
```

If you try to parse this, you'll obtain this JS object :

```JS
{
    someKey: "someValue"
}
```

But with VMF, you can do this:

```VMF
"someKey" "42"
"someKey" "someValue"
```

And you'll get this object instead :

```JS
{
    someKey: ["42", "someValue"]
}
```

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