Comparing version 0.8.3 to 0.8.4
import { NumberFormatOptions, RoundingStrategy } from './types'; | ||
export interface ApproximateEqualityThreshold { | ||
@@ -4,0 +3,0 @@ /** |
@@ -0,1 +1,2 @@ | ||
/// <reference path="types.d.ts" /> | ||
export * from './Unit.ts'; | ||
@@ -2,0 +3,0 @@ export * from './UnitSystem.ts'; |
@@ -1,6 +0,7 @@ | ||
import { f as o } from "./UnitSystem-HuRq016y.js"; | ||
import { a as v, b as m, U as f, r as w } from "./UnitSystem-HuRq016y.js"; | ||
import { T as h, Q as p, f as o } from "./UnitSystem-b392430a.js"; | ||
import { a as w, b, U as d, r as y } from "./UnitSystem-b392430a.js"; | ||
import "fraction.js"; | ||
class e { | ||
constructor(t, i) { | ||
this.value = t, this.unit = i, Object.freeze(this); | ||
this.value = t, this.unit = i, this[h] = p, Object.freeze(this); | ||
} | ||
@@ -45,4 +46,4 @@ get isUnitless() { | ||
); | ||
const i = this.unit.multiplyValueByFactor(this.value), s = t.divideValueByFactor(i); | ||
return new e(s, t); | ||
const i = this.unit.multiplyValueByFactor(this.value), u = t.divideValueByFactor(i); | ||
return new e(u, t); | ||
} | ||
@@ -89,3 +90,3 @@ add(t) { | ||
var l; | ||
const i = (u) => t.compact ? u : ` ${u} `, s = () => ({ | ||
const i = (s) => t.compact ? s : ` ${s} `, u = () => ({ | ||
type: "multiplicationSign", | ||
@@ -97,8 +98,8 @@ string: i(t.fancyUnicode ? "·" : "*") | ||
if (this.unit.isUnitless) { | ||
const u = this.unit.multiplyValueByFactor(this.value); | ||
const s = this.unit.multiplyValueByFactor(this.value); | ||
return [ | ||
{ | ||
type: "multiplicator", | ||
number: u, | ||
string: o(u, t) | ||
number: s, | ||
string: o(s, t) | ||
} | ||
@@ -109,3 +110,3 @@ ]; | ||
const n = this.unit.toParts(t); | ||
n[0].type === "multiplicator" && (a *= n[0].number, n.shift()), n.length > 0 && n[0].type !== "unit" && n[0].type !== "multiplicationSign" && n.unshift(s()); | ||
n[0].type === "multiplicator" && (a *= n[0].number, n.shift()), n.length > 0 && n[0].type !== "unit" && n[0].type !== "multiplicationSign" && n.unshift(u()); | ||
const r = { | ||
@@ -121,7 +122,7 @@ type: "multiplicator", | ||
e as Quantity, | ||
v as Unit, | ||
m as UnitSystem, | ||
f as UnityFactor, | ||
w as Unit, | ||
b as UnitSystem, | ||
d as UnityFactor, | ||
o as formatFloat, | ||
w as roundFloat | ||
y as roundFloat | ||
}; |
@@ -0,6 +1,5 @@ | ||
import type Fraction from 'fraction.js'; | ||
import type { Unit } from './Unit.ts'; | ||
import { type BaseUnitDefinition, type DerivedUnitDefinition, type FactorDefinition, type QuantityFormatOptions, type UnitFormatPart } from './types'; | ||
import { ApproximateEqualityThreshold } from './float.ts'; | ||
import { BaseUnitDefinition, DerivedUnitDefinition, FactorDefinition, QuantityFormatOptions, UnitFormatPart } from './types'; | ||
import { Unit } from './Unit.ts'; | ||
import { default as Fraction } from 'fraction.js'; | ||
export declare class Quantity<U extends Record<string, BaseUnitDefinition>, F extends Record<string, FactorDefinition>, D extends Record<string, DerivedUnitDefinition>> { | ||
@@ -7,0 +6,0 @@ readonly value: number; |
@@ -1,4 +0,3 @@ | ||
import { BaseUnitDefinition, FactorDefinition } from './types.ts'; | ||
import { UnitSystem } from './UnitSystem.ts'; | ||
import type { BaseUnitDefinition, FactorDefinition } from './types.ts'; | ||
type TDict<Keys extends string, T> = Record<Keys, T>; | ||
@@ -5,0 +4,0 @@ type FactorDict<Keys extends string> = TDict<Keys, FactorDefinition>; |
import e from "fraction.js"; | ||
import { b as s } from "./UnitSystem-HuRq016y.js"; | ||
import { b as s } from "./UnitSystem-b392430a.js"; | ||
const n = { | ||
@@ -4,0 +4,0 @@ s: {}, |
@@ -1,3 +0,9 @@ | ||
import { default as Fraction } from 'fraction.js'; | ||
import Fraction from 'fraction.js'; | ||
import type { Unit } from './Unit'; | ||
import type { Quantity } from './Quantity'; | ||
export declare const TYPE_TAG = "__unitlib_type"; | ||
export declare const UNIT_TYPE = "Unit"; | ||
export declare const QUANTITY_TYPE = "Quantity"; | ||
export declare const isUnit: (x: unknown) => x is Unit<any, any, any>; | ||
export declare const isQuantity: (x: unknown) => x is Quantity<any, any, any>; | ||
export interface BaseUnitDefinition { | ||
@@ -4,0 +10,0 @@ } |
@@ -0,6 +1,5 @@ | ||
import Fraction from 'fraction.js'; | ||
import { UnitSystem } from './UnitSystem.ts'; | ||
import { type BaseUnitDefinition, type DerivedUnitDefinition, type FactorDefinition, type UnitFormatOptions, type UnitFormatPart } from './types.ts'; | ||
import { ApproximateEqualityThreshold } from './float.ts'; | ||
import { BaseUnitDefinition, DerivedUnitDefinition, FactorDefinition, UnitFormatOptions, UnitFormatPart } from './types.ts'; | ||
import { UnitSystem } from './UnitSystem.ts'; | ||
import { default as Fraction } from 'fraction.js'; | ||
export declare const UnityFactor: FactorDefinition; | ||
@@ -7,0 +6,0 @@ export declare class Unit<U extends Record<string, BaseUnitDefinition>, F extends Record<string, FactorDefinition>, D extends Record<string, DerivedUnitDefinition>> { |
@@ -1,4 +0,3 @@ | ||
import { BaseUnitDefinition, DerivedUnitDefinition, FactorDefinition } from './types'; | ||
import { Unit } from './Unit.ts'; | ||
import type { BaseUnitDefinition, DerivedUnitDefinition, FactorDefinition } from './types'; | ||
export type BaseUnitsOf<S> = S extends UnitSystem<infer U, infer F, infer D> ? U : never; | ||
@@ -5,0 +4,0 @@ export type FactorsOf<S> = S extends UnitSystem<infer U, infer F, infer D> ? F : never; |
@@ -0,4 +1,3 @@ | ||
import Fraction from 'fraction.js'; | ||
import { FactorDefinition } from './types.ts'; | ||
import { default as Fraction } from 'fraction.js'; | ||
export declare const divideFactors: (a: Readonly<FactorDefinition>, b: Readonly<FactorDefinition>) => number; | ||
@@ -5,0 +4,0 @@ export declare const normalizeFactor: (factor: Readonly<FactorDefinition>) => FactorDefinition; |
{ | ||
"name": "unitlib", | ||
"version": "0.8.3", | ||
"description": "A unit library", | ||
"type": "module", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/RisaI/unitlib.git" | ||
"name": "unitlib", | ||
"version": "0.8.4", | ||
"description": "A unit library", | ||
"type": "module", | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/RisaI/unitlib.git" | ||
}, | ||
"keywords": [ | ||
"units", | ||
"math", | ||
"format" | ||
], | ||
"author": "Richard Ivánek", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/RisaI/unitlib/issues" | ||
}, | ||
"homepage": "https://github.com/RisaI/unitlib#readme", | ||
"module": "dist/", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js" | ||
}, | ||
"keywords": [ | ||
"units", | ||
"math", | ||
"format" | ||
], | ||
"author": "Richard Ivánek", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/RisaI/unitlib/issues" | ||
}, | ||
"homepage": "https://github.com/RisaI/unitlib#readme", | ||
"module": "dist/", | ||
"types": "dist/index.d.ts", | ||
"exports": { | ||
".": { | ||
"types": "./dist/index.d.ts", | ||
"import": "./dist/index.js" | ||
}, | ||
"./systems": { | ||
"types": "./dist/systems.d.ts", | ||
"import": "./dist/systems.js" | ||
} | ||
}, | ||
"scripts": { | ||
"test": "bun test", | ||
"build": "vite build", | ||
"dev": "vite dev" | ||
}, | ||
"devDependencies": { | ||
"@types/bun": "latest", | ||
"console": "^0.7.2", | ||
"http-server": "^14.1.1", | ||
"prettier": "^3.2.5", | ||
"typescript": "^5.4.5", | ||
"vite": "^5.2.10", | ||
"vite-plugin-dts": "^3.8.3" | ||
}, | ||
"dependencies": { | ||
"yeet-ts": "^1.0.3" | ||
}, | ||
"peerDependencies": { | ||
"fraction.js": "^4.2.1" | ||
"./systems": { | ||
"types": "./dist/systems.d.ts", | ||
"import": "./dist/systems.js" | ||
} | ||
}, | ||
"devDependencies": { | ||
"@types/bun": "latest", | ||
"console": "^0.7.2", | ||
"http-server": "^14.1.1", | ||
"prettier": "^3.2.5", | ||
"typescript": "^5.4.5", | ||
"vite": "^5.2.10", | ||
"vite-plugin-dts": "^3.8.3" | ||
}, | ||
"dependencies": { | ||
"yeet-ts": "^1.0.3" | ||
}, | ||
"peerDependencies": { | ||
"fraction.js": "^4.2.1" | ||
}, | ||
"scripts": { | ||
"test": "bun test", | ||
"build": "vite build", | ||
"dev": "vite dev" | ||
} | ||
} |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
38400
1030
1