@augment-vir/common
Advanced tools
Comparing version 21.3.6 to 21.4.0
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.wrapNumber = exports.toEnsuredNumber = void 0; | ||
exports.round = exports.wrapNumber = exports.toEnsuredNumber = void 0; | ||
function toEnsuredNumber(input) { | ||
@@ -24,1 +24,7 @@ const numeric = Number(input); | ||
exports.wrapNumber = wrapNumber; | ||
function round(inputs) { | ||
const digitFactor = Math.pow(10, inputs.digits); | ||
const multiplied = inputs.number * digitFactor; | ||
return Number((Math.round(multiplied) / digitFactor).toFixed(inputs.digits)); | ||
} | ||
exports.round = round; |
@@ -82,3 +82,4 @@ "use strict"; | ||
testValue.constructor !== matchValue.constructor) { | ||
throwKeyError(`constructor "${testValue?.constructor?.name}" did not match expected constructor "${matchValue.constructor}"`); | ||
throwKeyError(`constructor "${testValue?.constructor | ||
?.name}" did not match expected constructor "${matchValue.constructor}"`); | ||
} | ||
@@ -85,0 +86,0 @@ } |
@@ -19,1 +19,6 @@ export function toEnsuredNumber(input) { | ||
} | ||
export function round(inputs) { | ||
const digitFactor = Math.pow(10, inputs.digits); | ||
const multiplied = inputs.number * digitFactor; | ||
return Number((Math.round(multiplied) / digitFactor).toFixed(inputs.digits)); | ||
} |
@@ -77,3 +77,4 @@ import { isTruthy } from '../boolean'; | ||
testValue.constructor !== matchValue.constructor) { | ||
throwKeyError(`constructor "${testValue?.constructor?.name}" did not match expected constructor "${matchValue.constructor}"`); | ||
throwKeyError(`constructor "${testValue?.constructor | ||
?.name}" did not match expected constructor "${matchValue.constructor}"`); | ||
} | ||
@@ -80,0 +81,0 @@ } |
@@ -7,1 +7,5 @@ export declare function toEnsuredNumber(input: any): number; | ||
}): number; | ||
export declare function round(inputs: { | ||
number: number; | ||
digits: number; | ||
}): number; |
@@ -12,2 +12,3 @@ export type Tuple<ArrayElementGeneric, LengthGeneric extends number> = LengthGeneric extends LengthGeneric ? number extends LengthGeneric ? ArrayElementGeneric[] : _TupleOf<ArrayElementGeneric, LengthGeneric, []> : never; | ||
}; | ||
export type MaybeTuple<T> = T | AtLeastTuple<T, 1>; | ||
export {}; |
{ | ||
"name": "@augment-vir/common", | ||
"version": "21.3.6", | ||
"version": "21.4.0", | ||
"homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common", | ||
@@ -28,3 +28,3 @@ "bugs": { | ||
"browser-or-node": "^2.1.1", | ||
"type-fest": "^4.4.0" | ||
"type-fest": "^4.6.0" | ||
}, | ||
@@ -31,0 +31,0 @@ "devDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
173853
4206
Updatedtype-fest@^4.6.0