Releases: varna/measure-ts
Releases · varna/measure-ts
Moved from imperials quarters to american quarters
v3.2.3
Rounding / Extensions
You can now use rounding function:
import { rounder } from 'measure-ts'
const rounded = rounder(number_of_floating_digits)(value)
You can also get UnitKey or extension from Measure:
describe('unitKey', () => {
test('m', () => {
const measure = new Measure(1, 'm')
expect(measure.unitKey).toBe('m')
})
test('cm', () => {
const measure = new Measure(1, 'cm')
expect(measure.unitKey).toBe('cm')
})
test('m2', () => {
const measure = new Measure(1, 'm2')
expect(measure.unitKey).toBe('m2')
})
test('cm3', () => {
const measure = new Measure(1, 'cm3')
expect(measure.unitKey).toBe('cm3')
})
})
describe('extension', () => {
test('m', () => {
const measure = new Measure(1, 'm')
expect(measure.extension).toBe('m')
})
test('cm', () => {
const measure = new Measure(1, 'cm')
expect(measure.extension).toBe('cm')
})
test('m2', () => {
const measure = new Measure(1, 'm2')
expect(measure.extension).toBe('m²')
})
test('cm3', () => {
const measure = new Measure(1, 'cm3')
expect(measure.extension).toBe('cm³')
})
})
Reverted
Exporting UnitKey
- export UnitKey d0974f9