1
0
Fork 0
freesewing/markdown/dev/reference/api/part/units/en.md
2022-02-19 08:04:25 +01:00

734 B

title
Part.units()

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. The returned value is to be used in presentation only, as it will be a string that includes the user's units.

This method is available as shorthand

You can access this units method from the Part.shorthand method:

let { units } = part.shorthand();

Part.units() signature

string part.units(float number)

Part.units() example

export default function (part) {
  const { raise, units, measurements } = part.shorthand()

  raise.info(`Pattern drafted for a ${units(measurements.chest)} chest`)
}