# data-string-parser

> Parses strings with 'key: value' pairs into shallow objects.

Latest version **0.1.5** (published 2017-10-25) · MIT license · 0 weekly downloads

## Install

```sh
npm install data-string-parser
pnpm add data-string-parser
yarn add data-string-parser
bun add data-string-parser
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.5 |
| Published | 2017-10-25 |
| First published | 2014-02-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Niklas Boström |
| Maintainers | nbostrom |
| Keywords | html5, data, parser |

## Links

- npm: https://www.npmjs.com/package/data-string-parser
- Repository: https://github.com/nbostrom/data-string-parser
- Homepage: https://github.com/nbostrom/data-string-parser#readme
- Issues: https://github.com/nbostrom/data-string-parser/issues
- npm.io page: https://npm.io/package/data-string-parser

## 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

- 0.1.5 (latest) — 2017-10-25
- 0.1.3 — 2014-02-17
- 0.1.2 — 2014-02-16
- 0.1.1 — 2014-02-16
- 0.1.0 — 2014-02-16

## README

# data-string-parser

Parses strings that looks like a series of key-value pairs separated with commas into shallow objects. It's handy for parsing data-attributes with multiple values. It handles definititions with or without double or single quotes, and it will automaticly
cast numbers to numbers and false/true to booleans, if they aren't surrounded by quotes.

More details in the [specifications generated from the test suite](https://gitlab.com/nbostrom/data-string-parser/blob/748adb2b3fc1ea2a624b3ef824862c9df01a2dea/SPECS.md).

## Usage

    parseDataString('foo: bar, num: 1, isTrue: true, href: http://myserver');
    // {foo: 'bar', num: 1, isTrue: true, href: 'http://myserver'}

## UMD

The parser is wrapped with an UMD wrapper (https://github.com/umdjs/umd), so you can use it together with an AMD loader like Require.js, with node's require or just by including it in your scripts.

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