mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-11 20:40:20 +00:00
Apply some new lint rules (#15282)
This commit is contained in:
Vendored
+2
-2
@@ -444,7 +444,7 @@ declare namespace ablyLib {
|
||||
}
|
||||
}
|
||||
|
||||
export declare class Rest {
|
||||
export class Rest {
|
||||
constructor(options: ablyLib.ClientOptions | string);
|
||||
static Crypto: ablyLib.Crypto;
|
||||
static Message: ablyLib.MessageStatic;
|
||||
@@ -456,7 +456,7 @@ export declare class Rest {
|
||||
time: (paramsOrCallback?: ablyLib.timeCallback | any, callback?: ablyLib.timeCallback) => void;
|
||||
}
|
||||
|
||||
export declare class Realtime {
|
||||
export class Realtime {
|
||||
constructor(options: ablyLib.ClientOptions | string);
|
||||
static Crypto: ablyLib.Crypto;
|
||||
static Message: ablyLib.MessageStatic;
|
||||
|
||||
Vendored
+2
-2
@@ -4,11 +4,11 @@
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace accepts {
|
||||
export interface Headers {
|
||||
interface Headers {
|
||||
[key: string]: string | string[];
|
||||
}
|
||||
|
||||
export interface Accepts {
|
||||
interface Accepts {
|
||||
/**
|
||||
* Return the first accepted charset. If nothing in `charsets` is accepted, then `false` is returned.
|
||||
*/
|
||||
|
||||
@@ -257,4 +257,3 @@ amplify.request({
|
||||
error: (data, status) => {
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Vendored
-5
@@ -34,7 +34,6 @@ declare namespace amplify {
|
||||
}
|
||||
|
||||
interface Request {
|
||||
|
||||
/***
|
||||
* Request a resource.
|
||||
* resourceId: Identifier string for the resource.
|
||||
@@ -118,7 +117,6 @@ declare namespace amplify {
|
||||
}
|
||||
|
||||
interface Store extends StorageTypeStore {
|
||||
|
||||
/***
|
||||
* IE 8+, Firefox 3.5+, Safari 4+, Chrome, Opera 10.5+, iPhone 2+, Android 2+
|
||||
*/
|
||||
@@ -143,12 +141,9 @@ declare namespace amplify {
|
||||
* An in-memory store is provided as a fallback if none of the other storage types are available.
|
||||
*/
|
||||
memory: StorageTypeStore;
|
||||
|
||||
|
||||
}
|
||||
|
||||
interface Static {
|
||||
|
||||
subscribe: Subscribe;
|
||||
|
||||
/***
|
||||
|
||||
Vendored
+1
-7
@@ -8,11 +8,8 @@ import * as angular from "angular";
|
||||
export default "gridster";
|
||||
|
||||
declare module "angular" {
|
||||
|
||||
export namespace gridster {
|
||||
|
||||
namespace gridster {
|
||||
interface GridsterConfig {
|
||||
|
||||
// number of columns in the grid
|
||||
columns?: number;
|
||||
// whether to push other items out of the way
|
||||
@@ -83,7 +80,6 @@ declare module "angular" {
|
||||
|
||||
// options to pass to resizable handler
|
||||
resizable?: {
|
||||
|
||||
// whether the items are resizable
|
||||
enabled?: boolean;
|
||||
|
||||
@@ -103,7 +99,6 @@ declare module "angular" {
|
||||
|
||||
// options to pass to draggable handler
|
||||
draggable?: {
|
||||
|
||||
// whether the items are resizable
|
||||
enabled?: boolean;
|
||||
|
||||
@@ -128,7 +123,6 @@ declare module "angular" {
|
||||
}
|
||||
|
||||
interface StandardGridsterItem {
|
||||
|
||||
// width of the item expressed in terms of number of columns it will occupy
|
||||
sizeX: number;
|
||||
|
||||
|
||||
Vendored
+2
-4
@@ -6,8 +6,8 @@
|
||||
import * as angular from 'angular';
|
||||
|
||||
declare module 'angular' {
|
||||
export namespace oauth2 {
|
||||
interface OAuthConfig {
|
||||
namespace oauth2 {
|
||||
interface OAuthConfig {
|
||||
baseUrl: string;
|
||||
clientId: string;
|
||||
clientSecret?: string;
|
||||
@@ -43,7 +43,5 @@ declare module 'angular' {
|
||||
interface OAuthTokenProvider {
|
||||
configure(params: OAuthTokenConfig): OAuthTokenConfig;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-6
@@ -26,7 +26,6 @@ import ng = angular;
|
||||
// ng module (angular.js)
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
declare namespace angular {
|
||||
|
||||
type Injectable<T extends Function> = T | Array<string | T>;
|
||||
|
||||
// not directly implemented, but ensures that constructed class implements $get
|
||||
@@ -344,7 +343,6 @@ declare namespace angular {
|
||||
* see https://docs.angularjs.org/api/ng/type/form.FormController
|
||||
*/
|
||||
interface IFormController {
|
||||
|
||||
/**
|
||||
* Indexer which should return ng.INgModelController for most properties but cannot because of "All named properties must be assignable to string indexer type" constraint - see https://github.com/Microsoft/TypeScript/issues/272
|
||||
*/
|
||||
@@ -532,7 +530,6 @@ declare namespace angular {
|
||||
* see https://docs.angularjs.org/api/ng/directive/ngRepeat
|
||||
*/
|
||||
interface IRepeatScope extends IScope {
|
||||
|
||||
/**
|
||||
* iterator offset of the repeated element (0..length-1).
|
||||
*/
|
||||
@@ -562,7 +559,6 @@ declare namespace angular {
|
||||
* true if the iterator position $index is odd (otherwise false).
|
||||
*/
|
||||
$odd: boolean;
|
||||
|
||||
}
|
||||
|
||||
interface IAngularEvent {
|
||||
@@ -1944,8 +1940,7 @@ declare namespace angular {
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// AUTO module (angular.js)
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
export namespace auto {
|
||||
|
||||
namespace auto {
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
// InjectorService
|
||||
// see http://docs.angularjs.org/api/AUTO.$injector
|
||||
|
||||
@@ -31,7 +31,7 @@ var config: Microsoft.ApplicationInsights.IConfig = {
|
||||
};
|
||||
|
||||
var appInsights: Microsoft.ApplicationInsights.IAppInsights = {
|
||||
config: config,
|
||||
config,
|
||||
context: null,
|
||||
queue: null,
|
||||
|
||||
@@ -128,7 +128,8 @@ context.track(eventEnvelope);
|
||||
|
||||
// track exception
|
||||
var exceptionObj = new Microsoft.ApplicationInsights.Telemetry.Exception(new Error(), "handledAt", null, null, AI.SeverityLevel.Critical);
|
||||
var exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Exception>(Microsoft.ApplicationInsights.Telemetry.Exception.dataType, exceptionObj);
|
||||
var exceptionData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Exception>(
|
||||
Microsoft.ApplicationInsights.Telemetry.Exception.dataType, exceptionObj);
|
||||
var exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType);
|
||||
context.track(exceptionEnvelope);
|
||||
|
||||
@@ -146,13 +147,15 @@ context.track(pageViewEnvelope);
|
||||
|
||||
// track page view performance
|
||||
var pageViewPerfObj = new Microsoft.ApplicationInsights.Telemetry.PageViewPerformance("page name", "url", 999, null, null);
|
||||
var pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageViewPerformance>(Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.dataType, pageViewPerfObj);
|
||||
var pageViewPerfData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageViewPerformance>(
|
||||
Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.dataType, pageViewPerfObj);
|
||||
var pageViewPerfEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewPerfData, Microsoft.ApplicationInsights.Telemetry.PageViewPerformance.envelopeType);
|
||||
context.track(pageViewPerfEnvelope);
|
||||
|
||||
// track remote dependency
|
||||
var remoteDepObj = new Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData("id", "url", "command", 1, true, 1234, "GET");
|
||||
var remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData>(Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.dataType, remoteDepObj);
|
||||
var remoteDepData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData>(
|
||||
Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.dataType, remoteDepObj);
|
||||
var remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType);
|
||||
context.track(pageViewPerfEnvelope);
|
||||
|
||||
|
||||
Vendored
+1
-2
@@ -306,7 +306,6 @@ declare module Microsoft.Telemetry {
|
||||
}
|
||||
|
||||
declare module Microsoft.ApplicationInsights.Telemetry {
|
||||
|
||||
class Event implements Microsoft.ApplicationInsights.ISerializable {
|
||||
static envelopeType: string;
|
||||
static dataType: string;
|
||||
@@ -794,7 +793,7 @@ declare module Microsoft.ApplicationInsights {
|
||||
}
|
||||
|
||||
declare module 'applicationinsights-js' {
|
||||
export let AppInsights: Microsoft.ApplicationInsights.IAppInsights;
|
||||
const AppInsights: Microsoft.ApplicationInsights.IAppInsights;
|
||||
}
|
||||
|
||||
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
|
||||
Vendored
+2
-4
@@ -164,7 +164,6 @@ interface SpeechSynthesisVoice {
|
||||
}
|
||||
|
||||
declare namespace Artyom {
|
||||
|
||||
interface ArtyomDevice {
|
||||
isChrome(): boolean;
|
||||
isMobile(): boolean;
|
||||
@@ -235,7 +234,7 @@ declare namespace Artyom {
|
||||
onend(): void;
|
||||
}
|
||||
|
||||
export interface ArtyomJS {
|
||||
interface ArtyomJS {
|
||||
/**
|
||||
* Contains some basic information that artyom needs to know as the type of device and browser
|
||||
* @see http://ourcodeworld.com/projects/projects-documentation/6/read-doc/artyom-device/artyom-js
|
||||
@@ -499,13 +498,12 @@ declare namespace Artyom {
|
||||
/**
|
||||
* ArtyomBuilder bla, bla...
|
||||
*/
|
||||
export class ArtyomBuilder {
|
||||
class ArtyomBuilder {
|
||||
/**
|
||||
* Method to bla, bla, bla...
|
||||
*/
|
||||
static getInstance(): ArtyomJS
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// tslint:disable-next-line:export-just-namespace
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
|
||||
export class ViewModel {
|
||||
|
||||
constructor(private knockoutBindable: KnockoutBindable) {
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
-2
@@ -3,8 +3,7 @@
|
||||
// Definitions by: Christian Kotzbauer <https://github.com/code-chris>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare interface KnockoutBindable {
|
||||
|
||||
interface KnockoutBindable {
|
||||
/**
|
||||
* Applys all values from a data object (usually the activation data) to the corresponding instance fields
|
||||
* in the current view model if they are marked as @bindable. By default all matching values from the data object
|
||||
|
||||
Vendored
+3
-4
@@ -6,8 +6,7 @@
|
||||
import { Plugin, Transformer as PostcssTransformer } from 'postcss';
|
||||
|
||||
declare namespace autoprefixer {
|
||||
|
||||
export interface Options {
|
||||
interface Options {
|
||||
browsers?: string[];
|
||||
env?: string;
|
||||
cascade?: boolean;
|
||||
@@ -19,11 +18,11 @@ declare namespace autoprefixer {
|
||||
stats?: any;
|
||||
}
|
||||
|
||||
export interface Transformer extends PostcssTransformer {
|
||||
interface Transformer extends PostcssTransformer {
|
||||
info(): string;
|
||||
}
|
||||
|
||||
export interface Autoprefixer extends Plugin<Options> {
|
||||
interface Autoprefixer extends Plugin<Options> {
|
||||
(opts?: Options): Transformer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ new Awesomplete('input[data-multiple]', {
|
||||
var ajax = new XMLHttpRequest();
|
||||
ajax.open("GET", "https://restcountries.eu/rest/v1/lang/fr", true);
|
||||
ajax.onload = () => {
|
||||
var list = JSON.parse(ajax.responseText).map((i: any) => { return i.name; });
|
||||
new Awesomplete(document.querySelector("#ajax-example input"), { list: list });
|
||||
var list = JSON.parse(ajax.responseText).map((i: any) => i.name);
|
||||
new Awesomplete(document.querySelector("#ajax-example input"), { list });
|
||||
};
|
||||
ajax.send();
|
||||
|
||||
Vendored
+1
-1
@@ -41,7 +41,7 @@ declare namespace Awesomplete {
|
||||
type Suggestion = string | {label: string | any, value: string | any} | [string, string];
|
||||
|
||||
interface Options {
|
||||
list?: string | string[] | Element | { label: string, value: any }[] | [string, string][];
|
||||
list?: string | string[] | Element | Array<{ label: string, value: any }> | Array<[string, string]>;
|
||||
minChars?: number;
|
||||
maxItems?: number;
|
||||
autoFirst?: boolean;
|
||||
|
||||
+303
-305
@@ -1,87 +1,87 @@
|
||||
var x: BigNumber.BigNumber = new BigNumber(9)
|
||||
var y = new BigNumber(x)
|
||||
var x: BigNumber.BigNumber = new BigNumber(9);
|
||||
var y = new BigNumber(x);
|
||||
|
||||
BigNumber(435.345)
|
||||
BigNumber(435.345);
|
||||
|
||||
new BigNumber('5032485723458348569331745.33434346346912144534543')
|
||||
new BigNumber('4.321e+4')
|
||||
new BigNumber('-735.0918e-430')
|
||||
new BigNumber(Infinity)
|
||||
new BigNumber(NaN)
|
||||
new BigNumber('.5')
|
||||
new BigNumber('+2')
|
||||
new BigNumber(-10110100.1, 2)
|
||||
new BigNumber(-0b10110100)
|
||||
new BigNumber('123412421.234324', 5)
|
||||
new BigNumber('ff.8', 16)
|
||||
new BigNumber('0xff.8')
|
||||
new BigNumber('5032485723458348569331745.33434346346912144534543');
|
||||
new BigNumber('4.321e+4');
|
||||
new BigNumber('-735.0918e-430');
|
||||
new BigNumber(Infinity);
|
||||
new BigNumber(NaN);
|
||||
new BigNumber('.5');
|
||||
new BigNumber('+2');
|
||||
new BigNumber(-10110100.1, 2);
|
||||
new BigNumber(-0b10110100);
|
||||
new BigNumber('123412421.234324', 5);
|
||||
new BigNumber('ff.8', 16);
|
||||
new BigNumber('0xff.8');
|
||||
|
||||
new BigNumber(9, 2)
|
||||
new BigNumber(9, 2);
|
||||
|
||||
new BigNumber(96517860459076817.4395)
|
||||
new BigNumber(96517860459076817.4395);
|
||||
|
||||
new BigNumber('blurgh')
|
||||
new BigNumber('blurgh');
|
||||
|
||||
BigNumber.config({ DECIMAL_PLACES: 5 })
|
||||
new BigNumber(1.23456789)
|
||||
new BigNumber(1.23456789, 10)
|
||||
BigNumber.config({ DECIMAL_PLACES: 5 });
|
||||
new BigNumber(1.23456789);
|
||||
new BigNumber(1.23456789, 10);
|
||||
|
||||
BigNumber.config({ DECIMAL_PLACES: 5 })
|
||||
var BN = BigNumber.another({ DECIMAL_PLACES: 9 })
|
||||
BigNumber.config({ DECIMAL_PLACES: 5 });
|
||||
var BN = BigNumber.another({ DECIMAL_PLACES: 9 });
|
||||
|
||||
x = new BigNumber(1)
|
||||
y = new BN(1)
|
||||
x = new BigNumber(1);
|
||||
y = new BN(1);
|
||||
|
||||
x.div(3)
|
||||
y.div(3)
|
||||
x.div(3);
|
||||
y.div(3);
|
||||
|
||||
BN = BigNumber.another()
|
||||
BN.config({ DECIMAL_PLACES: 9 })
|
||||
BN = BigNumber.another();
|
||||
BN.config({ DECIMAL_PLACES: 9 });
|
||||
|
||||
BigNumber.config({ DECIMAL_PLACES: 5 })
|
||||
BigNumber.set({ DECIMAL_PLACES: 5 })
|
||||
BigNumber.config(5)
|
||||
BigNumber.config({ DECIMAL_PLACES: 5 });
|
||||
BigNumber.set({ DECIMAL_PLACES: 5 });
|
||||
BigNumber.config(5);
|
||||
|
||||
BigNumber.config({ ROUNDING_MODE: 0 })
|
||||
BigNumber.config(undefined, BigNumber.ROUND_UP)
|
||||
BigNumber.config({ ROUNDING_MODE: 0 });
|
||||
BigNumber.config(undefined, BigNumber.ROUND_UP);
|
||||
|
||||
BigNumber.config({ EXPONENTIAL_AT: 2 })
|
||||
new BigNumber(12.3)
|
||||
new BigNumber(123)
|
||||
new BigNumber(0.123)
|
||||
new BigNumber(0.0123)
|
||||
BigNumber.config({ EXPONENTIAL_AT: 2 });
|
||||
new BigNumber(12.3);
|
||||
new BigNumber(123);
|
||||
new BigNumber(0.123);
|
||||
new BigNumber(0.0123);
|
||||
|
||||
BigNumber.config({ EXPONENTIAL_AT: [-7, 20] })
|
||||
new BigNumber(123456789)
|
||||
new BigNumber(0.000000123)
|
||||
BigNumber.config({ EXPONENTIAL_AT: [-7, 20] });
|
||||
new BigNumber(123456789);
|
||||
new BigNumber(0.000000123);
|
||||
|
||||
BigNumber.config({ EXPONENTIAL_AT: 1e+9 })
|
||||
BigNumber.config({ EXPONENTIAL_AT: 1e+9 });
|
||||
|
||||
BigNumber.config({ EXPONENTIAL_AT: 0 })
|
||||
BigNumber.config({ EXPONENTIAL_AT: 0 });
|
||||
|
||||
BigNumber.config({ RANGE: 500 })
|
||||
BigNumber.config().RANGE
|
||||
new BigNumber('9.999e499')
|
||||
new BigNumber('1e500')
|
||||
new BigNumber('1e-499')
|
||||
new BigNumber('1e-500')
|
||||
BigNumber.config({ RANGE: 500 });
|
||||
BigNumber.config().RANGE;
|
||||
new BigNumber('9.999e499');
|
||||
new BigNumber('1e500');
|
||||
new BigNumber('1e-499');
|
||||
new BigNumber('1e-500');
|
||||
|
||||
BigNumber.config({ RANGE: [-3, 4] })
|
||||
new BigNumber(99999)
|
||||
new BigNumber(100000)
|
||||
new BigNumber(0.001)
|
||||
new BigNumber(0.0001)
|
||||
BigNumber.config({ RANGE: [-3, 4] });
|
||||
new BigNumber(99999);
|
||||
new BigNumber(100000);
|
||||
new BigNumber(0.001);
|
||||
new BigNumber(0.0001);
|
||||
|
||||
BigNumber.config({ ERRORS: false })
|
||||
BigNumber.config({ ERRORS: false });
|
||||
|
||||
BigNumber.config({ CRYPTO: true })
|
||||
BigNumber.config().CRYPTO
|
||||
BigNumber.random()
|
||||
BigNumber.config({ CRYPTO: true });
|
||||
BigNumber.config().CRYPTO;
|
||||
BigNumber.random();
|
||||
|
||||
BigNumber.config({ MODULO_MODE: BigNumber.EUCLID })
|
||||
BigNumber.config({ MODULO_MODE: 9 })
|
||||
BigNumber.config({ MODULO_MODE: BigNumber.EUCLID });
|
||||
BigNumber.config({ MODULO_MODE: 9 });
|
||||
|
||||
BigNumber.config({ POW_PRECISION: 100 })
|
||||
BigNumber.config({ POW_PRECISION: 100 });
|
||||
|
||||
BigNumber.config({
|
||||
FORMAT: {
|
||||
@@ -110,197 +110,195 @@ BigNumber.config({
|
||||
}
|
||||
});
|
||||
|
||||
BigNumber.config(40, 7, [-10, 20], 500, 1, 1, 3, 80)
|
||||
BigNumber.config(40, 7, [-10, 20], 500, 1, 1, 3, 80);
|
||||
|
||||
var obj = BigNumber.config();
|
||||
obj.ERRORS
|
||||
obj.RANGE
|
||||
obj.ERRORS;
|
||||
obj.RANGE;
|
||||
|
||||
x = new BigNumber('3257869345.0378653')
|
||||
BigNumber.max(4e9, x, '123456789.9')
|
||||
x = new BigNumber('3257869345.0378653');
|
||||
BigNumber.max(4e9, x, '123456789.9');
|
||||
|
||||
var arr = [12, '13', new BigNumber(14)]
|
||||
BigNumber.max(arr)
|
||||
var arr = [12, '13', new BigNumber(14)];
|
||||
BigNumber.max(arr);
|
||||
|
||||
x = new BigNumber('3257869345.0378653')
|
||||
BigNumber.min(4e9, x, '123456789.9')
|
||||
x = new BigNumber('3257869345.0378653');
|
||||
BigNumber.min(4e9, x, '123456789.9');
|
||||
|
||||
arr = [2, new BigNumber(-14), '-15.9999', -12]
|
||||
BigNumber.min(arr)
|
||||
arr = [2, new BigNumber(-14), '-15.9999', -12];
|
||||
BigNumber.min(arr);
|
||||
|
||||
BigNumber.config({ DECIMAL_PLACES: 10 })
|
||||
BigNumber.random()
|
||||
BigNumber.random(20)
|
||||
BigNumber.config({ DECIMAL_PLACES: 10 });
|
||||
BigNumber.random();
|
||||
BigNumber.random(20);
|
||||
|
||||
BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_CEIL })
|
||||
BigNumber.config({ ROUNDING_MODE: 2 })
|
||||
BigNumber.config({ ROUNDING_MODE: BigNumber.ROUND_CEIL });
|
||||
BigNumber.config({ ROUNDING_MODE: 2 });
|
||||
|
||||
x = new BigNumber(-0.8)
|
||||
y = x.absoluteValue()
|
||||
var z = y.abs()
|
||||
x = new BigNumber(-0.8);
|
||||
y = x.absoluteValue();
|
||||
var z = y.abs();
|
||||
|
||||
x = new BigNumber(1.3)
|
||||
x.ceil()
|
||||
y = new BigNumber(-1.8)
|
||||
y.ceil()
|
||||
x = new BigNumber(1.3);
|
||||
x.ceil();
|
||||
y = new BigNumber(-1.8);
|
||||
y.ceil();
|
||||
|
||||
x = new BigNumber(Infinity)
|
||||
y = new BigNumber(5)
|
||||
x.comparedTo(y)
|
||||
x.comparedTo(x.minus(1))
|
||||
y.cmp(NaN)
|
||||
y.cmp('110', 2)
|
||||
x = new BigNumber(Infinity);
|
||||
y = new BigNumber(5);
|
||||
x.comparedTo(y);
|
||||
x.comparedTo(x.minus(1));
|
||||
y.cmp(NaN);
|
||||
y.cmp('110', 2);
|
||||
|
||||
x = new BigNumber(123.45)
|
||||
x.decimalPlaces()
|
||||
y = new BigNumber('9.9e-101')
|
||||
y.dp()
|
||||
x = new BigNumber(123.45);
|
||||
x.decimalPlaces();
|
||||
y = new BigNumber('9.9e-101');
|
||||
y.dp();
|
||||
|
||||
x = new BigNumber(355)
|
||||
y = new BigNumber(113)
|
||||
x.dividedBy(y)
|
||||
x.div(5)
|
||||
x.div(47, 16)
|
||||
x = new BigNumber(355);
|
||||
y = new BigNumber(113);
|
||||
x.dividedBy(y);
|
||||
x.div(5);
|
||||
x.div(47, 16);
|
||||
|
||||
x = new BigNumber(5)
|
||||
y = new BigNumber(3)
|
||||
x.dividedToIntegerBy(y)
|
||||
x.divToInt(0.7)
|
||||
x.divToInt('0.f', 16)
|
||||
x = new BigNumber(5);
|
||||
y = new BigNumber(3);
|
||||
x.dividedToIntegerBy(y);
|
||||
x.divToInt(0.7);
|
||||
x.divToInt('0.f', 16);
|
||||
|
||||
0 === 1e-324
|
||||
x = new BigNumber(0)
|
||||
x.equals('1e-324')
|
||||
BigNumber(-0).eq(x)
|
||||
BigNumber(255).eq('ff', 16)
|
||||
0 === 1e-324;
|
||||
x = new BigNumber(0);
|
||||
x.equals('1e-324');
|
||||
BigNumber(-0).eq(x);
|
||||
BigNumber(255).eq('ff', 16);
|
||||
|
||||
y = new BigNumber(NaN)
|
||||
y.equals(NaN)
|
||||
y = new BigNumber(NaN);
|
||||
y.equals(NaN);
|
||||
|
||||
x = new BigNumber(1.8)
|
||||
x.floor()
|
||||
y = new BigNumber(-1.3)
|
||||
y.floor()
|
||||
x = new BigNumber(1.8);
|
||||
x.floor();
|
||||
y = new BigNumber(-1.3);
|
||||
y.floor();
|
||||
|
||||
0.1 > (0.3 - 0.2)
|
||||
x = new BigNumber(0.1)
|
||||
x.greaterThan(BigNumber(0.3).minus(0.2))
|
||||
BigNumber(0).gt(x)
|
||||
BigNumber(11, 3).gt(11.1, 2)
|
||||
0.1 > (0.3 - 0.2);
|
||||
x = new BigNumber(0.1);
|
||||
x.greaterThan(BigNumber(0.3).minus(0.2));
|
||||
BigNumber(0).gt(x);
|
||||
BigNumber(11, 3).gt(11.1, 2);
|
||||
|
||||
x = new BigNumber(0.3).minus(0.2)
|
||||
x.greaterThanOrEqualTo(0.1)
|
||||
BigNumber(1).gte(x)
|
||||
BigNumber(10, 18).gte('i', 36)
|
||||
x = new BigNumber(0.3).minus(0.2);
|
||||
x.greaterThanOrEqualTo(0.1);
|
||||
BigNumber(1).gte(x);
|
||||
BigNumber(10, 18).gte('i', 36);
|
||||
|
||||
x = new BigNumber(1)
|
||||
x.isFinite()
|
||||
y = new BigNumber(Infinity)
|
||||
y.isFinite()
|
||||
x = new BigNumber(1);
|
||||
x.isFinite();
|
||||
y = new BigNumber(Infinity);
|
||||
y.isFinite();
|
||||
|
||||
x = new BigNumber(1)
|
||||
x.isInteger()
|
||||
y = new BigNumber(123.456)
|
||||
y.isInt()
|
||||
x = new BigNumber(1);
|
||||
x.isInteger();
|
||||
y = new BigNumber(123.456);
|
||||
y.isInt();
|
||||
|
||||
x = new BigNumber(NaN)
|
||||
x.isNaN()
|
||||
y = new BigNumber('Infinity')
|
||||
y.isNaN()
|
||||
x = new BigNumber(NaN);
|
||||
x.isNaN();
|
||||
y = new BigNumber('Infinity');
|
||||
y.isNaN();
|
||||
|
||||
x = new BigNumber(-0)
|
||||
x.isNegative()
|
||||
y = new BigNumber(2)
|
||||
y.isNeg()
|
||||
x = new BigNumber(-0);
|
||||
x.isNegative();
|
||||
y = new BigNumber(2);
|
||||
y.isNeg();
|
||||
|
||||
x = new BigNumber(-0)
|
||||
x.isZero() && x.isNeg()
|
||||
y = new BigNumber(Infinity)
|
||||
y.isZero()
|
||||
x = new BigNumber(-0);
|
||||
x.isZero() && x.isNeg();
|
||||
y = new BigNumber(Infinity);
|
||||
y.isZero();
|
||||
|
||||
x = new BigNumber(0.3).minus(0.2)
|
||||
x.lessThan(0.1)
|
||||
BigNumber(0).lt(x)
|
||||
BigNumber(11.1, 2).lt(11, 3)
|
||||
x = new BigNumber(0.3).minus(0.2);
|
||||
x.lessThan(0.1);
|
||||
BigNumber(0).lt(x);
|
||||
BigNumber(11.1, 2).lt(11, 3);
|
||||
|
||||
x = new BigNumber(0.1)
|
||||
x.lessThanOrEqualTo(BigNumber(0.3).minus(0.2))
|
||||
BigNumber(-1).lte(x)
|
||||
BigNumber(10, 18).lte('i', 36)
|
||||
x = new BigNumber(0.1);
|
||||
x.lessThanOrEqualTo(BigNumber(0.3).minus(0.2));
|
||||
BigNumber(-1).lte(x);
|
||||
BigNumber(10, 18).lte('i', 36);
|
||||
|
||||
x = new BigNumber(0.3)
|
||||
x.minus(0.1)
|
||||
x.sub(0.6, 20)
|
||||
x = new BigNumber(0.3);
|
||||
x.minus(0.1);
|
||||
x.sub(0.6, 20);
|
||||
|
||||
x = new BigNumber(1)
|
||||
x.modulo(0.9)
|
||||
y = new BigNumber(33)
|
||||
y.mod('a', 33)
|
||||
x = new BigNumber(1);
|
||||
x.modulo(0.9);
|
||||
y = new BigNumber(33);
|
||||
y.mod('a', 33);
|
||||
|
||||
x = new BigNumber(1.8)
|
||||
x.negated()
|
||||
y = new BigNumber(-1.3)
|
||||
y.neg()
|
||||
x = new BigNumber(1.8);
|
||||
x.negated();
|
||||
y = new BigNumber(-1.3);
|
||||
y.neg();
|
||||
|
||||
x = new BigNumber(0.1)
|
||||
y = x.plus(0.2)
|
||||
BigNumber(0.7).plus(x).add(y)
|
||||
x.plus('0.1', 8)
|
||||
x = new BigNumber(0.1);
|
||||
y = x.plus(0.2);
|
||||
BigNumber(0.7).plus(x).add(y);
|
||||
x.plus('0.1', 8);
|
||||
|
||||
x = new BigNumber(1.234)
|
||||
x.precision()
|
||||
y = new BigNumber(987000)
|
||||
y.sd()
|
||||
y.sd(true)
|
||||
x = new BigNumber(1.234);
|
||||
x.precision();
|
||||
y = new BigNumber(987000);
|
||||
y.sd();
|
||||
y.sd(true);
|
||||
|
||||
y = new BigNumber(x)
|
||||
y.round()
|
||||
y.round(1)
|
||||
y.round(2)
|
||||
y.round(10)
|
||||
y.round(0, 1)
|
||||
y.round(0, 6)
|
||||
y.round(1, 1)
|
||||
y.round(1, BigNumber.ROUND_HALF_EVEN)
|
||||
y
|
||||
y = new BigNumber(x);
|
||||
y.round();
|
||||
y.round(1);
|
||||
y.round(2);
|
||||
y.round(10);
|
||||
y.round(0, 1);
|
||||
y.round(0, 6);
|
||||
y.round(1, 1);
|
||||
y.round(1, BigNumber.ROUND_HALF_EVEN);
|
||||
|
||||
x = new BigNumber(1.23)
|
||||
x.shift(3)
|
||||
x.shift(-3)
|
||||
x = new BigNumber(1.23);
|
||||
x.shift(3);
|
||||
x.shift(-3);
|
||||
|
||||
x = new BigNumber(16)
|
||||
x.squareRoot()
|
||||
y = new BigNumber(3)
|
||||
y.sqrt()
|
||||
x = new BigNumber(16);
|
||||
x.squareRoot();
|
||||
y = new BigNumber(3);
|
||||
y.sqrt();
|
||||
|
||||
x = new BigNumber(0.6)
|
||||
y = x.times(3)
|
||||
BigNumber('7e+500').times(y)
|
||||
x.times('-a', 16)
|
||||
x = new BigNumber(0.6);
|
||||
y = x.times(3);
|
||||
BigNumber('7e+500').times(y);
|
||||
x.times('-a', 16);
|
||||
|
||||
BigNumber.config({ DECIMAL_PLACES: 5, ROUNDING_MODE: 4 })
|
||||
x = new BigNumber(9876.54321)
|
||||
BigNumber.config({ DECIMAL_PLACES: 5, ROUNDING_MODE: 4 });
|
||||
x = new BigNumber(9876.54321);
|
||||
|
||||
x.toDigits()
|
||||
x.toDigits(6)
|
||||
x.toDigits(6, BigNumber.ROUND_UP)
|
||||
x.toDigits(2)
|
||||
x.toDigits(2, 1)
|
||||
x
|
||||
x.toDigits();
|
||||
x.toDigits(6);
|
||||
x.toDigits(6, BigNumber.ROUND_UP);
|
||||
x.toDigits(2);
|
||||
x.toDigits(2, 1);
|
||||
|
||||
y = new BigNumber(45.6)
|
||||
y.toExponential()
|
||||
y.toExponential(0)
|
||||
y.toExponential(1)
|
||||
y.toExponential(1, 1)
|
||||
y.toExponential(3)
|
||||
y = new BigNumber(45.6);
|
||||
y.toExponential();
|
||||
y.toExponential(0);
|
||||
y.toExponential(1);
|
||||
y.toExponential(1, 1);
|
||||
y.toExponential(3);
|
||||
|
||||
y = new BigNumber(3.456)
|
||||
y.toFixed()
|
||||
y.toFixed(0)
|
||||
y.toFixed(2)
|
||||
y.toFixed(2, 1)
|
||||
y.toFixed(5)
|
||||
y = new BigNumber(3.456);
|
||||
y.toFixed();
|
||||
y.toFixed(0);
|
||||
y.toFixed(2);
|
||||
y.toFixed(2, 1);
|
||||
y.toFixed(5);
|
||||
|
||||
var format = {
|
||||
decimalSeparator: '.',
|
||||
@@ -309,16 +307,16 @@ var format = {
|
||||
secondaryGroupSize: 0,
|
||||
fractionGroupSeparator: ' ',
|
||||
fractionGroupSize: 0
|
||||
}
|
||||
BigNumber.config({ FORMAT: format })
|
||||
};
|
||||
BigNumber.config({ FORMAT: format });
|
||||
|
||||
x = new BigNumber('123456789.123456789')
|
||||
x.toFormat()
|
||||
x.toFormat(1)
|
||||
x = new BigNumber('123456789.123456789');
|
||||
x.toFormat();
|
||||
x.toFormat(1);
|
||||
|
||||
format.groupSeparator = ' '
|
||||
format.fractionGroupSize = 5
|
||||
x.toFormat()
|
||||
format.groupSeparator = ' ';
|
||||
format.fractionGroupSize = 5;
|
||||
x.toFormat();
|
||||
|
||||
BigNumber.config({
|
||||
FORMAT: {
|
||||
@@ -327,119 +325,119 @@ BigNumber.config({
|
||||
groupSize: 3,
|
||||
secondaryGroupSize: 2
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
x.toFormat(6)
|
||||
x.toFormat(6);
|
||||
|
||||
x = new BigNumber(1.75)
|
||||
x.toFraction()
|
||||
x = new BigNumber(1.75);
|
||||
x.toFraction();
|
||||
|
||||
var pi = new BigNumber('3.14159265358')
|
||||
pi.toFraction()
|
||||
pi.toFraction(100000)
|
||||
pi.toFraction(10000)
|
||||
pi.toFraction(100)
|
||||
pi.toFraction(10)
|
||||
pi.toFraction(1)
|
||||
var pi = new BigNumber('3.14159265358');
|
||||
pi.toFraction();
|
||||
pi.toFraction(100000);
|
||||
pi.toFraction(10000);
|
||||
pi.toFraction(100);
|
||||
pi.toFraction(10);
|
||||
pi.toFraction(1);
|
||||
|
||||
x = new BigNumber('177.7e+457')
|
||||
y = new BigNumber(235.4325)
|
||||
z = new BigNumber('0.0098074')
|
||||
x = new BigNumber('177.7e+457');
|
||||
y = new BigNumber(235.4325);
|
||||
z = new BigNumber('0.0098074');
|
||||
|
||||
var str = JSON.stringify([x, y, z])
|
||||
var str = JSON.stringify([x, y, z]);
|
||||
|
||||
JSON.parse(str, (key, val) => key === '' ? val : new BigNumber(val))
|
||||
JSON.parse(str, (key, val) => key === '' ? val : new BigNumber(val));
|
||||
|
||||
x = new BigNumber(456.789)
|
||||
x.toNumber()
|
||||
{ +x }
|
||||
x = new BigNumber(456.789);
|
||||
x.toNumber();
|
||||
{ +x; }
|
||||
|
||||
y = new BigNumber('45987349857634085409857349856430985')
|
||||
y.toNumber()
|
||||
y = new BigNumber('45987349857634085409857349856430985');
|
||||
y.toNumber();
|
||||
|
||||
z = new BigNumber(-0)
|
||||
1 / +z
|
||||
1 / z.toNumber()
|
||||
z = new BigNumber(-0);
|
||||
1 / +z;
|
||||
1 / z.toNumber();
|
||||
|
||||
x = new BigNumber(0.7)
|
||||
x.toPower(2)
|
||||
BigNumber(3).pow(-2)
|
||||
x = new BigNumber(0.7);
|
||||
x.toPower(2);
|
||||
BigNumber(3).pow(-2);
|
||||
|
||||
y = new BigNumber(45.6)
|
||||
x.toPrecision()
|
||||
y.toPrecision()
|
||||
x.toPrecision(1)
|
||||
y.toPrecision(1)
|
||||
y.toPrecision(2, 0)
|
||||
y.toPrecision(2, 1)
|
||||
x.toPrecision(5)
|
||||
y.toPrecision(5)
|
||||
y = new BigNumber(45.6);
|
||||
x.toPrecision();
|
||||
y.toPrecision();
|
||||
x.toPrecision(1);
|
||||
y.toPrecision(1);
|
||||
y.toPrecision(2, 0);
|
||||
y.toPrecision(2, 1);
|
||||
x.toPrecision(5);
|
||||
y.toPrecision(5);
|
||||
|
||||
x = new BigNumber(750000)
|
||||
x.toString()
|
||||
BigNumber.config({ EXPONENTIAL_AT: 5 })
|
||||
x.toString()
|
||||
x = new BigNumber(750000);
|
||||
x.toString();
|
||||
BigNumber.config({ EXPONENTIAL_AT: 5 });
|
||||
x.toString();
|
||||
|
||||
y = new BigNumber(362.875)
|
||||
y.toString(2)
|
||||
y.toString(9)
|
||||
y.toString(32)
|
||||
y = new BigNumber(362.875);
|
||||
y.toString(2);
|
||||
y.toString(9);
|
||||
y.toString(32);
|
||||
|
||||
BigNumber.config({ DECIMAL_PLACES: 4 });
|
||||
z = new BigNumber('1.23456789')
|
||||
z.toString()
|
||||
z.toString(10)
|
||||
z = new BigNumber('1.23456789');
|
||||
z.toString();
|
||||
z.toString(10);
|
||||
|
||||
x = new BigNumber(123.456)
|
||||
x.truncated()
|
||||
y = new BigNumber(-12.3)
|
||||
y.trunc()
|
||||
x = new BigNumber(123.456);
|
||||
x.truncated();
|
||||
y = new BigNumber(-12.3);
|
||||
y.trunc();
|
||||
|
||||
x = new BigNumber('-0')
|
||||
x.toString()
|
||||
x.valueOf()
|
||||
y = new BigNumber('1.777e+457')
|
||||
y.valueOf()
|
||||
x = new BigNumber('-0');
|
||||
x.toString();
|
||||
x.valueOf();
|
||||
y = new BigNumber('1.777e+457');
|
||||
y.valueOf();
|
||||
|
||||
x = new BigNumber(0.123)
|
||||
x.toExponential()
|
||||
x.c
|
||||
x.e
|
||||
x.s
|
||||
x = new BigNumber(0.123);
|
||||
x.toExponential();
|
||||
x.c;
|
||||
x.e;
|
||||
x.s;
|
||||
|
||||
z = new BigNumber('-123.4567000e+2')
|
||||
z.toExponential()
|
||||
z.c
|
||||
z.e
|
||||
z.s
|
||||
z = new BigNumber('-123.4567000e+2');
|
||||
z.toExponential();
|
||||
z.c;
|
||||
z.e;
|
||||
z.s;
|
||||
|
||||
x = new BigNumber(3)
|
||||
x instanceof BigNumber
|
||||
x.isBigNumber
|
||||
x = new BigNumber(3);
|
||||
x instanceof BigNumber;
|
||||
x.isBigNumber;
|
||||
|
||||
BN = BigNumber.another();
|
||||
|
||||
y = new BN(3)
|
||||
y instanceof BigNumber
|
||||
y.isBigNumber
|
||||
y = new BN(3);
|
||||
y instanceof BigNumber;
|
||||
y.isBigNumber;
|
||||
|
||||
y = new BigNumber(-0)
|
||||
y.c
|
||||
y.e
|
||||
y.s
|
||||
y = new BigNumber(-0);
|
||||
y.c;
|
||||
y.e;
|
||||
y.s;
|
||||
|
||||
try {
|
||||
// ...
|
||||
} catch (e) {
|
||||
if (e instanceof Error && e.name == 'BigNumber Error') {
|
||||
if (e instanceof Error && e.name === 'BigNumber Error') {
|
||||
// ...
|
||||
}
|
||||
}
|
||||
|
||||
x = new BigNumber("1.0")
|
||||
y = new BigNumber("1.1000")
|
||||
z = x.add(y)
|
||||
x = new BigNumber("1.0");
|
||||
y = new BigNumber("1.1000");
|
||||
z = x.add(y);
|
||||
|
||||
x = new BigNumber("1.20")
|
||||
y = new BigNumber("3.45000")
|
||||
z = x.mul(y)
|
||||
x = new BigNumber("1.20");
|
||||
y = new BigNumber("3.45000");
|
||||
z = x.mul(y);
|
||||
|
||||
Vendored
+79
-84
@@ -10,9 +10,7 @@ export as namespace BigNumber;
|
||||
export = BigNumber;
|
||||
|
||||
declare namespace BigNumber {
|
||||
|
||||
interface FormatConfig {
|
||||
|
||||
/**
|
||||
* The decimal separator.
|
||||
*/
|
||||
@@ -45,9 +43,8 @@ declare namespace BigNumber {
|
||||
}
|
||||
|
||||
interface BigNumberConfig {
|
||||
|
||||
/**
|
||||
* The maximum number of decimal places of the results of operations involving division,
|
||||
* The maximum number of decimal places of the results of operations involving division,
|
||||
* i.e. division, square root and base conversion operations, and power operations with negative exponents.
|
||||
*/
|
||||
DECIMAL_PLACES: number;
|
||||
@@ -59,56 +56,56 @@ declare namespace BigNumber {
|
||||
|
||||
/**
|
||||
* The exponent value(s) at which `toString` returns exponential notation.
|
||||
*
|
||||
*
|
||||
* If a single number is assigned, the value is the exponent magnitude.
|
||||
*
|
||||
* If an array of two numbers is assigned then the first number is the negative exponent value at and beneath which exponential notation is used,
|
||||
*
|
||||
* If an array of two numbers is assigned then the first number is the negative exponent value at and beneath which exponential notation is used,
|
||||
* and the second number is the positive exponent value at and above which the same.
|
||||
*/
|
||||
EXPONENTIAL_AT: number | number[];
|
||||
|
||||
/**
|
||||
* The exponent value(s) beyond which overflow to `Infinity` and underflow to zero occurs.
|
||||
*
|
||||
* If a single number is assigned, it is the maximum exponent magnitude:
|
||||
* values wth a positive exponent of greater magnitude become `Infinity`
|
||||
*
|
||||
* If a single number is assigned, it is the maximum exponent magnitude:
|
||||
* values wth a positive exponent of greater magnitude become `Infinity`
|
||||
* and those with a negative exponent of greater magnitude become zero.
|
||||
*
|
||||
*
|
||||
* If an array of two numbers is assigned then the first number is the negative exponent limit and the second number is the positive exponent limit.
|
||||
*/
|
||||
RANGE: number | number[];
|
||||
|
||||
/**
|
||||
* The value that determines whether BigNumber Errors are thrown.
|
||||
*
|
||||
*
|
||||
* If `ERRORS` is false, no errors will be thrown.
|
||||
*/
|
||||
ERRORS: boolean | 0 | 1;
|
||||
|
||||
/**
|
||||
* The value that determines whether cryptographically-secure pseudo-random number generation is used.
|
||||
*
|
||||
* If `CRYPTO` is set to `true` then the `random` method will generate random digits using `crypto.getRandomValues` in browsers that support it,
|
||||
*
|
||||
* If `CRYPTO` is set to `true` then the `random` method will generate random digits using `crypto.getRandomValues` in browsers that support it,
|
||||
* or `crypto.randomBytes` if using a version of Node.js that supports it.
|
||||
*
|
||||
*
|
||||
* If neither function is supported by the host environment then attempting to set `CRYPTO` to `true` will fail, and if `ERRORS` is `true` an exception will be thrown.
|
||||
*
|
||||
*
|
||||
* If `CRYPTO` is `false` then the source of randomness used will be `Math.random` (which is assumed to generate at least `30` bits of randomness).
|
||||
*/
|
||||
CRYPTO: boolean | 0 | 1;
|
||||
|
||||
/**
|
||||
* The modulo mode used when calculating the modulus: `a mod n`.
|
||||
*
|
||||
*
|
||||
* The quotient, `q = a / n`, is calculated according to the `ROUNDING_MODE` that corresponds to the chosen `MODULO_MODE`.
|
||||
*
|
||||
*
|
||||
* The remainder, `r`, is calculated as: `r = a - n * q`.
|
||||
*/
|
||||
MODULO_MODE: ModuloMode;
|
||||
|
||||
/**
|
||||
* The maximum number of significant digits of the result of the power operation (unless a modulus is specified).
|
||||
*
|
||||
*
|
||||
* If set to `0`, the number of signifcant digits will not be limited.
|
||||
*/
|
||||
POW_PRECISION: number;
|
||||
@@ -116,15 +113,14 @@ declare namespace BigNumber {
|
||||
/**
|
||||
* The `FORMAT` object configures the format of the string returned by the toFormat method.
|
||||
*/
|
||||
FORMAT: Partial<FormatConfig>
|
||||
FORMAT: Partial<FormatConfig>;
|
||||
}
|
||||
|
||||
type NumberLike = number | string | BigNumber;
|
||||
type RoundingMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8
|
||||
type ModuloMode = RoundingMode | 9
|
||||
type RoundingMode = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
|
||||
type ModuloMode = RoundingMode | 9;
|
||||
|
||||
interface BigNumberStatic {
|
||||
|
||||
/**
|
||||
* Returns a new instance of a BigNumber object.
|
||||
*/
|
||||
@@ -142,7 +138,7 @@ declare namespace BigNumber {
|
||||
|
||||
/**
|
||||
* Configures the settings for this particular BigNumber constructor.
|
||||
*
|
||||
*
|
||||
*/
|
||||
config(obj?: Partial<BigNumberConfig>): BigNumberConfig;
|
||||
|
||||
@@ -201,17 +197,17 @@ declare namespace BigNumber {
|
||||
|
||||
/**
|
||||
* Returns a new BigNumber with a pseudo-random value equal to or greater than `0` and less than `1`.
|
||||
*
|
||||
*
|
||||
* The return value will have `dp` decimal places (or less if trailing zeros are produced).
|
||||
* If `dp` is omitted then the number of decimal places will default to the current `DECIMAL_PLACES` setting.
|
||||
*
|
||||
* Depending on the value of this BigNumber constructor's `CRYPTO` setting and the support for the `crypto` object in the host environment,
|
||||
* the random digits of the return value are generated by either
|
||||
* `Math.random` (fastest),
|
||||
* `crypto.getRandomValues` (Web Cryptography API in recent browsers)
|
||||
*
|
||||
* Depending on the value of this BigNumber constructor's `CRYPTO` setting and the support for the `crypto` object in the host environment,
|
||||
* the random digits of the return value are generated by either
|
||||
* `Math.random` (fastest),
|
||||
* `crypto.getRandomValues` (Web Cryptography API in recent browsers)
|
||||
* or `crypto.randomBytes` (Node.js).
|
||||
*
|
||||
* If `CRYPTO` is `true`, i.e. one of the `crypto` methods is to be used,
|
||||
*
|
||||
* If `CRYPTO` is `true`, i.e. one of the `crypto` methods is to be used,
|
||||
* the value of a returned BigNumber should be cryptographically-secure and statistically indistinguishable from a random value.
|
||||
*/
|
||||
random(dp?: number): BigNumber;
|
||||
@@ -267,15 +263,14 @@ declare namespace BigNumber {
|
||||
ROUND_HALF_FLOOR: 8;
|
||||
|
||||
/**
|
||||
* The remainder is always positive.
|
||||
*
|
||||
* The remainder is always positive.
|
||||
*
|
||||
* Euclidian division: `q = sign(n) * floor(a / abs(n))`
|
||||
*/
|
||||
EUCLID: 9;
|
||||
}
|
||||
|
||||
interface BigNumber {
|
||||
|
||||
/**
|
||||
* Returns a BigNumber whose value is the absolute value, i.e. the magnitude, of the value of this BigNumber.
|
||||
*/
|
||||
@@ -293,26 +288,26 @@ declare namespace BigNumber {
|
||||
|
||||
/**
|
||||
* Returns
|
||||
*
|
||||
*
|
||||
* `1` if the value of this BigNumber is greater than the value of `n`
|
||||
*
|
||||
*
|
||||
* `-1` if the value of this BigNumber is less than the value of `n`
|
||||
*
|
||||
*
|
||||
* `0` if this BigNumber and `n` have the same value
|
||||
*
|
||||
*
|
||||
* `null` if the value of either this BigNumber or `n` is `NaN`
|
||||
*/
|
||||
comparedTo(n: NumberLike, base?: number): 1 | -1 | 0 | null;
|
||||
|
||||
/**
|
||||
* Returns
|
||||
*
|
||||
*
|
||||
* `1` if the value of this BigNumber is greater than the value of `n`
|
||||
*
|
||||
*
|
||||
* `-1` if the value of this BigNumber is less than the value of `n`
|
||||
*
|
||||
*
|
||||
* `0` if this BigNumber and `n` have the same value
|
||||
*
|
||||
*
|
||||
* `null` if the value of either this BigNumber or `n` is `NaN`
|
||||
*/
|
||||
cmp(n: NumberLike, base?: number): 1 | -1 | 0 | null;
|
||||
@@ -348,15 +343,15 @@ declare namespace BigNumber {
|
||||
divToInt(n: NumberLike, base?: number): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns `true` if the value of this BigNumber equals the value of `n`, otherwise returns `false`.
|
||||
*
|
||||
* Returns `true` if the value of this BigNumber equals the value of `n`, otherwise returns `false`.
|
||||
*
|
||||
* As with JavaScript, `NaN` does not equal `NaN`.
|
||||
*/
|
||||
equals(n: NumberLike, base?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns `true` if the value of this BigNumber equals the value of `n`, otherwise returns `false`.
|
||||
*
|
||||
* Returns `true` if the value of this BigNumber equals the value of `n`, otherwise returns `false`.
|
||||
*
|
||||
* As with JavaScript, `NaN` does not equal `NaN`.
|
||||
*/
|
||||
eq(n: NumberLike, base?: number): boolean;
|
||||
@@ -388,7 +383,7 @@ declare namespace BigNumber {
|
||||
|
||||
/**
|
||||
* Returns `true` if the value of this BigNumber is a finite number, otherwise returns `false`.
|
||||
*
|
||||
*
|
||||
* The only possible non-finite values of a BigNumber are `NaN`, `Infinity` and `-Infinity`.
|
||||
*/
|
||||
isFinite(): boolean;
|
||||
@@ -434,12 +429,12 @@ declare namespace BigNumber {
|
||||
lt(n: NumberLike, base?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, otherwise returns
|
||||
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, otherwise returns
|
||||
*/
|
||||
lessThanOrEqualTo(n: NumberLike, base?: number): boolean;
|
||||
|
||||
/**
|
||||
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, otherwise returns
|
||||
* Returns `true` if the value of this BigNumber is less than or equal to the value of `n`, otherwise returns
|
||||
*/
|
||||
lte(n: NumberLike, base?: number): boolean;
|
||||
|
||||
@@ -455,18 +450,18 @@ declare namespace BigNumber {
|
||||
|
||||
/**
|
||||
* Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer remainder of dividing this BigNumber by `n`.
|
||||
*
|
||||
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` setting of this BigNumber constructor.
|
||||
* If it is `1` (default value), the result will have the same sign as this BigNumber,
|
||||
*
|
||||
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` setting of this BigNumber constructor.
|
||||
* If it is `1` (default value), the result will have the same sign as this BigNumber,
|
||||
* and it will match that of Javascript's `%` operator (within the limits of double precision) and BigDecimal's `remainder` method.
|
||||
*/
|
||||
modulo(n: NumberLike, base?: number): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a BigNumber whose value is the value of this BigNumber modulo `n`, i.e. the integer remainder of dividing this BigNumber by `n`.
|
||||
*
|
||||
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` setting of this BigNumber constructor.
|
||||
* If it is `1` (default value), the result will have the same sign as this BigNumber,
|
||||
*
|
||||
* The value returned, and in particular its sign, is dependent on the value of the `MODULO_MODE` setting of this BigNumber constructor.
|
||||
* If it is `1` (default value), the result will have the same sign as this BigNumber,
|
||||
* and it will match that of Javascript's `%` operator (within the limits of double precision) and BigDecimal's `remainder` method.
|
||||
*/
|
||||
mod(n: NumberLike, base?: number): BigNumber;
|
||||
@@ -493,44 +488,44 @@ declare namespace BigNumber {
|
||||
|
||||
/**
|
||||
* Returns the number of significant digits of the value of this BigNumber.
|
||||
*
|
||||
*
|
||||
* If `z` is `true` or `1` then any trailing zeros of the integer part of a number are counted as significant digits, otherwise they are not.
|
||||
*/
|
||||
precision(z?: boolean | 0 | 1): number;
|
||||
|
||||
/**
|
||||
* Returns the number of significant digits of the value of this BigNumber.
|
||||
*
|
||||
*
|
||||
* If `z` is `true` or `1` then any trailing zeros of the integer part of a number are counted as significant digits, otherwise they are not.
|
||||
*/
|
||||
sd(z?: boolean | 0 | 1): number;
|
||||
|
||||
/**
|
||||
* Returns a BigNumber whose value is the value of this BigNumber rounded by rounding mode `rm` to a maximum of `dp` decimal places.
|
||||
*
|
||||
*
|
||||
* If `dp` is omitted, or is `null` or `undefined`, the return value is `n` rounded to a whole number.
|
||||
*
|
||||
*
|
||||
* If `rm` is omitted, or is `null` or `undefined`, `ROUNDING_MODE` is used.
|
||||
*/
|
||||
round(dp?: number, rm?: RoundingMode): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a BigNumber whose value is the value of this BigNumber shifted `n` places.
|
||||
*
|
||||
*
|
||||
* The shift is of the decimal point, i.e. of powers of ten, and is to the left if `n` is negative or to the right if `n` is positive.
|
||||
*/
|
||||
shift(n: number): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
|
||||
*
|
||||
*
|
||||
* The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding.
|
||||
*/
|
||||
squareRoot(): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a BigNumber whose value is the square root of the value of this BigNumber, rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
|
||||
*
|
||||
*
|
||||
* The return value will be correctly rounded, i.e. rounded as if the result was first calculated to an infinite number of correct digits before rounding.
|
||||
*/
|
||||
sqrt(): BigNumber;
|
||||
@@ -547,36 +542,36 @@ declare namespace BigNumber {
|
||||
|
||||
/**
|
||||
* Returns a BigNumber whose value is the value of this BigNumber rounded to `sd` significant digits using rounding mode `rm`.
|
||||
*
|
||||
*
|
||||
* If `sd` is omitted or is `null` or `undefined`, the return value will not be rounded.
|
||||
*
|
||||
*
|
||||
* If `rm` is omitted or is `null` or `undefined`, ROUNDING_MODE will be used.
|
||||
*/
|
||||
toDigits(sd?: number, rm?: RoundingMode): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a string representing the value of this BigNumber in exponential notation rounded using rounding mode `rm` to `dp` decimal places,
|
||||
* Returns a string representing the value of this BigNumber in exponential notation rounded using rounding mode `rm` to `dp` decimal places,
|
||||
* i.e with one digit before the decimal point and `dp` digits after it.
|
||||
*
|
||||
*
|
||||
* If the value of this BigNumber in exponential notation has fewer than `dp` fraction digits, the return value will be appended with zeros accordingly.
|
||||
*
|
||||
*
|
||||
* If `dp` is omitted, or is `null` or `undefined`, the number of digits after the decimal point defaults to the minimum number of digits necessary to represent the value exactly.
|
||||
*
|
||||
*
|
||||
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
|
||||
*/
|
||||
toExponential(dp?: number, rm?: RoundingMode): string;
|
||||
|
||||
/**
|
||||
* Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to `dp` decimal places using rounding mode `rm`.
|
||||
*
|
||||
*
|
||||
* If the value of this BigNumber in normal notation has fewer than `dp` fraction digits, the return value will be appended with zeros accordingly.
|
||||
*
|
||||
*
|
||||
* Unlike `Number.prototype.toFixed`, which returns exponential notation if a number is greater or equal to `10e21`, this method will always return normal notation.
|
||||
*
|
||||
* If `dp` is omitted or is `null` or `undefined`, the return value will be unrounded and in normal notation.
|
||||
*
|
||||
* If `dp` is omitted or is `null` or `undefined`, the return value will be unrounded and in normal notation.
|
||||
* This is also unlike `Number.prototype.toFixed`, which returns the value to zero decimal places.
|
||||
* It is useful when fixed-point notation is required and the current `EXPONENTIAL_AT` setting causes `toString` to return exponential notation.
|
||||
*
|
||||
*
|
||||
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
|
||||
*/
|
||||
toFixed(dp?: number, rm?: RoundingMode): string;
|
||||
@@ -584,17 +579,17 @@ declare namespace BigNumber {
|
||||
/**
|
||||
* Returns a string representing the value of this BigNumber in normal (fixed-point) notation rounded to `dp` decimal places using rounding mode `rm`,
|
||||
* and formatted according to the properties of the `FORMAT` object.
|
||||
*
|
||||
*
|
||||
* If `dp` is omitted or is `null` or `undefined`, then the return value is not rounded to a fixed number of decimal places.
|
||||
*
|
||||
*
|
||||
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
|
||||
*/
|
||||
toFormat(dp?: number, rm?: RoundingMode): string;
|
||||
|
||||
/**
|
||||
* Returns a string array representing the value of this BigNumber as a simple fraction with an integer numerator and an integer denominator.
|
||||
* Returns a string array representing the value of this BigNumber as a simple fraction with an integer numerator and an integer denominator.
|
||||
* The denominator will be a positive non-zero value less than or equal to `max`.
|
||||
*
|
||||
*
|
||||
* If a maximum denominator, `max`, is not specified, or is `null` or `undefined`, the denominator will be the lowest value necessary to represent the number exactly.
|
||||
*/
|
||||
toFraction(max?: NumberLike): [string, string];
|
||||
@@ -606,32 +601,32 @@ declare namespace BigNumber {
|
||||
|
||||
/**
|
||||
* Returns the value of this BigNumber as a JavaScript number primitive.
|
||||
*
|
||||
*
|
||||
* Type coercion with, for example, the unary plus operator will also work, except that a BigNumber with the value minus zero will be converted to positive zero.
|
||||
*/
|
||||
toNumber(): number;
|
||||
|
||||
/**
|
||||
* Returns a BigNumber whose value is the value of this BigNumber raised to the power `n`, and optionally modulo a modulus `m`.
|
||||
*
|
||||
*
|
||||
* If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
|
||||
*/
|
||||
toPower(n: number, m?: NumberLike): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a BigNumber whose value is the value of this BigNumber raised to the power `n`, and optionally modulo a modulus `m`.
|
||||
*
|
||||
*
|
||||
* If `n` is negative the result is rounded according to the current `DECIMAL_PLACES` and `ROUNDING_MODE` configuration.
|
||||
*/
|
||||
pow(n: number, m?: NumberLike): BigNumber;
|
||||
|
||||
/**
|
||||
* Returns a string representing the value of this BigNumber rounded to `sd` significant digits using rounding mode `rm`.
|
||||
*
|
||||
*
|
||||
* If `sd` is less than the number of digits necessary to represent the integer part of the value in normal (fixed-point) notation, then exponential notation is used.
|
||||
*
|
||||
*
|
||||
* If `sd` is omitted, or is `null` or `undefined`, then the return value is the same as `n.toString()`.
|
||||
*
|
||||
*
|
||||
* If `rm` is omitted or is `null` or `undefined`, `ROUNDING_MODE` is used.
|
||||
*/
|
||||
toPrecision(sd?: number, rm?: RoundingMode): string;
|
||||
|
||||
Vendored
+1
-1
@@ -16,7 +16,7 @@ declare namespace BittorrentProtocol {
|
||||
}
|
||||
|
||||
export interface Extension {
|
||||
//tslint:disable-next-line:no-misused-new - could use class instead of interface but class is not extendible
|
||||
// tslint:disable-next-line:no-misused-new - could use class instead of interface but class is not extendible
|
||||
constructor(wire: Wire): this;
|
||||
onHandshake?: () => void;
|
||||
onExtendedHandshake?: () => void;
|
||||
|
||||
Vendored
+8
-10
@@ -13,36 +13,34 @@ import { Request, RequestHandler, Response } from 'express';
|
||||
declare function bodyParser(options?: bodyParser.OptionsJson & bodyParser.OptionsText & bodyParser.OptionsUrlencoded): RequestHandler;
|
||||
|
||||
declare namespace bodyParser {
|
||||
|
||||
export interface Options {
|
||||
interface Options {
|
||||
inflate?: boolean;
|
||||
limit?: number | string;
|
||||
type?: string | ((req: Request) => any);
|
||||
verify?: (req: Request, res: Response, buf: Buffer, encoding: string) => void;
|
||||
}
|
||||
|
||||
export interface OptionsJson extends Options {
|
||||
interface OptionsJson extends Options {
|
||||
reviever?: (key: string, value: any) => any;
|
||||
strict?: boolean;
|
||||
}
|
||||
|
||||
export interface OptionsText extends Options {
|
||||
interface OptionsText extends Options {
|
||||
defaultCharset?: string;
|
||||
}
|
||||
|
||||
export interface OptionsUrlencoded extends Options {
|
||||
interface OptionsUrlencoded extends Options {
|
||||
extended?: boolean;
|
||||
parameterLimit?: number;
|
||||
}
|
||||
|
||||
export function json(options?: OptionsJson): RequestHandler;
|
||||
function json(options?: OptionsJson): RequestHandler;
|
||||
|
||||
export function raw(options?: Options): RequestHandler;
|
||||
function raw(options?: Options): RequestHandler;
|
||||
|
||||
export function text(options?: OptionsText): RequestHandler;
|
||||
|
||||
export function urlencoded(options?: OptionsUrlencoded): RequestHandler;
|
||||
function text(options?: OptionsText): RequestHandler;
|
||||
|
||||
function urlencoded(options?: OptionsUrlencoded): RequestHandler;
|
||||
}
|
||||
|
||||
export = bodyParser;
|
||||
|
||||
Reference in New Issue
Block a user