Skip to content

Commit

Permalink
feat(length): add pica and point units (#536)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonahsnider authored Jul 28, 2022
1 parent ef55ddc commit 14aa7a9
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/bundled-conversions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,11 @@ export const conversions = {
M: [5, 1852],
NM: [5, 1852],
nmi: [5, 1852],
pica: [5, 0.0042333],
picas: [5, 0.0042333],
pc: [5, 0.0042333],
point: [5, 0.0003528],
points: [5, 0.0003528],
gram: [6, 1],
grams: [6, 1],
g: [6, 1],
Expand Down
20 changes: 20 additions & 0 deletions packages/bundled-conversions/test/snapshots/index.test.ts.md
Original file line number Diff line number Diff line change
Expand Up @@ -3181,6 +3181,10 @@ Generated by [AVA](https://avajs.dev).
8,
1e-7,
],
pc: [
5,
0.0042333,
],
pdl: [
4,
0.138255,
Expand Down Expand Up @@ -3309,6 +3313,14 @@ Generated by [AVA](https://avajs.dev).
6,
1e-12,
],
pica: [
5,
0.0042333,
],
picas: [
5,
0.0042333,
],
picobar: [
8,
1e-7,
Expand Down Expand Up @@ -3449,6 +3461,14 @@ Generated by [AVA](https://avajs.dev).
11,
1e-12,
],
point: [
5,
0.0003528,
],
points: [
5,
0.0003528,
],
pound: [
6,
453.59237,
Expand Down
Binary file modified packages/bundled-conversions/test/snapshots/index.test.ts.snap
Binary file not shown.
7 changes: 7 additions & 0 deletions packages/conversions/src/conversions/length.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,12 @@ export const length: ReadonlyDeep<Family> = {
{names: ['yard', 'yards'], symbols: ['yd'], ratio: 0.9144},
{names: ['mile', 'miles'], symbols: ['mi'], ratio: 1609.344},
{names: ['nautical mile', 'nautical miles'], symbols: ['M', 'NM', 'nmi'], ratio: 1852},

// https://en.wikipedia.org/wiki/Pica_(typography)
// The p symbol can't be used as it conflicts with pints
{names: ['pica', 'picas'], symbols: ['pc'], ratio: 4.2333e-3},
// https://en.wikipedia.org/wiki/Point_(typography)
// The pt symbol can't be use as it conflicts with pints
{names: ['point', 'points'], ratio: 0.3528e-3},
],
};
5 changes: 5 additions & 0 deletions packages/convert/src/conversions/length.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import {assertConversions} from '../../test/assert-conversion';

describe('conversions', () => {
assertConversions([{from: [1, 'pica'], to: [12 - 0.000_850_340_136_056_004_8, 'points']}]);
});

0 comments on commit 14aa7a9

Please sign in to comment.