# size-from-string

> Get a size object from a string. '45x95' → {width: 45, height: 95}

Latest version **1.1.0** (published 2016-05-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install size-from-string
pnpm add size-from-string
yarn add size-from-string
bun add size-from-string
```

## 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.1.0 |
| Published | 2016-05-02 |
| First published | 2016-05-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.10.0 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Michael Wuergler |
| Maintainers | radiovisual |
| Keywords | square, height, width, string, from, object, dimension, size, get |

## Links

- npm: https://www.npmjs.com/package/size-from-string
- Repository: https://github.com/radiovisual/size-from-string
- Homepage: https://github.com/radiovisual/size-from-string#readme
- Issues: https://github.com/radiovisual/size-from-string/issues
- npm.io page: https://npm.io/package/size-from-string

## Dependencies (1)

- [no-whitespace](https://npm.io/package/no-whitespace.md) ^1.0.0

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2016-05-02
- 1.0.0 — 2016-05-02

## README

# size-from-string [![Build Status](https://travis-ci.org/radiovisual/size-from-string.svg?branch=master)](https://travis-ci.org/radiovisual/size-from-string)

> Get a size object from a string. '45x95' → {width: 45, height: 95}


## Install

```
$ npm install --save size-from-string
```


## Usage

```js
const sizeFromString = require('size-from-string');

sizeFromString('100x200');
//=> {width: 100, height: 200}
```


## API

### sizeFromString(input)

Returns an object with width and height properties.

#### input

*Required*  
Type: `string`

The size, represented as a string `'<width>x<height>'` that you want to convert into an object. You can pass in integers or floats.
If you pass in a single value, it will automatically square that value for you.

##### Examples: 

- `"100"` → `{width: 100, height: 100}`
- `"100x200"` → `{width: 100, height: 200}`
- `"-100 x -200"` → `{width: -100, height: -200}`
- `"-100.01 x -200.05"` → `{width: -100.01, height: -200.05}`



## License

MIT © [Michael Wuergler](http://numetriclabs.com)

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