# dimension-parser

> parse dimensions out of strings

Latest version **0.0.21** (published 2020-06-08) · MIT license · 0 weekly downloads

## Install

```sh
npm install dimension-parser
pnpm add dimension-parser
yarn add dimension-parser
bun add dimension-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.0.21 |
| Published | 2020-06-08 |
| First published | 2015-03-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 258 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Chad Scira |
| Maintainers | icodeforlove |

## Links

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

## Dependencies (2)

- [string-saw](https://npm.io/package/string-saw.md) 0.0.14
- [js-quantities](https://npm.io/package/js-quantities.md) ^1.5.0

## Recent versions

- 0.0.21 (latest) — 2020-06-08
- 0.0.20 — 2016-05-03
- 0.0.19 — 2016-03-16
- 0.0.18 — 2016-03-16
- 0.0.17 — 2015-11-30
- 0.0.16 — 2015-11-02
- 0.0.15 — 2015-09-13
- 0.0.14 — 2015-08-14
- 0.0.13 — 2015-07-13
- 0.0.12 — 2015-07-04
- 0.0.11 — 2015-06-17
- 0.0.10 — 2015-06-03
- 0.0.9 — 2015-05-05
- 0.0.8 — 2015-03-14
- 0.0.7 — 2015-03-13
- … 6 more at https://npm.io/package/dimension-parser/versions

## README

# dimension-parser [![Build Status](https://travis-ci.org/icodeforlove/dimension-parser.png?branch=master)](https://travis-ci.org/icodeforlove/dimension-parser)

parse dimensions out of strings

## install

```
npm install dimension-parser
```

or

```
bower install dimension-parser
```

## examples

```javascript
var dimensionParser = require('dimension-parser');

dimensionParser('171.5 x 141.5 cm (67.5 x 55.75 in.)', 'in'); // returns {width: "67.50", height: "55.75"}

// or

dimensionParser('171.5 x 141.5 x 141.5 cm (67.5 x 55¾ x 55 3/4 in.)', 'in'); // returns {width: "67.50", height: "55.75", length: "55.75"}

// or you can test if a string contains dimensions

dimensionParser.hasDimensions('foobar'); // returns false

// you can also provide a format (the default is WxHxL)
dimensionParser('171.5 x 141.5 x 141.5 cm (67.5 x 55¾ x 55 3/4 in.)', 'in', 'HxWxL'); // returns {height: "67.50", width: "55.75", length: "55.75"}

// and you can also tell the parser to be more strict
dimensionParser('171.5 x 141.5 x 141.5 cm (67.5 x 55¾ x 55 3/4 in.)', 'in', 'HxWxL', true);
```

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