Skip to content

Commit 79b843c

Browse files
Merge pull request #9 from NeedleInAJayStack/docs/default-units
Default Unit Documentation
2 parents 4e14254 + 554451d commit 79b843c

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@ Here are a few examples:
119119

120120
Measurements are represented as the numeric value followed by a space, then the serialized unit. For example, `5 m/s`
121121

122+
## Default Units
123+
124+
For a list of the default units and their conversion factors, see the
125+
[`DefaultUnits.swift file`](https://github.com/NeedleInAJayStack/Units/blob/main/Sources/Units/Unit/DefaultUnits.swift)
126+
122127
## Custom Units
123128

124129
To extend this package, users can define their own custom units using `Unit.define`:

Sources/Units/Unit/DefaultUnits.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ enum DefaultUnits {
241241
dimension: [.Mass: 1, .Length: 2, .Time: -2],
242242
coefficient: 4184
243243
)
244+
// Thermochemical BTU: https://en.wikipedia.org/wiki/British_thermal_unit#Definitions
244245
static let btu = try! DefinedUnit(
245246
name: "btu",
246247
symbol: "BTU",
@@ -447,6 +448,7 @@ enum DefaultUnits {
447448
dimension: [.Length: 1],
448449
coefficient: 0.3048
449450
)
451+
// International yard: https://en.wikipedia.org/wiki/Yard
450452
static let yard = try! DefinedUnit(
451453
name: "yard",
452454
symbol: "yd",
@@ -611,6 +613,7 @@ enum DefaultUnits {
611613
dimension: [.Mass: 1],
612614
coefficient: 0.028349523125
613615
)
616+
// pound-mass: https://en.wikipedia.org/wiki/Pound_(mass)
614617
static let pound = try! DefinedUnit(
615618
name: "pound",
616619
symbol: "lb",
@@ -924,7 +927,7 @@ enum DefaultUnits {
924927
dimension: [.Time: 1],
925928
coefficient: 604_800
926929
)
927-
// Julian year
930+
// Julian year: https://en.wikipedia.org/wiki/Julian_year_%28astronomy%29
928931
static let year = try! DefinedUnit(
929932
name: "year",
930933
symbol: "yr",

0 commit comments

Comments
 (0)