New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

unitlib

Package Overview
Dependencies
Maintainers
2
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unitlib - npm Package Compare versions

Comparing version 0.6.2 to 0.7.0

dist/UnitSystem-92300cd1.mjs

3

dist/Quantity.d.ts
import type Fraction from 'fraction.js';
import type { Unit } from './Unit.ts';
import type { BaseUnitDefinition, DerivedUnitDefinition, FactorDefinition, QuantityFormatOptions } from './types';
import type { BaseUnitDefinition, DerivedUnitDefinition, FactorDefinition, QuantityFormatOptions, UnitFormatPart } from './types';
import { ApproximateEqualityThreshold } from './float.ts';

@@ -32,2 +32,3 @@ export declare class Quantity<U extends Record<string, BaseUnitDefinition>, F extends Record<string, FactorDefinition>, D extends Record<string, DerivedUnitDefinition>> {

toString(opts?: QuantityFormatOptions): string;
toParts(opts?: QuantityFormatOptions): UnitFormatPart[];
}

@@ -0,1 +1,2 @@

import Fraction from 'fraction.js';
export interface BaseUnitDefinition {

@@ -6,3 +7,3 @@ }

base: number;
exp: number;
exp: Fraction;
}

@@ -24,4 +25,38 @@ export interface DerivedUnitDefinition {

useNegativeExponents?: boolean;
omitDenominatorParens?: boolean;
}
export interface QuantityFormatOptions extends UnitFormatOptions {
}
export type UnitFormatExponentPart = {
type: 'exponent';
string: string;
fraction: Fraction;
number: number;
};
export type UnitFormatUnitPart = {
type: 'unit';
string: string;
prefix: string;
baseUnit: string;
exponent?: UnitFormatExponentPart;
denominator?: true;
};
export type UnitFormatPart = UnitFormatExponentPart | UnitFormatUnitPart | {
type: 'parens';
string: string;
contents: UnitFormatPart[];
} | {
type: 'multiplicator';
string: string;
number: number;
} | {
type: 'base';
string: string;
number: number;
} | {
type: 'multiplicationSign';
string: string;
} | {
type: 'divisionSign';
string: string;
};
import Fraction from 'fraction.js';
import { UnitSystem } from './UnitSystem.ts';
import type { BaseUnitDefinition, DerivedUnitDefinition, FactorDefinition, UnitFormatOptions } from './types.ts';
import type { BaseUnitDefinition, DerivedUnitDefinition, FactorDefinition, UnitFormatOptions, UnitFormatPart } from './types.ts';
import { ApproximateEqualityThreshold } from './float.ts';

@@ -12,2 +12,3 @@ export declare const UnityFactor: FactorDefinition;

exponentOf(baseUnit: keyof U): Fraction;
get isZero(): boolean;
get isUnitless(): boolean;

@@ -45,2 +46,3 @@ inverse(): Unit<U, F, D>;

toString(opts?: UnitFormatOptions): string;
toParts(opts?: UnitFormatOptions): UnitFormatPart[];
}

@@ -17,3 +17,3 @@ import { Unit } from './Unit.ts';

*/
getFactorSymbol(f: FactorDefinition): keyof F | undefined;
getFactorSymbol(f: FactorDefinition): (string & keyof F) | undefined;
getNearestLowerFactor(needle: FactorDefinition): {

@@ -20,0 +20,0 @@ factor: keyof F;

@@ -0,4 +1,6 @@

import Fraction from 'fraction.js';
import { FactorDefinition } from './types.ts';
export declare const divideFactors: (a: Readonly<FactorDefinition>, b: Readonly<FactorDefinition>) => number;
export declare const normalizeFactor: (factor: Readonly<FactorDefinition>) => FactorDefinition;
export declare const factorPow: (factor: Readonly<FactorDefinition>, exp: Fraction) => FactorDefinition;
export declare function toUnicodeSuperscript(exponent: string): string;
{
"name": "unitlib",
"version": "0.6.2",
"version": "0.7.0",
"description": "A unit library",

@@ -5,0 +5,0 @@ "repository": {

@@ -28,8 +28,8 @@ # unitlib

// { type: 'multiplicator', string: '3.2', number: 3.2 },
// { type: 'multiplicationSign', string: '*' },
// { type: 'multiplicationSign', string: ' * ' },
// { type: 'base', string: '10', number: 10 },
// { type: 'exponent', string: '^3', number: 3 },
// { type: 'unit', string: 'm^2', prefix: '', baseUnit: 'm', exponent: { string: '^2', number: 2 } },
// { type: 'divisionSign', string: '/' },
// { type: 'unit', string: 's^2', prefix: '', baseUnit: 's', exponent: { string: '^2', number: 2 } }
// { type: 'unit', string: 'm^2', prefix: '', baseUnit: 'm', exponent: { type: 'exponent', string: '^2', number: 2 } },
// { type: 'divisionSign', string: ' / ' },
// { type: 'unit', string: 's^2', prefix: '', baseUnit: 's', exponent: { type: 'exponent', string: '^2', number: 2 } }
// ]

@@ -36,0 +36,0 @@ ```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc