-
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(units): restructure /src, add quantities/constants
- add /src/constants: - velocities - DIN paper sizes - move all unit presets to /src/units - update pkg exports
- Loading branch information
1 parent
94ded3e
commit 1374162
Showing
24 changed files
with
131 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { mm } from "../units/length.js"; | ||
import { quantity } from "../unit.js"; | ||
|
||
export const DIN_A0 = quantity([841, 1189], mm); | ||
export const DIN_A1 = quantity([594, 841], mm); | ||
export const DIN_A2 = quantity([420, 594], mm); | ||
export const DIN_A3 = quantity([297, 420], mm); | ||
export const DIN_A4 = quantity([210, 297], mm); | ||
export const DIN_A5 = quantity([148, 210], mm); | ||
export const DIN_A6 = quantity([105, 148], mm); | ||
export const DIN_A7 = quantity([74, 105], mm); | ||
export const DIN_A8 = quantity([52, 74], mm); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { quantity } from "../unit.js"; | ||
import { m_s } from "../units/velocity.js"; | ||
|
||
export const SPEED_OF_LIGHT = quantity(299792458, m_s); | ||
|
||
/** | ||
* At 20 degree celsius | ||
*/ | ||
export const SPEED_OF_SOUND_IN_AIR = quantity(343.14, m_s); | ||
|
||
/** | ||
* At 20 degree celsius | ||
*/ | ||
export const SPEED_OF_SOUND_IN_WATER = quantity(1482, m_s); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
export * from "./api.js"; | ||
export * from "./unit.js"; | ||
|
||
export * from "./accel.js"; | ||
export * from "./angle.js"; | ||
export * from "./area.js"; | ||
export * from "./data.js"; | ||
export * from "./electric.js"; | ||
export * from "./energy.js"; | ||
export * from "./force.js"; | ||
export * from "./frequency.js"; | ||
export * from "./length.js"; | ||
export * from "./luminous.js"; | ||
export * from "./mass.js"; | ||
export * from "./parts.js"; | ||
export * from "./power.js"; | ||
export * from "./pressure.js"; | ||
export * from "./speed.js"; | ||
export * from "./substance.js"; | ||
export * from "./temperature.js"; | ||
export * from "./time.js"; | ||
export * from "./volume.js"; | ||
export * from "./units/accel.js"; | ||
export * from "./units/angle.js"; | ||
export * from "./units/area.js"; | ||
export * from "./units/data.js"; | ||
export * from "./units/density.js"; | ||
export * from "./units/electric.js"; | ||
export * from "./units/energy.js"; | ||
export * from "./units/force.js"; | ||
export * from "./units/frequency.js"; | ||
export * from "./units/length.js"; | ||
export * from "./units/luminous.js"; | ||
export * from "./units/mass.js"; | ||
export * from "./units/parts.js"; | ||
export * from "./units/power.js"; | ||
export * from "./units/pressure.js"; | ||
export * from "./units/substance.js"; | ||
export * from "./units/temperature.js"; | ||
export * from "./units/time.js"; | ||
export * from "./units/velocity.js"; | ||
export * from "./units/volume.js"; | ||
|
||
export * from "./constants/din-sizes.js"; | ||
export * from "./constants/velocities.js"; |
2 changes: 1 addition & 1 deletion
2
packages/units/src/accel.ts → packages/units/src/units/accel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/units/src/angle.ts → packages/units/src/units/angle.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { inch } from "./length.js"; | ||
import { kg } from "./mass.js"; | ||
import { defUnit, div, reciprocal } from "../unit.js"; | ||
import { m3 } from "./volume.js"; | ||
|
||
export const kg_m3 = defUnit("kg/m3", "kilogram per cubic meter", div(kg, m3)); | ||
|
||
export const dpi = defUnit("dpi", "dots per inch", reciprocal(inch)); |
2 changes: 1 addition & 1 deletion
2
packages/units/src/electric.ts → packages/units/src/units/electric.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/units/src/energy.ts → packages/units/src/units/energy.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/units/src/force.ts → packages/units/src/units/force.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { m_s2 } from "./accel.js"; | ||
import { kg } from "./mass.js"; | ||
import { defUnit, mul } from "./unit.js"; | ||
import { defUnit, mul } from "../unit.js"; | ||
|
||
export const N = defUnit("N", "newton", mul(kg, m_s2, true)); |
2 changes: 1 addition & 1 deletion
2
packages/units/src/frequency.ts → packages/units/src/units/frequency.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/units/src/length.ts → packages/units/src/units/length.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/units/src/luminous.ts → packages/units/src/units/luminous.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/units/src/parts.ts → packages/units/src/units/parts.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/units/src/power.ts → packages/units/src/units/power.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/units/src/pressure.ts → packages/units/src/units/pressure.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/units/src/substance.ts → packages/units/src/units/substance.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import { coherent, defUnit } from "./unit.js"; | ||
import { coherent, defUnit } from "../unit.js"; | ||
|
||
export const mol = defUnit("mol", "mole", coherent(5)); |
2 changes: 1 addition & 1 deletion
2
packages/units/src/temperature.ts → packages/units/src/units/temperature.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/units/src/speed.ts → packages/units/src/units/velocity.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
packages/units/src/volume.ts → packages/units/src/units/volume.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters