1
0
Fork 0
freesewing/markdown/dev/reference/api/part/units/en.md

37 lines
734 B
Markdown
Raw Normal View History

2021-10-17 17:34:55 +02:00
***
## title: Part.units()
2021-09-25 17:53:09 +02:00
A part's `units()` method will formats a float you pass it, which should
represent a value in mm, into the units requested by the user.
2021-10-17 17:34:55 +02:00
The returned value is to be used in presentation only, as it will be
2021-09-25 17:53:09 +02:00
a string that includes the user's units.
<Tip>
###### This method is available as shorthand
You can access this units method from the [Part.shorthand](#shorthand) method:
```js
let { units } = part.shorthand();
```
</Tip>
2021-09-25 17:53:09 +02:00
## Part.units() signature
```js
string part.units(float number)
```
## Part.units() example
```js
export default function (part) {
const { raise, units, measurements } = part.shorthand()
raise.info(`Pattern drafted for a ${units(measurements.chest)} chest`)
}
```