# dimensions-parser

> Parse dimensions stored in a string object

Latest version **1.0.0-rc.1** (published 2017-04-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install dimensions-parser
pnpm add dimensions-parser
yarn add dimensions-parser
bun add dimensions-parser
```

## 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.0-rc.1 |
| Published | 2017-04-07 |
| First published | 2017-04-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | alex.dransfield@gmail.com |
| Maintainers | alexdrans |

## Links

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

## Dependencies (1)

- [convert-units](https://npm.io/package/convert-units.md) ^2.2.0

## Recent versions

- 1.0.0-rc.1 (latest) — 2017-04-07

## README

# dimensions-parser

## What is this module?

A module to parse dimension strings into a format you can work with.

String formats include;

```
    'L 10.1 x W 7.1 x H 5 inches'

    '84.5cm(H) 55.3cm(W) 57.4cm(D)'

    'L 1 x W 1 x H 1 inches'

    '850 x 595 x 565 mm (H x W x D)'

    'H143, W55, D58cm'
```


## How to use

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

var dimension = '84.5cm(H) 55.3cm(W) 57.4cm(D)'

var dimensions = dimensionsParser.parse(dimension);

assert.equal(dimensions, {
    height: {
        type: 'height', units: 'cm', amount: 84.5
    },
    width: {
        type: 'width', units: 'cm', amount: 55.3
    },
    depth: {
        type: 'depth', units: 'cm', amount: 57.4
    }
});
```

## TODO

- [ ] Allow conversion to any format *(Currently kicks out cm only)*
- [ ] Add support for 2D dimensions

## Contributing / I found a dimension that the module can't parse!

Please, at the very least, open an issue, stating the problem you are facing. I have provided an issue template to guide you.

Pull Requests are also appreciated. All existing tests *must* pass, and please add tests for your contribution.

## Credits

I created this module whilst working for [NearSt](https://near.st)

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