# Price

## Usage

```JavaScript
var { amount, formatted } = new Price(100.5);
console.log(amount); // 100.5
console.log(formatted); // 100.50

var { amount, formatted } = new Price('100.50 kronor');
console.log(amount); // 100.5
console.log(formatted); // 100.50 kronor

var { amount, formatted } = new Price({
    amount: 100.5,
    formatted: '100.50 kronor'
});

console.log(amount); // 100.5
console.log(formatted); // 100.50 kronor
```

## Parameters

| Name          | Type                               |
|---------------|------------------------------------|
| value         | Number &#124; String &#124; Object |

If a `number` is passed to `Price`, it will auomatically set the `formatted` property.

If a `string` is passed to `Price`, it will try to parse the `amount` property.

Passing an object with `amount` and `formatted` is recommended.
<br>
Example: `new Price({amount: 100.5, formatted: '100.50 kronor'});`

[Run unit tests](../../test/index.html?grep=Price)