Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vend-number

Package Overview
Dependencies
Maintainers
31
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vend-number - npm Package Compare versions

Comparing version 4.0.0 to 4.1.0

140

index.d.ts

@@ -1,76 +0,78 @@

import BigNumber from './src/bignumber.js'
declare module 'vend-number' {
import { BigNumber } from 'bignumber.js'
interface Stringable {
toString(): string
}
interface Stringable {
toString(): string
}
// RoundingMode is not exported in bignumber.js 5.0.0 so have to copy and paste the declaration from bignumber.js to
// here in order to use the type. RoundingMode is available in bignumber.js 6.0.0+
declare enum RoundingMode {
/** Rounds away from zero */
ROUND_UP = 0,
/** Rounds towards zero */
ROUND_DOWN = 1,
/** Rounds towards Infinity */
ROUND_CEIL = 2,
/** Rounds towards -Infinity */
ROUND_FLOOR = 3,
/**
* Rounds towards nearest neighbour. If equidistant, rounds away from zero
*/
ROUND_HALF_UP = 4,
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards zero
*/
ROUND_HALF_DOWN = 5,
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour
*/
ROUND_HALF_EVEN = 6,
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards `Infinity`
*/
ROUND_HALF_CEIL = 7,
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards `-Infinity`
*/
ROUND_HALF_FLOOR = 8,
/**
* The remainder is always positive. Euclidian division: `q = sign(n) * floor(a / abs(n))`
*/
EUCLID = 9
}
// RoundingMode is not exported in bignumber.js 5.0.0 so have to copy and paste the declaration from bignumber.js to
// here in order to use the type. RoundingMode is available in bignumber.js 6.0.0+
enum RoundingMode {
/** Rounds away from zero */
ROUND_UP = 0,
/** Rounds towards zero */
ROUND_DOWN = 1,
/** Rounds towards Infinity */
ROUND_CEIL = 2,
/** Rounds towards -Infinity */
ROUND_FLOOR = 3,
/**
* Rounds towards nearest neighbour. If equidistant, rounds away from zero
*/
ROUND_HALF_UP = 4,
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards zero
*/
ROUND_HALF_DOWN = 5,
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards even neighbour
*/
ROUND_HALF_EVEN = 6,
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards `Infinity`
*/
ROUND_HALF_CEIL = 7,
/**
* Rounds towards nearest neighbour. If equidistant, rounds towards `-Infinity`
*/
ROUND_HALF_FLOOR = 8,
/**
* The remainder is always positive. Euclidian division: `q = sign(n) * floor(a / abs(n))`
*/
EUCLID = 9
}
export default class VendNumber extends BigNumber {
constructor (value?: Stringable)
export default class VendNumber extends BigNumber {
constructor (value?: Stringable)
static readonly ROUNDING_MODES: {
ROUND_UP: RoundingMode,
ROUND_DOWN: RoundingMode,
ROUND_CEIL: RoundingMode,
ROUND_FLOOR: RoundingMode,
ROUND_HALF_UP: RoundingMode,
ROUND_HALF_DOWN: RoundingMode,
ROUND_HALF_EVEN: RoundingMode,
ROUND_HALF_CEIL: RoundingMode,
ROUND_HALF_FLOOR: RoundingMode
static readonly ROUNDING_MODES: {
ROUND_UP: RoundingMode,
ROUND_DOWN: RoundingMode,
ROUND_CEIL: RoundingMode,
ROUND_FLOOR: RoundingMode,
ROUND_HALF_UP: RoundingMode,
ROUND_HALF_DOWN: RoundingMode,
ROUND_HALF_EVEN: RoundingMode,
ROUND_HALF_CEIL: RoundingMode,
ROUND_HALF_FLOOR: RoundingMode
}
static vn(value?: Stringable): VendNumber
static round(value?: Stringable, decimalPoints?: number, roundingMode?: RoundingMode): string
static add(...values: Stringable[]): number
static subtract(...values: Stringable[]): number
static multiply(...values: Stringable[]): number
static divide(...values: Stringable[]): number
static sumBy<T, K extends keyof T>(collection: T[], property: K, decimalPoints: number): string
static isFinite(value: null | number | string | BigNumber): boolean
}
static vn(value?: Stringable): VendNumber
static round(value?: Stringable, decimalPoints?: number, roundingMode?: RoundingMode): string
static add(...values: Stringable[]): number
static subtract(...values: Stringable[]): number
static multiply(...values: Stringable[]): number
static divide(...values: Stringable[]): number
static sumBy<T, K extends keyof T>(collection: T[], property: K, decimalPoints: number): string
static isFinite(value: any): boolean
export function vn(value?: Stringable): VendNumber
export function round(value?: Stringable, decimalPoints?: number, roundingMode?: RoundingMode): string
export function add(...values: Stringable[]): number
export function subtract(...values: Stringable[]): number
export function multiply(...values: Stringable[]): number
export function divide(...values: Stringable[]): number
export function sumBy<T, K extends keyof T>(collection: T[], property: K, decimalPoints: number): string
export function isFinite(value: null | number | string | BigNumber): boolean
}
export function vn(value?: Stringable): VendNumber
export function round(value?: Stringable, decimalPoints?: number, roundingMode?: RoundingMode): string
export function add(...values: Stringable[]): number
export function subtract(...values: Stringable[]): number
export function multiply(...values: Stringable[]): number
export function divide(...values: Stringable[]): number
export function sumBy<T, K extends keyof T>(collection: T[], property: K, decimalPoints: number): string
export function isFinite(value: any): boolean
{
"name": "vend-number",
"version": "4.0.0",
"version": "4.1.0",
"description": "A collection of utility methods for floating point Number operations",

@@ -22,3 +22,5 @@ "main": "src/vend-number.js",

"license": "MIT",
"dependencies": {},
"dependencies": {
"bignumber.js": "5.0.0"
},
"devDependencies": {

@@ -35,6 +37,5 @@ "standard": "^17.1.0",

"dist/**",
"node_modules/**",
"src/bignumber.js"
"node_modules/**"
]
}
}

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

import BigNumber from './bignumber.js'
import BigNumber from 'bignumber.js'

@@ -3,0 +3,0 @@ export const ROUNDING_MODES = {

import VendNumber, { vn, round, add, subtract, multiply, divide, isFinite, sumBy, ROUNDING_MODES } from '../src/vend-number.js'
import BigNumber from '../src/bignumber.js'
import BigNumber from 'bignumber.js'
import { describe, expect, it } from 'vitest'

@@ -4,0 +4,0 @@

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