Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import Mass from 'mass.js';
let value = Mass.parse('5 lbs 8 oz'); // Parse string for mass
value += 5.5; // Add 5.5 pounds
Mass.format(value); // Format total: "11 lb"
Mass.format(value, { written: true }); // Written format: "eleven pounds"
```

## Units
Expand Down Expand Up @@ -55,19 +54,12 @@ Format number as string.

- **unit:** `(number|string)` Base unit value or string for lookup (default: 1).

- **written:** `(Object|string|boolean)` [n2words](https://github.com/forzagreen/n2words) options or language identifier (as string), otherwise boolean (default: false).

Returns `value` formatted as `string`, or if unit lookup fails, `undefined`.

**Examples:**

```javascript
Mass.format(11);

Mass.format(176, {
unit: 'oz',
written: true
});
```

------------
Expand Down