Merge branch 'master' into bugfix/handsontable

This commit is contained in:
Ryan Riley
2017-03-31 15:19:15 -05:00
committed by Ryan Riley
513 changed files with 17723 additions and 14003 deletions

View File

@@ -1,6 +1,6 @@
import * as Ably from 'ably';
declare var console: { log(message: any): void };
declare const console: { log(message: any): void };
const ApiKey = 'appId.keyId:secret';
const client = new Ably.Realtime(ApiKey);
@@ -19,10 +19,9 @@ client.connection.on('failed', () => {
// failed connection
});
// Subscribing to a channel
var channel = client.channels.get('test');
const channel = client.channels.get('test');
channel.subscribe(message => {
message.name; // 'greeting'
message.data; // 'Hello World!'
@@ -68,7 +67,6 @@ channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direct
console.log(messagesPage.items.length);
});
// Presence on a channel
// Getting presence:
@@ -118,7 +116,7 @@ channel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direct
// Generate a random 256-bit key for demonstration purposes (in
// practice you need to create one and distribute it to clients yourselves)
Ably.Realtime.Crypto.generateRandomKey((err, key) => {
var channel = client.channels.get('channelName', { cipher: { key } });
const channel = client.channels.get('channelName', { cipher: { key } });
channel.subscribe(message => {
message.name; // 'name is not encrypted'
@@ -136,7 +134,7 @@ channel.setOptions({cipher: {key: '<KEY>'}}, () => {
// Using the REST API
var restChannel = restClient.channels.get('test');
const restChannel = restClient.channels.get('test');
// Publishing to a channel
@@ -195,7 +193,6 @@ restChannel.presence.history((err, messagesPage) => { // PaginatedResult
// Can optionally take an options param, see https://www.ably.io/documentation/rest-api/#message-history
restChannel.history({ start: Date.now() - 10000, end: Date.now(), limit: 100, direction: 'forwards' }, (err, messagesPage) => {});
// Generate Token and Token Request
// See https://www.ably.io/documentation/general/authentication for an explanation of Ably's authentication mechanism.
@@ -206,7 +203,7 @@ client.auth.requestToken((err, tokenDetails) => {
// see https://www.ably.io/documentation/rest/authentication/#token-details for its properties
// Now we have the token, we can send it to someone who can instantiate a client with it:
var clientUsingToken = new Ably.Realtime(tokenDetails.token);
const clientUsingToken = new Ably.Realtime(tokenDetails.token);
});
// requestToken can take two optional params
@@ -242,15 +239,15 @@ client.stats({ limit: 50 }, (err, statsPage) => { // statsPage as Paginat
client.time({}, (err, time) => {}); // time is in ms since epoch
// Getting decoded Message objects from JSON
var messages = Ably.Realtime.Message.fromEncodedArray([{ id: 'foo' }]);
const messages = Ably.Realtime.Message.fromEncodedArray([{ id: 'foo' }]);
console.log(messages[0].id);
var message = Ably.Rest.Message.fromEncoded({ id: 'foo' });
const message = Ably.Rest.Message.fromEncoded({ id: 'foo' });
console.log(message.id);
// Getting decoded PresenceMessage objects from JSON
var presenceMessages = Ably.Realtime.PresenceMessage.fromEncodedArray([{ id: 'foo' }]);
const presenceMessages = Ably.Realtime.PresenceMessage.fromEncodedArray([{ id: 'foo' }]);
console.log(presenceMessages[0].action);
var presenceMessage = Ably.Rest.PresenceMessage.fromEncoded({ id: 'foo' });
const presenceMessage = Ably.Rest.PresenceMessage.fromEncoded({ id: 'foo' });
console.log(presenceMessage.action);

16
types/ably/index.d.ts vendored
View File

@@ -3,7 +3,7 @@
// Definitions by: Ably <https://github.com/ably/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace ablyLib {
export namespace ablyLib {
namespace ChannelState {
type INITIALIZED = 'initialized';
type ATTACHING = 'attaching';
@@ -130,15 +130,15 @@ declare namespace ablyLib {
* A function which is called when a new token is required.
* The role of the callback is to either generate a signed TokenRequest which may then be submitted automatically
* by the library to the Ably REST API requestToken; or to provide a valid token in as a TokenDetails object.
**/
authCallback?: (data: TokenParams, callback: (error: ErrorInfo | string, tokenRequestOrDetails: TokenDetails | TokenRequest | string) => void) => void;
*/
authCallback?(data: TokenParams, callback: (error: ErrorInfo | string, tokenRequestOrDetails: TokenDetails | TokenRequest | string) => void): void;
authHeaders?: { [index: string]: string };
authMethod?: HTTPMethods;
authParams?: { [index: string]: string };
/**
* A URL that the library may use to obtain a token string (in plain text format), or a signed TokenRequest or TokenDetails (in JSON format).
**/
*/
authUrl?: string;
key?: string;
queryTime?: boolean;
@@ -259,13 +259,13 @@ declare namespace ablyLib {
/**
* A number controlling the verbosity of the output. Valid values are: 0 (no logs), 1 (errors only),
* 2 (errors plus connection and channel state changes), 3 (high-level debug output), and 4 (full debug output).
**/
*/
level?: number;
/**
* A function to handle each line of log output. If handler is not specified, console.log is used.
**/
handler?: (...args: any[]) => void;
*/
handler?(...args: any[]): void;
}
interface ChannelEvent {
@@ -398,7 +398,7 @@ declare namespace ablyLib {
}
interface Crypto {
generateRandomKey: (callback: (error: ErrorInfo, key: string) => void) => void;
generateRandomKey(callback: (error: ErrorInfo, key: string) => void): void;
}
class Connection extends EventEmitter<connectionEventCallback> {

View File

@@ -27,8 +27,6 @@ accounting.formatMoney(5318008, {
// Will recursively format an array of values:
accounting.formatMoney([123, 456, [78, 9]], "$", 0); // ["$123", "$456", ["$78", "$9"]]
// formatColumn
// Format list of numbers for display:
@@ -40,8 +38,6 @@ accounting.formatColumn([123, 12345], "$ ", 0); // ["$ 123", "$ 12,345"]
// List of numbers can be a multi-dimensional array (formatColumn is applied recursively):
accounting.formatColumn([[1, 100], [900, 9]]); // [["$ 1.00", "$100.00"], ["$900.00", "$ 9.00"]]
// formatNumber
// Example usage:
@@ -58,16 +54,11 @@ accounting.formatNumber(5318008, {
// Will recursively format an array of values:
accounting.formatNumber([123456, [7890, 123]]); // ["123,456", ["7,890", "123"]]
// toFixed
(0.615).toFixed(2); // "0.61"
accounting.toFixed(0.615, 2); // "0.62"
// unformat
// Example usage:

View File

@@ -1,4 +1,4 @@
// Type definitions for ADAL.JS 1.0.13
// Type definitions for ADAL.JS 1.0.14
// Project: https://github.com/AzureAD/azure-activedirectory-library-for-js
// Definitions by: mmaitre314 <https://github.com/mmaitre314>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -29,6 +29,7 @@ declare namespace adal {
loginResource?: string;
resource?: string;
extraQueryParameter?: string;
navigateToLoginRequestUrl?: boolean;
}
interface User {

View File

@@ -155,15 +155,11 @@ amplify.request("twitter-search", { term: "amplifyjs" } );
// Similarly, we can create a request that searches for mentions, by accepting a username:
amplify.request.define("twitter-mentions", "ajax", {
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
dataMap: data => {
return {
q: "@" + data.user
};
}
});
amplify.request.define("twitter-mentions", "ajax", {
url: "http://search.twitter.com/search.json",
dataType: "jsonp",
dataMap: data => ({ q: "@" + data.user }),
});
amplify.request("twitter-mentions", { user: "amplifyjs" });
@@ -241,11 +237,11 @@ amplify.request({
// amplify.request comes with built in support for status.The status parameter appears in the default success or error callbacks when using an ajax definition.
amplify.request.define("statusExample1", "ajax", {
// ...
});
amplify.request.define("statusExample1", "ajax", {
// ...
});
amplify.request({
amplify.request({
resourceId: "statusExample1",
success: (data, status) => {
},

View File

@@ -1,7 +1,7 @@
// promise api tests
import amqp = require('amqplib');
var msg = 'Hello World';
const msg = 'Hello World';
// test promise api
amqp.connect('amqp://localhost')
@@ -21,11 +21,10 @@ amqp.connect('amqp://localhost')
});
// test promise api properties
var amqpMessage: amqp.Message;
let amqpMessage: amqp.Message;
amqpMessage.properties.contentType = 'application/json';
var amqpAssertExchangeOptions: amqp.Options.AssertExchange;
var anqpAssertExchangeReplies: amqp.Replies.AssertExchange;
let amqpAssertExchangeOptions: amqp.Options.AssertExchange;
let anqpAssertExchangeReplies: amqp.Replies.AssertExchange;
// callback api tests
import amqpcb = require('amqplib/callback_api');
@@ -59,7 +58,7 @@ amqpcb.connect('amqp://localhost', (err, connection) => {
});
// test callback api properties
var amqpcbMessage: amqpcb.Message;
let amqpcbMessage: amqpcb.Message;
amqpcbMessage.properties.contentType = 'application/json';
var amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange;
var anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;
let amqpcbAssertExchangeOptions: amqpcb.Options.AssertExchange;
let anqpcbAssertExchangeReplies: amqpcb.Replies.AssertExchange;

View File

@@ -820,8 +820,8 @@ angular.module('docsTimeDirective', [])
.directive('myCurrentTime', ['$interval', 'dateFilter', ($interval: any, dateFilter: any) => {
return {
link(scope: ng.IScope, element: ng.IAugmentedJQuery, attrs: ng.IAttributes) {
let format: any,
timeoutId: any;
let format: any;
let timeoutId: any;
function updateTime() {
element.text(dateFilter(new Date(), format));
@@ -896,7 +896,10 @@ angular.module('docsIsoFnBindExample', [])
angular.module('dragModule', [])
.directive('myDraggable', ['$document', ($document: any) => {
return (scope: any, element: any, attr: any) => {
let startX = 0, startY = 0, x = 0, y = 0;
let startX = 0;
let startY = 0;
let x = 0;
let y = 0;
element.css({
position: 'relative',

View File

@@ -413,7 +413,7 @@ declare namespace angular {
// https://docs.angularjs.org/api/ng/directive/ngModelOptions
interface INgModelOptions {
updateOn?: string;
debounce?: any;
debounce?: number | { [key: string]: number; };
allowInvalid?: boolean;
getterSetter?: boolean;
timezone?: string;
@@ -602,7 +602,7 @@ declare namespace angular {
///////////////////////////////////////////////////////////////////////////
interface ITimeoutService {
(delay?: number, invokeApply?: boolean): IPromise<void>;
<T>(fn: (...args: any[]) => T, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise<T>;
<T>(fn: (...args: any[]) => T | IPromise<T>, delay?: number, invokeApply?: boolean, ...args: any[]): IPromise<T>;
cancel(promise?: IPromise<any>): boolean;
}
@@ -875,7 +875,8 @@ declare namespace angular {
* @param identifierStart The function that will decide whether the given character is a valid identifier start character.
* @param identifierContinue The function that will decide whether the given character is a valid identifier continue character.
**/
setIdentifierFns(identifierStart?: (character: string, codePoint: number) => boolean,
setIdentifierFns(
identifierStart?: (character: string, codePoint: number) => boolean,
identifierContinue?: (character: string, codePoint: number) => boolean): void;
}

View File

@@ -6,11 +6,13 @@
"quotemark": [true, "single"],
"variable-name": [true, "check-format"],
// Below are all TODOs
"callable-types": false,
"ban-types": false,
"interface-name": false,
"no-empty-interface": false,
"jsdoc-format": false,
"max-line-length": false,
"no-empty-interface": false,
"unified-signatures": false,
"void-return": false
}

View File

@@ -21,7 +21,6 @@ describe("ApplePaySession", () => {
}
});
it("can create a new instance", () => {
const version = 1;
const paymentRequest = {
countryCode: "US",
@@ -42,7 +41,6 @@ describe("ApplePaySession", () => {
const session = new ApplePaySession(version, paymentRequest);
});
it("can call static methods", () => {
const merchantIdentifier = "MyMerchantId";
let canMakePayments: boolean = ApplePaySession.canMakePayments();
@@ -59,7 +57,6 @@ describe("ApplePaySession", () => {
});
});
it("can call instance methods", () => {
const version = 1;
const paymentRequest = {
countryCode: "US",
@@ -171,7 +168,6 @@ describe("ApplePaySession", () => {
});
describe("ApplePayPaymentRequest", () => {
it("can create a new instance", () => {
let paymentRequest: ApplePayJS.ApplePayPaymentRequest = {
applicationData: "ApplicationData",
countryCode: "GB",

View File

@@ -7,7 +7,6 @@
* A session object for managing the payment process on the web.
*/
declare class ApplePaySession extends EventTarget {
/**
* Creates a new instance of the ApplePaySession class.
* @param version - The version of the ApplePay JS API you are using.
@@ -164,12 +163,10 @@ declare class ApplePaySession extends EventTarget {
}
declare namespace ApplePayJS {
/**
* Defines a line item in a payment request - for example, total, tax, discount, or grand total.
*/
interface ApplePayLineItem {
/**
* A short, localized description of the line item.
*/
@@ -190,7 +187,6 @@ declare namespace ApplePayJS {
* Represents the result of authorizing a payment request and contains encrypted payment information.
*/
interface ApplePayPayment {
/**
* The encrypted token for an authorized payment.
*/
@@ -211,7 +207,6 @@ declare namespace ApplePayJS {
* The ApplePayPaymentAuthorizedEvent class defines the attributes contained by the ApplePaySession.onpaymentauthorized callback function.
*/
abstract class ApplePayPaymentAuthorizedEvent extends Event {
/**
* The payment token used to authorize a payment.
*/
@@ -222,7 +217,6 @@ declare namespace ApplePayJS {
* Encapsulates contact information needed for billing and shipping.
*/
interface ApplePayPaymentContact {
/**
* An email address for the contact.
*/
@@ -278,7 +272,6 @@ declare namespace ApplePayJS {
* Contains information about an Apple Pay payment card.
*/
interface ApplePayPaymentMethod {
/**
* A string, suitable for display, that describes the card.
*/
@@ -305,7 +298,6 @@ declare namespace ApplePayJS {
* The ApplePayPaymentMethodSelectedEvent class defines the attributes contained by the ApplePaySession.onpaymentmethodselected callback function.
*/
abstract class ApplePayPaymentMethodSelectedEvent extends Event {
/**
* The card used to complete a payment.
*/
@@ -316,7 +308,6 @@ declare namespace ApplePayJS {
* Represents a provisioned payment card for Apple Pay payments.
*/
interface ApplePayPaymentPass {
/**
* The unique identifier for the primary account number for the payment card.
*/
@@ -347,7 +338,6 @@ declare namespace ApplePayJS {
* Encapsulates a request for payment, including information about payment processing capabilities, the payment amount, and shipping information.
*/
interface ApplePayPaymentRequest {
/**
* The merchant's two-letter ISO 3166 country code.
*/
@@ -419,7 +409,6 @@ declare namespace ApplePayJS {
* Contains the user's payment credentials.
*/
interface ApplePayPaymentToken {
/**
* An object containing the encrypted payment data.
*/
@@ -440,7 +429,6 @@ declare namespace ApplePayJS {
* The ApplePayShippingContactSelectedEvent class defines the attributes contained by the ApplePaySession.onshippingcontactselected callback function.
*/
abstract class ApplePayShippingContactSelectedEvent extends Event {
/**
* The shipping address selected by the user.
*/
@@ -451,7 +439,6 @@ declare namespace ApplePayJS {
* Defines a shipping method for delivering physical goods.
*/
interface ApplePayShippingMethod {
/**
* A short description of the shipping method.
*/
@@ -477,7 +464,6 @@ declare namespace ApplePayJS {
* The ApplePayShippingMethodSelectedEvent class defines the attribute contained by the ApplePaySession.onshippingmethodselected callback function.
*/
abstract class ApplePayShippingMethodSelectedEvent extends Event {
/**
* The shipping method selected by the user.
*/
@@ -488,7 +474,6 @@ declare namespace ApplePayJS {
* The ApplePayValidateMerchantEvent class defines the attributes contained by the ApplePaySession.onvalidatemerchant callback function.
*/
abstract class ApplePayValidateMerchantEvent extends Event {
/**
* The URL used to validate the merchant server.
*/
@@ -496,7 +481,6 @@ declare namespace ApplePayJS {
}
abstract class Event {
readonly bubbles: boolean;
cancelBubble: boolean;

View File

@@ -1,3 +1 @@
{
"extends": "../tslint.json"
}
{ "extends": "../tslint.json" }

View File

@@ -1,6 +1,6 @@
// More samples on: https://github.com/Microsoft/ApplicationInsights-JS/blob/master/API-reference.md
var config: Microsoft.ApplicationInsights.IConfig = {
const config: Microsoft.ApplicationInsights.IConfig = {
instrumentationKey: "<your iKey>",
endpointUrl: "endpointUrl",
emitLineDelimitedJson: false,
@@ -30,7 +30,7 @@ var config: Microsoft.ApplicationInsights.IConfig = {
isStorageUseDisabled: true
};
var appInsights: Microsoft.ApplicationInsights.IAppInsights = {
appInsights = {
config,
context: null,
queue: null,
@@ -91,9 +91,8 @@ appInsights.setAuthenticatedUserContext("userId", "accountId");
// set config dynamically
appInsights.config.instrumentationKey = "<new key>";
// TelementryContext
var context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context;
const context: Microsoft.ApplicationInsights.ITelemetryContext = appInsights.context;
context.application.ver = "v0.0.0";
context.application.build = "1.1.1";
@@ -113,54 +112,54 @@ context.operation.id = "1";
context.operation.syntheticSource = "testAgent";
// track
var data = new Microsoft.Telemetry.Base();
var envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(data, "name");
const data = new Microsoft.Telemetry.Base();
const envelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(data, "name");
context.track(envelope);
context.addTelemetryInitializer((envelope) => false);
context.addTelemetryInitializer(telemetryEnvelope => false);
// track event
var eventObj = new Microsoft.ApplicationInsights.Telemetry.Event("test", null, null);
var eventData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Event>(Microsoft.ApplicationInsights.Telemetry.Event.dataType, eventObj);
var eventEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(eventData, Microsoft.ApplicationInsights.Telemetry.Event.envelopeType);
const eventObj = new Microsoft.ApplicationInsights.Telemetry.Event("test", null, null);
const eventData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Event>(Microsoft.ApplicationInsights.Telemetry.Event.dataType, eventObj);
const eventEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(eventData, Microsoft.ApplicationInsights.Telemetry.Event.envelopeType);
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>(
const exceptionObj = new Microsoft.ApplicationInsights.Telemetry.Exception(new Error(), "handledAt", null, null, AI.SeverityLevel.Critical);
const 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);
const exceptionEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(exceptionData, Microsoft.ApplicationInsights.Telemetry.Exception.envelopeType);
context.track(exceptionEnvelope);
// track metric
var metricObj = new Microsoft.ApplicationInsights.Telemetry.Metric("name", 1234, 1, 0, 100, null);
var metricData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Metric>(Microsoft.ApplicationInsights.Telemetry.Metric.dataType, metricObj);
var metricEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(metricData, Microsoft.ApplicationInsights.Telemetry.Metric.envelopeType);
const metricObj = new Microsoft.ApplicationInsights.Telemetry.Metric("name", 1234, 1, 0, 100, null);
const metricData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Metric>(Microsoft.ApplicationInsights.Telemetry.Metric.dataType, metricObj);
const metricEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(metricData, Microsoft.ApplicationInsights.Telemetry.Metric.envelopeType);
context.track(metricEnvelope);
// track page view
var pageViewObj = new Microsoft.ApplicationInsights.Telemetry.PageView("page name", "url", 999, null, null);
var pageViewData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageView>(Microsoft.ApplicationInsights.Telemetry.PageView.dataType, pageViewObj);
var pageViewEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewData, Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType);
const pageViewObj = new Microsoft.ApplicationInsights.Telemetry.PageView("page name", "url", 999, null, null);
const pageViewData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.PageView>(Microsoft.ApplicationInsights.Telemetry.PageView.dataType, pageViewObj);
const pageViewEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(pageViewData, Microsoft.ApplicationInsights.Telemetry.PageView.envelopeType);
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>(
const pageViewPerfObj = new Microsoft.ApplicationInsights.Telemetry.PageViewPerformance("page name", "url", 999, null, null);
const 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);
const 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>(
const remoteDepObj = new Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData("id", "url", "command", 1, true, 1234, "GET");
const 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);
const remoteDepEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(remoteDepData, Microsoft.ApplicationInsights.Telemetry.RemoteDependencyData.envelopeType);
context.track(pageViewPerfEnvelope);
// track trace
var traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", null);
var traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Trace>(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj);
var traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType);
context.track(traceEnvelope);
const traceObj = new Microsoft.ApplicationInsights.Telemetry.Trace("message", null);
const traceData = new Microsoft.ApplicationInsights.Telemetry.Common.Data<Microsoft.ApplicationInsights.Telemetry.Trace>(Microsoft.ApplicationInsights.Telemetry.Trace.dataType, traceObj);
const traceEnvelope = new Microsoft.ApplicationInsights.Telemetry.Common.Envelope(traceData, Microsoft.ApplicationInsights.Telemetry.Trace.envelopeType);
context.track(traceEnvelope);

View File

@@ -195,8 +195,8 @@ declare module Microsoft.ApplicationInsights.Context {
interface IInternal {
/**
* The SDK version used to create this telemetry item.
*/
* The SDK version used to create this telemetry item.
*/
sdkVersion: string;
/**
* The SDK agent version.
@@ -206,15 +206,15 @@ declare module Microsoft.ApplicationInsights.Context {
interface ISample {
/**
* Sample rate
*/
* Sample rate
*/
sampleRate: number;
}
interface ISession {
/**
* The session ID.
*/
* The session ID.
*/
id: string;
/**
* The true if this is the first session
@@ -258,8 +258,8 @@ declare module Microsoft.ApplicationInsights.Context {
interface IUser {
/**
* The telemetry configuration.
*/
* The telemetry configuration.
*/
config: any;
/**
* The user ID.
@@ -345,12 +345,12 @@ declare module Microsoft.ApplicationInsights.Telemetry {
measurements: Microsoft.ApplicationInsights.FieldType;
};
/**
* Constructs a new isntance of the ExceptionTelemetry object
*/
* Constructs a new isntance of the ExceptionTelemetry object
*/
constructor(exception: Error, handledAt?: string, properties?: any, measurements?: any, severityLevel?: AI.SeverityLevel);
/**
* Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.
*/
* Creates a simple exception with 1 stack frame. Useful for manual constracting of exception.
*/
static CreateSimpleException(message: string, typeName: string, assembly: string, fileName: string, details: string, line: number, handledAt?: string): Telemetry.Exception;
}
@@ -414,8 +414,8 @@ declare module Microsoft.ApplicationInsights.Telemetry {
getIsValid(): boolean;
private durationMs;
/**
* Gets the total duration (PLT) in milliseconds. Check getIsValid() before using this method.
*/
* Gets the total duration (PLT) in milliseconds. Check getIsValid() before using this method.
*/
getDurationMs(): number;
/**
* Constructs a new instance of the PageEventTelemetry object
@@ -423,8 +423,8 @@ declare module Microsoft.ApplicationInsights.Telemetry {
constructor(name: string, url: string, unused: number, properties?: any, measurements?: any);
static getPerformanceTiming(): PerformanceTiming;
/**
* Returns true is window performance timing API is supported, false otherwise.
*/
* Returns true is window performance timing API is supported, false otherwise.
*/
static isPerformanceTimingSupported(): PerformanceTiming;
/**
* As page loads different parts of performance timing numbers get set. When all of them are set we can report it.
@@ -615,16 +615,16 @@ declare module Microsoft.ApplicationInsights {
interface ITelemetryContext {
/**
* The object describing a component tracked by this object.
*/
* The object describing a component tracked by this object.
*/
application: Context.IApplication;
/**
* The object describing a device tracked by this object.
*/
device: Context.IDevice;
/**
* The object describing internal settings.
*/
* The object describing internal settings.
*/
internal: Context.IInternal;
/**
* The object describing a location tracked by this object.
@@ -635,8 +635,8 @@ declare module Microsoft.ApplicationInsights {
*/
operation: Context.IOperation;
/**
* The object describing sampling settings.
*/
* The object describing sampling settings.
*/
sample: Context.ISample;
/**
* The object describing a user tracked by this object.
@@ -647,13 +647,13 @@ declare module Microsoft.ApplicationInsights {
*/
session: Context.ISession;
/**
* Adds telemetry initializer to the collection. Telemetry initializers will be called one by one
* before telemetry item is pushed for sending and in the order they were added.
*/
* Adds telemetry initializer to the collection. Telemetry initializers will be called one by one
* before telemetry item is pushed for sending and in the order they were added.
*/
addTelemetryInitializer(telemetryInitializer: (envelope: Microsoft.ApplicationInsights.IEnvelope) => boolean): any;
/**
* Tracks telemetry object.
*/
* Tracks telemetry object.
*/
track(envelope: Microsoft.ApplicationInsights.IEnvelope): any;
}
@@ -662,23 +662,23 @@ declare module Microsoft.ApplicationInsights {
context: ITelemetryContext;
queue: Array<() => void>;
/**
* Starts timing how long the user views a page or other item. Call this when the page opens.
* This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
* @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
*/
* Starts timing how long the user views a page or other item. Call this when the page opens.
* This method doesn't send any telemetry. Call {@link stopTrackTelemetry} to log the page when it closes.
* @param name A string that idenfities this item, unique within this HTML document. Defaults to the document title.
*/
startTrackPage(name?: string): any;
/**
* Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
stopTrackPage(name?: string, url?: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}): any;
* Logs how long a page or other item was visible, after {@link startTrackPage}. Call this when the page closes.
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
* @param url String - a relative or absolute URL that identifies the page or other item. Defaults to the window location.
* @param properties map[string, string] - additional data used to filter pages and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
stopTrackPage(
name?: string,
url?: string,
properties?: { [name: string]: string },
measurements?: { [name: string]: number }): any;
/**
* Logs that a page or other item was viewed.
* @param name The string you used as the name in startTrackPage. Defaults to the document title.
@@ -687,11 +687,11 @@ declare module Microsoft.ApplicationInsights {
* @param measurements map[string, number] - metrics associated with this page, displayed in Metrics Explorer on the portal. Defaults to empty.
* @param duration number - the number of milliseconds it took to load the page. Defaults to undefined. If set to default value, page load time is calculated internally.
*/
trackPageView(name?: string, url?: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}, duration?: number): any;
trackPageView(
name?: string,
url?: string,
properties?: { [name: string]: string },
measurements?: { [name: string]: number }, duration?: number): any;
/**
* Start timing an extended event. Call {@link stopTrackEvent} to log the event when it ends.
* @param name A string that identifies this event uniquely within the document.
@@ -703,22 +703,20 @@ declare module Microsoft.ApplicationInsights {
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
stopTrackEvent(name: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}): any;
stopTrackEvent(
name: string,
properties?: { [name: string]: string },
measurements?: { [name: string]: number }): any;
/**
* Log a user action or other occurrence.
* @param name A string to identify this event in the portal.
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
trackEvent(name: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}): any;
* Log a user action or other occurrence.
* @param name A string to identify this event in the portal.
* @param properties map[string, string] - additional data used to filter events and metrics in the portal. Defaults to empty.
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
*/
trackEvent(
name: string,
properties?: { [name: string]: string },
measurements?: { [name: string]: number }): any;
/**
* Log a dependency call
* @param id unique id, this is used by the backend o correlate server requests. Use Util.newId() to generate a unique Id.
@@ -737,11 +735,12 @@ declare module Microsoft.ApplicationInsights {
* @param measurements map[string, number] - metrics associated with this event, displayed in Metrics Explorer on the portal. Defaults to empty.
* @param severityLevel AI.SeverityLevel - severity level
*/
trackException(exception: Error, handledAt?: string, properties?: {
[name: string]: string;
}, measurements?: {
[name: string]: number;
}, severityLevel?: AI.SeverityLevel): any;
trackException(
exception: Error,
handledAt?: string,
properties?: { [name: string]: string },
measurements?: { [name: string]: number },
severityLevel?: AI.SeverityLevel): any;
/**
* Log a numeric value that is not associated with a specific event. Typically used to send regular reports of performance indicators.
* To send a single measurement, use just the first two parameters. If you take measurements very frequently, you can reduce the
@@ -752,28 +751,30 @@ declare module Microsoft.ApplicationInsights {
* @param min The smallest measurement in the sample. Defaults to the average.
* @param max The largest measurement in the sample. Defaults to the average.
*/
trackMetric(name: string, average: number, sampleCount?: number, min?: number, max?: number, properties?: {
[name: string]: string;
}): any;
trackMetric(
name: string,
average: number,
sampleCount?: number,
min?: number,
max?: number,
properties?: { [name: string]: string }): any;
/**
* Log a diagnostic message.
* @param message A message string
* @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
*/
trackTrace(message: string, properties?: {
[name: string]: string;
}): any;
* Log a diagnostic message.
* @param message A message string
* @param properties map[string, string] - additional data used to filter traces in the portal. Defaults to empty.
*/
trackTrace(message: string, properties?: { [name: string]: string }): any;
/**
* Immediately send all queued telemetry.
*/
flush(): any;
/**
* Sets the autheticated user id and the account id in this session.
* User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars.
*
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
* @param accountId {string} - An optional string to represent the account associated with the authenticated user.
*/
* Sets the autheticated user id and the account id in this session.
* User auth id and account id should be of type string. They should not contain commas, semi-colons, equal signs, spaces, or vertical-bars.
*
* @param authenticatedUserId {string} - The authenticated user id. A unique and persistent string that represents each authenticated user in the service.
* @param accountId {string} - An optional string to represent the account associated with the authenticated user.
*/
setAuthenticatedUserContext(authenticatedUserId: string, accountId?: string): any;
/**
* Clears the authenticated user id and the account id from the user context.
@@ -796,4 +797,4 @@ declare module 'applicationinsights-js' {
const AppInsights: Microsoft.ApplicationInsights.IAppInsights;
}
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;
declare var appInsights: Microsoft.ApplicationInsights.IAppInsights;

View File

@@ -8,4 +8,4 @@ point = {
spatialReference: {
wkid: 4326
}
};
};

View File

@@ -65,7 +65,6 @@ export interface BezierCurve {
export type JsonCurve = CircularArc | Arc | OldCircularArc | BezierCurve;
export interface SpatialReferenceWkid {
wkid?: number;
latestWkid?: number;
@@ -131,7 +130,6 @@ export interface Envelope extends Geometry {
export type esriGeometryType = "esriGeometryPoint" | "esriGeometryMultipoint" | "esriGeometryPolyline" | "esriGeometryPolygon" | "esriGeometryEnvelope";
export type Color = [number, number, number, number];
export type SimpleMarkerSymbolStyle = "esriSMSCircle" | "esriSMSCross" | "esriSMSDiamond" | "esriSMSSquare" | "esriSMSX" | "esriSMSTriangle";
export type SimpleLineSymbolStyle = "esriSLSDash" | "esriSLSDashDot" | "esriSLSDashDotDot" | "esriSLSDot" | "esriSLSNull" | "esriSLSSolid";
@@ -181,7 +179,6 @@ export interface PictureSourced {
"angle"?: number;
"xoffset"?: number;
"yoffset"?: number;
}
export interface PictureMarkerSymbol extends MarkerSymbol, PictureSourced {
@@ -217,4 +214,4 @@ export interface TextSymbol extends MarkerSymbol {
"kerning"?: boolean;
"font"?: Font;
"text"?: string; // only applicable when specified as a client-side graphic.
}
}

View File

@@ -14,7 +14,7 @@ const geojsonPoint: GeoJSON.Point = {
};
// parse ArcGIS JSON, convert it to GeoJSON
var geojson = utils.arcgisToGeoJSON(arcgisPoint);
const geojson = utils.arcgisToGeoJSON(arcgisPoint);
// take GeoJSON and convert it to ArcGIS JSON
var arcgis = utils.geojsonToArcGIS(geojsonPoint);
const arcgis = utils.geojsonToArcGIS(geojsonPoint);

View File

@@ -15,4 +15,4 @@ export function arcgisToGeoJSON<T extends ArcGis.Geometry>(arcgis: T): GeoJSON.G
/**
* Converts a GeoJSON geometry into a ArcGIS geometry.
*/
export function geojsonToArcGIS(geojson: GeoJSON.GeometryObject): ArcGis.Geometry;
export function geojsonToArcGIS(geojson: GeoJSON.GeometryObject): ArcGis.Geometry;

View File

@@ -2,4 +2,4 @@ import arrayUniq = require("array-uniq");
arrayUniq([1, 1, 2, 3, 3]);
arrayUniq(["foo", "foo", "bar", "foo"]);
arrayUniq(["foo", "foo", "bar", "foo"]);

View File

@@ -5,4 +5,4 @@
declare function arrayUniq<T>(arr: T[]): T[];
export = arrayUniq;
export = arrayUniq;

View File

@@ -29,4 +29,4 @@ artyom.getVoices();
artyom.getLanguage();
// Get the artyom.js version
artyom.getVersion();
artyom.getVersion();

View File

@@ -22,16 +22,16 @@ interface SpeechRecognition extends EventTarget {
start(): void;
stop(): void;
abort(): void;
onaudiostart: (ev: Event) => any;
onsoundstart: (ev: Event) => any;
onspeechstart: (ev: Event) => any;
onspeechend: (ev: Event) => any;
onsoundend: (ev: Event) => any;
onresult: (ev: SpeechRecognitionEvent) => any;
onnomatch: (ev: SpeechRecognitionEvent) => any;
onerror: (ev: SpeechRecognitionError) => any;
onstart: (ev: Event) => any;
onend: (ev: Event) => any;
onaudiostart(ev: Event): any;
onsoundstart(ev: Event): any;
onspeechstart(ev: Event): any;
onspeechend(ev: Event): any;
onsoundend(ev: Event): any;
onresult(ev: SpeechRecognitionEvent): any;
onnomatch(ev: SpeechRecognitionEvent): any;
onerror(ev: SpeechRecognitionError): any;
onstart(ev: Event): any;
onend(ev: Event): any;
}
interface SpeechRecognitionStatic {
@@ -106,7 +106,7 @@ interface SpeechSynthesis extends EventTarget {
speaking: boolean;
paused: boolean;
onvoiceschanged: (ev: Event) => any;
onvoiceschanged(ev: Event): any;
speak(utterance: SpeechSynthesisUtterance): void;
cancel(): void;
pause(): void;
@@ -128,13 +128,13 @@ interface SpeechSynthesisUtterance extends EventTarget {
rate: number;
pitch: number;
onstart: (ev: SpeechSynthesisEvent) => any;
onend: (ev: SpeechSynthesisEvent) => any;
onerror: (ev: SpeechSynthesisErrorEvent) => any;
onpause: (ev: SpeechSynthesisEvent) => any;
onresume: (ev: SpeechSynthesisEvent) => any;
onmark: (ev: SpeechSynthesisEvent) => any;
onboundary: (ev: SpeechSynthesisEvent) => any;
onstart(ev: SpeechSynthesisEvent): any;
onend(ev: SpeechSynthesisEvent): any;
onerror(ev: SpeechSynthesisErrorEvent): any;
onpause(ev: SpeechSynthesisEvent): any;
onresume(ev: SpeechSynthesisEvent): any;
onmark(ev: SpeechSynthesisEvent): any;
onboundary(ev: SpeechSynthesisEvent): any;
}
interface SpeechSynthesisUtteranceStatic {
@@ -211,7 +211,7 @@ declare namespace Artyom {
/** Triggers of the command */
indexes: string[];
/** Logic to execute when the command is triggered */
action: (i: number, wildcard?: string, full?: string) => void;
action(i: number, wildcard?: string, full?: string): void;
/** Description of the command */
description?: string;
/** Flag to specify is a command is either normal or smart */
@@ -502,7 +502,7 @@ declare namespace Artyom {
/**
* Method to bla, bla, bla...
*/
static getInstance(): ArtyomJS
static getInstance(): ArtyomJS;
}
}

View File

@@ -122,7 +122,6 @@ export function AssertionError(options: any, message ?: string): void;
*/
export function fail(actual: any, expected: any, message: any, operator: any): void;
/**
* Tests if `value` is truthy. It is equivalent to `assert.equal(!!value, true, message)`.
*
@@ -353,5 +352,4 @@ export function doesNotThrow(block: any, error ?: any, message ?: string): void;
*/
export function ifError(value: any): void;
export as namespace AssertPlus;

View File

@@ -1,6 +1,6 @@
import * as Awesomplete from 'awesomplete';
var input = document.getElementById("myinput");
const input = document.getElementById("myinput");
new Awesomplete(input, {list: "#mylist"});
new Awesomplete(input, {list: document.querySelector("#mylist")});
@@ -9,7 +9,7 @@ new Awesomplete(input, {
list: ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"]
});
var awesomplete = new Awesomplete(input);
const awesomplete = new Awesomplete(input);
awesomplete.list = ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"];
new Awesomplete(input, {
@@ -46,15 +46,15 @@ new Awesomplete('input[data-multiple]', {
},
replace: (text: string) => {
var before = this.input.value.match(/^.+,\s*|/)[0];
const before = this.input.value.match(/^.+,\s*|/)[0];
this.input.value = before + text + ", ";
}
});
var ajax = new XMLHttpRequest();
const 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) => i.name);
const list = JSON.parse(ajax.responseText).map((i: any) => i.name);
new Awesomplete(document.querySelector("#ajax-example input"), { list });
};
ajax.send();

View File

@@ -6,14 +6,14 @@
declare class Awesomplete {
constructor(input: Element | HTMLElement | string, o?: Awesomplete.Options);
static all: any[];
static $$: (expr: string | NodeSelector, con?: any) => NodeList;
static $$(expr: string | NodeSelector, con?: any): NodeList;
static ITEM: (text: string, input: string) => HTMLElement;
static $: {
(expr: string|Element, con?: NodeSelector): string | Element;
regExpEscape: (s: { replace: (arg0: RegExp, arg1: string) => void }) => any;
create: (tag: string, o: any) => HTMLElement;
fire: (target: EventTarget, type: string, properties: any) => any;
siblingIndex: (el: Element) => number;
regExpEscape(s: { replace(arg0: RegExp, arg1: string): void }): any;
create(tag: string, o: any): HTMLElement;
fire(target: EventTarget, type: string, properties: any): any;
siblingIndex(el: Element): number;
};
static FILTER_STARTSWITH: (text: string, input: string) => boolean;
static FILTER_CONTAINS: (text: string, input: string) => boolean;
@@ -45,11 +45,11 @@ declare namespace Awesomplete {
minChars?: number;
maxItems?: number;
autoFirst?: boolean;
data?: (item: Suggestion, input: string) => string;
filter?: (text: string, input: string) => boolean;
sort?: (left: number | any[], right: number | any[]) => number;
item?: (text: string, input: string) => HTMLElement;
replace?: (text: string) => void;
data?(item: Suggestion, input: string): string;
filter?(text: string, input: string): boolean;
sort?(left: number | any[], right: number | any[]): number;
item?(text: string, input: string): HTMLElement;
replace?(text: string): void;
}
}

View File

@@ -4,7 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface BabelCodeFrameOptions {
/** Syntax highlight the code as JavaScript for terminals. default: false*/
/** Syntax highlight the code as JavaScript for terminals. default: false */
highlightCode?: boolean;
/** The number of lines to show above the error. default: 2 */
linesBelow?: number;

View File

@@ -22,4 +22,4 @@ export function encode(input: string): string;
* with atob() as described in the HTML Standard.
* see: https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-atob
*/
export function decode(input: string): string;
export function decode(input: string): string;

View File

@@ -1,9 +1,9 @@
import BigInteger = require('bigi');
var b1 = BigInteger.fromHex("188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012");
var b2 = BigInteger.fromHex("07192B95FFC8DA78631011ED6B24CDD573F977A11E794811");
const b1 = BigInteger.fromHex("188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012");
const b2 = BigInteger.fromHex("07192B95FFC8DA78631011ED6B24CDD573F977A11E794811");
var b3 = b1.multiply(b2);
const b3 = b1.multiply(b2);
console.log(b3.toHex());
// => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132
// => ae499bfe762edfb416d0ce71447af67ff33d1760cbebd70874be1d7a5564b0439a59808cb1856a91974f7023f72132

View File

@@ -1,5 +1,5 @@
var x: BigNumber.BigNumber = new BigNumber(9);
var y = new BigNumber(x);
let x: BigNumber.BigNumber = new BigNumber(9);
let y = new BigNumber(x);
BigNumber(435.345);
@@ -27,7 +27,7 @@ new BigNumber(1.23456789);
new BigNumber(1.23456789, 10);
BigNumber.config({ DECIMAL_PLACES: 5 });
var BN = BigNumber.another({ DECIMAL_PLACES: 9 });
let BN = BigNumber.another({ DECIMAL_PLACES: 9 });
x = new BigNumber(1);
y = new BN(1);
@@ -112,14 +112,14 @@ BigNumber.config({
BigNumber.config(40, 7, [-10, 20], 500, 1, 1, 3, 80);
var obj = BigNumber.config();
const obj = BigNumber.config();
obj.ERRORS;
obj.RANGE;
x = new BigNumber('3257869345.0378653');
BigNumber.max(4e9, x, '123456789.9');
var arr = [12, '13', new BigNumber(14)];
let arr = [12, '13', new BigNumber(14)];
BigNumber.max(arr);
x = new BigNumber('3257869345.0378653');
@@ -137,7 +137,7 @@ BigNumber.config({ ROUNDING_MODE: 2 });
x = new BigNumber(-0.8);
y = x.absoluteValue();
var z = y.abs();
let z = y.abs();
x = new BigNumber(1.3);
x.ceil();
@@ -300,7 +300,7 @@ y.toFixed(2);
y.toFixed(2, 1);
y.toFixed(5);
var format = {
const format = {
decimalSeparator: '.',
groupSeparator: ',',
groupSize: 3,
@@ -332,7 +332,7 @@ x.toFormat(6);
x = new BigNumber(1.75);
x.toFraction();
var pi = new BigNumber('3.14159265358');
const pi = new BigNumber('3.14159265358');
pi.toFraction();
pi.toFraction(100000);
pi.toFraction(10000);
@@ -344,7 +344,7 @@ x = new BigNumber('177.7e+457');
y = new BigNumber(235.4325);
z = new BigNumber('0.0098074');
var str = JSON.stringify([x, y, z]);
const str = JSON.stringify([x, y, z]);
JSON.parse(str, (key, val) => key === '' ? val : new BigNumber(val));

View File

@@ -673,4 +673,4 @@ declare namespace BigNumber {
*/
isBigNumber: true;
}
}
}

View File

@@ -3,9 +3,9 @@
import bigi = require('bigi');
import bitcoin = require('bitcoinjs-lib');
declare var it: any;
declare var describe: any;
declare var assert: any;
declare const it: any;
declare const describe: any;
declare const assert: any;
describe('bitcoinjs-lib (basic)', () => {
it('can generate a random bitcoin address', () => {
@@ -13,18 +13,18 @@ describe('bitcoinjs-lib (basic)', () => {
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
// generate random keyPair
var keyPair = bitcoin.ECPair.makeRandom({ rng });
var address = keyPair.getAddress();
const keyPair = bitcoin.ECPair.makeRandom({ rng });
const address = keyPair.getAddress();
assert.strictEqual(address, '1F5VhMHukdnUES9kfXqzPzMeF1GPHKiF64');
});
it('can generate an address from a SHA256 hash', () => {
var hash = bitcoin.crypto.sha256('correct horse battery staple');
var d = bigi.fromBuffer(hash);
const hash = bitcoin.crypto.sha256('correct horse battery staple');
const d = bigi.fromBuffer(hash);
var keyPair = new bitcoin.ECPair(d);
var address = keyPair.getAddress();
const keyPair = new bitcoin.ECPair(d);
const address = keyPair.getAddress();
assert.strictEqual(address, '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8');
});
@@ -33,26 +33,26 @@ describe('bitcoinjs-lib (basic)', () => {
// for testing only
function rng() { return new Buffer('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz'); }
var litecoin = bitcoin.networks.litecoin;
const litecoin = bitcoin.networks.litecoin;
var keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng });
var wif = keyPair.toWIF();
var address = keyPair.getAddress();
const keyPair = bitcoin.ECPair.makeRandom({ network: litecoin, rng });
const wif = keyPair.toWIF();
const address = keyPair.getAddress();
assert.strictEqual(address, 'LZJSxZbjqJ2XVEquqfqHg1RQTDdfST5PTn');
assert.strictEqual(wif, 'T7A4PUSgTDHecBxW1ZiYFrDNRih2o7M8Gf9xpoCgudPF9gDiNvuS');
});
it('can import an address via WIF', () => {
var keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct');
var address = keyPair.getAddress();
const keyPair = bitcoin.ECPair.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct');
const address = keyPair.getAddress();
assert.strictEqual(address, '19AAjaTUbRjQCMuVczepkoPswiZRhjtg31');
});
it('can create a Transaction', () => {
var keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
var tx = new bitcoin.TransactionBuilder();
const keyPair = bitcoin.ECPair.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy');
const tx = new bitcoin.TransactionBuilder();
tx.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0);
tx.addOutput('1Gokm82v6DmtwKEB8AiVhm82hyFSsEvBDK', 15000);

View File

@@ -7,7 +7,7 @@ class TestExtension implements Protocol.Extension {
}
net.createServer(socket => {
var wire = new Protocol();
const wire = new Protocol();
wire.use(TestExtension);

View File

@@ -10,30 +10,30 @@ import * as stream from 'stream';
declare const BittorrentProtocol: BittorrentProtocol.BittorrentProtocol;
declare namespace BittorrentProtocol {
export interface BittorrentProtocol {
interface BittorrentProtocol {
new (): Wire;
(): Wire;
}
export interface ExtensionConstructor {
interface ExtensionConstructor {
new (wire: Wire): Extension;
}
export interface Extension {
onHandshake?: (infoHash: string, peerId: string, extensions: { [name: string]: boolean }) => void;
onExtendedHandshake?: (handshake: { [key: string]: any }) => void;
onMessage?: (buf: Buffer) => void;
interface Extension {
onHandshake?(infoHash: string, peerId: string, extensions: { [name: string]: boolean }): void;
onExtendedHandshake?(handshake: { [key: string]: any }): void;
onMessage?(buf: Buffer): void;
name: string;
}
export interface Request {
interface Request {
piece: number;
offset: number;
length: number;
callback: () => void;
callback(): void;
}
export interface Wire extends stream.Duplex {
interface Wire extends stream.Duplex {
readonly peerId: string; // remote peer id (hex string)
readonly peerIdBuffer: Buffer; // remote peer id (Buffer)
readonly type: 'webrtc' | 'tcpIncoming' | 'tcpOutgoing' | 'webSeed'; // connection type

View File

@@ -1,4 +1,4 @@
var someInput = { a: 1, b: 2, c: 3 };
const someInput = { a: 1, b: 2, c: 3 };
import blacklist = require('blacklist');
@@ -10,4 +10,4 @@ blacklist(someInput, {
b: false, // b will be in the result
c: 1 > 2 // false, therefore c will be in the result
});
// => { b: 2, c: 3 }
// => { b: 2, c: 3 }

View File

@@ -17,11 +17,11 @@ declare namespace bodyParser {
inflate?: boolean;
limit?: number | string;
type?: string | string[] | ((req: Request) => any);
verify?: (req: Request, res: Response, buf: Buffer, encoding: string) => void;
verify?(req: Request, res: Response, buf: Buffer, encoding: string): void;
}
interface OptionsJson extends Options {
reviever?: (key: string, value: any) => any;
reviever?(key: string, value: any): any;
strict?: boolean;
}

View File

@@ -157,7 +157,7 @@ function inputParser(inputDate: string | Date | moment.Moment) {
return moment();
}
}
};
}
function test_parseInputDate() {
let undef: undefined;

View File

@@ -19,11 +19,11 @@ export as namespace BootstrapV3DatetimePicker;
type InputParser = (input: string | Date | moment.Moment) => moment.Moment;
export interface Datetimepicker {
/**Clears the datepicker by setting the value to null */
/** Clears the datepicker by setting the value to null */
clear(): void;
/**Returns the component's model current date, a moment object or null if not set. */
/** Returns the component's model current date, a moment object or null if not set. */
date(): moment.Moment;
/**Takes string, Date, moment, null parameter and sets the components model current moment to it.
/** Takes string, Date, moment, null parameter and sets the components model current moment to it.
* Passing a null value unsets the components model current moment.
* Parsing of the newDate parameter is made using moment library with the options.format and options.useStrict components configuration.
* Throws:
@@ -33,32 +33,34 @@ export interface Datetimepicker {
* - dp.change - In case newDate is different from current moment
*/
date(date: moment.Moment | Date | string | null): void;
/**Destroys the widget and removes all attached event listeners */
/** Destroys the widget and removes all attached event listeners */
destroy(): void;
/**Disables the input element, the component is attached to, by adding a disabled="true" attribute to it. If the widget was visible before that call it is hidden.
/** Disables the input element, the component is attached to, by adding a disabled="true" attribute to it. If the widget was visible before that call it is hidden.
* Emits:
* - dp.hide - if the widget was visible before that call
*/
disable(): void;
/**Enables the input element, the component is attached to, by removing disabled attribute from it. */
/** Enables the input element, the component is attached to, by removing disabled attribute from it. */
enable(): void;
/**Hides the widget
/** Hides the widget
* Emits:
* - dp.hide - if the widget was visible before that call
*/
hide(): void;
/**Returns the components current options object.
* Note that the changing the values of the returned object does not change the components actual configuration. */
/**
* Returns the components current options object.
* Note that the changing the values of the returned object does not change the components actual configuration.
*/
options(): DatetimepickerOptions;
/**Takes an object variable with option key:value properties and configures the component. Use this to update multiple options on the component. */
/** Takes an object variable with option key:value properties and configures the component. Use this to update multiple options on the component. */
options(options: DatetimepickerOptions): void;
/**Shows the widget
/** Shows the widget
* Emits:
* - dp.show - if the widget was hidden before that call
* - dp.change - if the widget is opened for the first time and the useCurrent is set to true or to a granularity value and the input element the component is attached to has an empty value
*/
show(): void;
/**Shows or hides the widget
/** Shows or hides the widget
* Emits:
* - dp.hide - if the widget is hidden after the toggle call
* - dp.show - if the widget is show after the toggle call
@@ -70,97 +72,108 @@ export interface Datetimepicker {
//// Below are the getters/setters for the properties of the 'options(): DatetimepickerOptions' ////
////////////////////////////////////////////////////////////////////////////////////////////////////
/**Returns the options.allowInputToggle option. */
/** Returns the options.allowInputToggle option. */
allowInputToggle(): boolean;
/**If true, the picker will show on textbox focus and icon click when used in a button group */
/** If true, the picker will show on textbox focus and icon click when used in a button group */
allowInputToggle(value: boolean): void;
/**Returns the current options.calendarWeeks option configuration */
/** Returns the current options.calendarWeeks option configuration */
calendarWeeks(): boolean;
/**Set if the week numbers will appear to the left on the days view */
/** Set if the week numbers will appear to the left on the days view */
calendarWeeks(value: boolean): void;
/**Returns the options.collapse option configuration */
/** Returns the options.collapse option configuration */
collapse(): boolean;
/**If set to false the picker will display similar to sideBySide except vertical. */
/** If set to false the picker will display similar to sideBySide except vertical. */
collapse(value: boolean): void;
/**Returns the options.daysOfWeekDisabled configuration
/**
* Returns the options.daysOfWeekDisabled configuration
* IMPORTANT! Throws exception if not set explicitly https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1459
*/
*/
daysOfWeekDisabled(): number[];
/**Takes an [ Number:0 to 6 ] and disallow the user to select weekdays that exist in this array.
/** Takes an [ Number:0 to 6 ] and disallow the user to select weekdays that exist in this array.
* This has lower priority over the options.minDate, options.maxDate, options.disabledDates and options.enabledDates configuration settings.
* Emits:
* - dp.change - if the currently selected moment falls in the values passed on the daysOfWeek parameter.
* - dp.error - if the currently selected moment falls in the values passed on the daysOfWeek parameter.
*/
daysOfWeekDisabled(days: number[]): void;
/**Returns the options.dayViewHeaderFormat option. */
/** Returns the options.dayViewHeaderFormat option. */
dayViewHeaderFormat(): string;
/**Used to customize the header of the day view. */
/** Used to customize the header of the day view. */
dayViewHeaderFormat(value: string): void;
/**Returns a moment with the options.defaultDate option configuration or false if not set */
/** Returns a moment with the options.defaultDate option configuration or false if not set */
defaultDate(): moment.Moment | boolean;
/**Will set the picker's inital date.
/**
* Will set the picker's inital date.
* If a boolean:false value is passed the options.defaultDate parameter is cleared.
* Throws:
* - TypeError - if the provided date doesn't pass validation, including disabledDates, enabledDates, minDate, maxDate, and daysOfWeekDisabled
* - TypeError - if the provided date cannot be parsed by momentjs
*/
defaultDate(date: string | Date | moment.Moment | boolean): void;
/**Returns the options.disabledDates option.
/**
* Returns the options.disabledDates option.
* NOTES: probably should be: disabledDates(): boolean | Array<moment.Moment>; see: DatetimepickerOptions
*/
*/
disabledDates(): boolean | any;
/**Takes an array of values and disallows the user to select those days.
/**
* Takes an array of values and disallows the user to select those days.
* Setting this takes precedence over options.minDate, options.maxDate configuration.
* Also calling this function removes the configuration of options.enabledDates if such exist.
* Note: These values are matched with Day granularity.
*/
disabledDates(dates: boolean | Array<string | Date | moment.Moment>): void;
/**Returns the options.disabledHours option.
/**
* Returns the options.disabledHours option.
* NOTES: probably should be: disabledHours(): boolean | number[]; see: DatetimepickerOptions
*/
*/
disabledHours(): boolean | any;
/**Must be in 24 hour format. Will disallow hour selections (much like disabledTimeIntervals) but will affect all days.
* Like en/disabledDates, the en/disabledHours options are mutually exclusive and will reset one of the options back to false. */
/**
* Must be in 24 hour format. Will disallow hour selections (much like disabledTimeIntervals) but will affect all days.
* Like en/disabledDates, the en/disabledHours options are mutually exclusive and will reset one of the options back to false.
*/
disabledHours(value: boolean | number[]): void;
/**Returns the options.disabledTimeIntervals option, or... not exactly
/** Returns the options.disabledTimeIntervals option, or... not exactly
* IMPORTANT! Creates an object from the options.disabledTimeIntervals with the keys being numbers, the values being the moment arrays.
* eg { "0": [<moment.Moment1>, <moment.Moment2>], "1": [...] }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1498
*/
disabledTimeIntervals(): boolean | moment.Moment[][];
/**Disables time selection between the given moments
/** Disables time selection between the given moments
* eg: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]]
*/
disabledTimeIntervals(value: boolean | moment.Moment[][]): void;
/**Returns the options.enabledDates option
/**
* Returns the options.enabledDates option
* NOTES: probably should be: enabledDates(): boolean | Array<moment.Moment>; see: DatetimepickerOptions
*/
*/
enabledDates(): boolean | any;
/**Takes an array of values and allows the user to select only from those days.
/** Takes an array of values and allows the user to select only from those days.
* Setting this takes precedence over options.minDate, options.maxDate configuration.
* Also calling this function removes the configuration of options.disabledDates if such exist.
* Note: These values are matched with Day granularity.
*/
enabledDates(dates: boolean | Array<string | Date | moment.Moment>): void;
/**Returns the options.enabledHours option.
/**
* Returns the options.enabledHours option.
* NOTES: probably should be: enabledHours(): boolean | number[]; see: DatetimepickerOptions
*/
*/
enabledHours(): boolean | any;
/**Must be in 24 hour format. Will allow hour selections (much like enabledTimeIntervals) but will affect all days.
* Like en/disabledDates, the en/disabledHours options are mutually exclusive and will reset one of the options back to false. */
/**
* Must be in 24 hour format. Will allow hour selections (much like enabledTimeIntervals) but will affect all days.
* Like en/disabledDates, the en/disabledHours options are mutually exclusive and will reset one of the options back to false.
*/
enabledHours(value: boolean | number[]): void;
/**Returns a boolean or array with the options.extraFormats option configuration */
/** Returns a boolean or array with the options.extraFormats option configuration */
extraFormats(): boolean | Array<string | moment.MomentBuiltinFormat>;
/**Takes an array of valid input moment format options, or boolean:false */
/** Takes an array of valid input moment format options, or boolean:false */
extraFormats(formats: boolean | Array<string | moment.MomentBuiltinFormat>): void;
/**Returns the options.focusOnShow option. */
/** Returns the options.focusOnShow option. */
focusOnShow(): boolean;
/**If false, the textbox will not be given focus when the picker is shown */
/** If false, the textbox will not be given focus when the picker is shown */
focusOnShow(value: boolean): void;
/**Returns the component's options.format string */
/** Returns the component's options.format string */
format(): boolean | string | moment.MomentBuiltinFormat;
/**Takes a moment.js format string and sets the components options.format.
/** Takes a moment.js format string and sets the components options.format.
* This is used for displaying and also for parsing input strings either from the input element the component is attached to or the date() function.
* The parameter can also be a boolean:false in which case the format is set to the locale's L LT.
* Note: this is also used to determine if the TimePicker sub component will display the hours in 12 or 24 format. (if "a" or "h" exists in the passed string then a 12 hour mode is set)
@@ -168,40 +181,41 @@ export interface Datetimepicker {
* - TypeError - if format is boolean:true
*/
format(format: boolean | string | moment.MomentBuiltinFormat): void;
/**Returns options.icons */
/** Returns options.icons */
icons(): Icons;
/**Takes an Object of strings.
/** Takes an Object of strings.
* Throws:
* - TypeError - if icons parameter is not an Object
*/
icons(icons: Icons): void;
/**Returns the options.ignoreReadonly option. */
/** Returns the options.ignoreReadonly option. */
ignoreReadonly(): boolean;
/**Set this to true to allow the picker to be used even if the input field is readonly. This will not bypass the disabled property */
/** Set this to true to allow the picker to be used even if the input field is readonly. This will not bypass the disabled property */
ignoreReadonly(value: boolean): void;
/**Returns the options.inline option. */
/** Returns the options.inline option. */
inline(): boolean;
/**Used to customize the header of the day view. */
/** Used to customize the header of the day view. */
inline(value: boolean): void;
/**Returns the options.keepInvalid option. */
/** Returns the options.keepInvalid option. */
keepInvalid(): boolean;
/**If true, invalid dates will not be reverted to a previous selection or changed. */
/** If true, invalid dates will not be reverted to a previous selection or changed. */
keepInvalid(value: boolean): void;
/**Returns a string variable with the currently set options.keyBinds option. */
/** Returns a string variable with the currently set options.keyBinds option. */
keyBinds(): any;
/**Allows for several keyBinding functions to be specified for ease of access or accessibility. For defaults see {@link http://eonasdan.github.io/bootstrap-datetimepicker/Options/#keybinds}.
*/
/**
* Allows for several keyBinding functions to be specified for ease of access or accessibility. For defaults see {@link http://eonasdan.github.io/bootstrap-datetimepicker/Options/#keybinds}.
*/
keyBinds(value: any): void;
/**Returns the currently set locale of the options.locale */
/** Returns the currently set locale of the options.locale */
locale(): string;
/**Takes a string of any valid moment locale e.g. de for German.
/** Takes a string of any valid moment locale e.g. de for German.
* Throws:
* - TypeError - if the locale is not loaded via a separate script or moment-with-locale
*/
locale(newLocale: string): void;
/**Returns the currently set moment of the options.maxDate or false if not set */
/** Returns the currently set moment of the options.maxDate or false if not set */
maxDate(): moment.Moment | boolean;
/**Takes a parameter and disallows the user to select a moment that is after that moment.
/** Takes a parameter and disallows the user to select a moment that is after that moment.
* If a boolean:false value is passed options.maxDate is cleared and there is no restriction to the maximum moment the user can select.
* Note: If the parameter is before the currently selected moment the currently selected moment changes to maxDate
* Throws:
@@ -213,9 +227,9 @@ export interface Datetimepicker {
* - dp.error - if the new maxDate is after currently selected moment
*/
maxDate(date: moment.Moment | Date | string | boolean): void;
/**Returns the currently set moment of the options.minDate or false if not set */
/** Returns the currently set moment of the options.minDate or false if not set */
minDate(): moment.Moment | boolean;
/**Takes a parameter and disallows the user to select a moment that is before that moment.
/** Takes a parameter and disallows the user to select a moment that is before that moment.
* If a boolean:false value is passed the options.minDate parameter is cleared and there is no restriction to the miminum moment the user can select.
* Note: If the parameter is after the currently selected moment the currently selected moment changes to minDate parameter
* Throws:
@@ -227,31 +241,31 @@ export interface Datetimepicker {
* - dp.error - if the new minDate is after currently selected moment
*/
minDate(date: moment.Moment | Date | string | boolean): void;
/**Returns the options.parseInputDate option */
/** Returns the options.parseInputDate option */
parseInputDate(): InputParser | undefined;
/**Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
/** Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
* {@link http://eonasdan.github.io/bootstrap-datetimepicker/Functions/#parseinputdate}
*/
parseInputDate(value: InputParser): void;
/**Returns the options.showClear option. */
/** Returns the options.showClear option. */
showClear(): boolean;
/**Set if the clear date button will appear on the widget */
/** Set if the clear date button will appear on the widget */
showClear(value: boolean): void;
/**Returns the options.showClose option. */
/** Returns the options.showClose option. */
showClose(): boolean;
/**If true, an icon will be displayed on the toolbar that will hide the picker */
/** If true, an icon will be displayed on the toolbar that will hide the picker */
showClose(value: boolean): void;
/**Returns the options.showTodayButton option. */
/** Returns the options.showTodayButton option. */
showTodayButton(): boolean;
/**Set if the Today button will appear on the widget */
/** Set if the Today button will appear on the widget */
showTodayButton(value: boolean): void;
/**Returns a boolean of the options.sideBySide. */
/** Returns a boolean of the options.sideBySide. */
sideBySide(): boolean;
/**If sideBySide is true and the time picker is used, both components will display side by side instead of collapsing. */
/** If sideBySide is true and the time picker is used, both components will display side by side instead of collapsing. */
sideBySide(value: boolean): void;
/**Returns a number with the options.stepping option configuration */
/** Returns a number with the options.stepping option configuration */
stepping(): number;
/**This will be the amount the up/down arrows move the minute value with a time picker. */
/** This will be the amount the up/down arrows move the minute value with a time picker. */
stepping(step: number): void;
/** Returns a string of options.timeZone */
timeZone(): string | null;
@@ -260,24 +274,24 @@ export interface Datetimepicker {
* - TypeError - if tooltips parameter is not a string or null
*/
timeZone(timeZone: string | null): void;
/**Returns the options.toolbarplacement option. */
/** Returns the options.toolbarplacement option. */
toolbarPlacement(): string;
/**Changes the placement of the toolbar where the today, clear, component switch icon are located.
/** Changes the placement of the toolbar where the today, clear, component switch icon are located.
* See valid values at DatetimepickerOptions.toolbarplacement
* Throws:
* - TypeError - if the parameter is not a valid value
*/
toolbarPlacement(value: string): void;
/**Returns the options.tooltips option */
/** Returns the options.tooltips option */
tooltips(): Tooltips;
/**Sets the tooltips for icons.
/** Sets the tooltips for icons.
* Throws:
* - TypeError - if tooltips parameter is not an Object
*/
tooltips(value: Tooltips): void;
/**Returns the options.useCurrent option configuration */
/** Returns the options.useCurrent option configuration */
useCurrent(): boolean | string;
/**Takes a boolean or string.
/** Takes a boolean or string.
* If a boolean true is passed and the components model moment is not set (either through setDate or through a valid value on the input element the component is attached to)
* then the first time the user opens the datetimepicker widget the value is initialized to the current moment of the action.
* If a false boolean is passed then no initialization happens on the input element.
@@ -287,28 +301,28 @@ export interface Datetimepicker {
* Note: If the options.defaultDate is set or the input element the component is attached to has already a value that takes precedence and the functionality of useCurrent is not triggered!
*/
useCurrent(value: boolean | string): void;
/**Returns the options.useStrict */
/** Returns the options.useStrict */
useStrict(): boolean;
/**If useStrict is true, momentjs parsing rules will be stricter when determining if a date is valid or not. */
/** If useStrict is true, momentjs parsing rules will be stricter when determining if a date is valid or not. */
useStrict(value: boolean): void;
/**Returns the options.viewDate option. */
/** Returns the options.viewDate option. */
viewDate(): boolean | moment.Moment;
/**This will change the viewDate without changing or setting the selected date. */
/** This will change the viewDate without changing or setting the selected date. */
viewDate(value: string | Date | moment.Moment | boolean): void;
/**Returns the options.viewMode. */
/** Returns the options.viewMode. */
viewMode(): string;
/**Takes a string. See valid values at DatetimepickerOptions.viewMode
/** Takes a string. See valid values at DatetimepickerOptions.viewMode
* Throws:
* - TypeError - if the parameter is not a string or not a valid value
*/
viewMode(value: string): void;
/**Returns a $(element) variable with the currently set options.widgetParent option. */
/** Returns a $(element) variable with the currently set options.widgetParent option. */
widgetParent(): string | JQuery | null;
/**Takes a string or $(element) value. */
/** Takes a string or $(element) value. */
widgetParent(widgetParent: string | JQuery | null): void;
/**Returns the options.widgetPositioning object */
/** Returns the options.widgetPositioning object */
widgetPositioning(): WidgetPositioningOptions;
/**WidgetPositioning defines where the dropdown with the widget will appear relative to the input element the component is attached to.
/** WidgetPositioning defines where the dropdown with the widget will appear relative to the input element the component is attached to.
* "auto" is the default value for both horizontal and vertical keys and it tries to automatically place the dropdown in a position that is visible to the user.
* Usually you should not override those options unless you have a special need in your layout.
*/
@@ -316,91 +330,91 @@ export interface Datetimepicker {
}
export interface DatetimepickerOptions {
/**If true, the picker will show on textbox focus and icon click when used in a button group
/** If true, the picker will show on textbox focus and icon click when used in a button group
* @default: false
*/
allowInputToggle?: boolean;
/**Shows the week of the year to the left of first day of the week.
/** Shows the week of the year to the left of first day of the week.
* @default: false
*/
calendarWeeks?: boolean;
/**Using a Bootstraps collapse to switch between date/time pickers.
/** Using a Bootstraps collapse to switch between date/time pickers.
* @default: true
*/
collapse?: boolean;
/**Disables the section of days of the week, e.g. weekends.
/** Disables the section of days of the week, e.g. weekends.
* Accepts: array of numbers from 0-6
* @default: false
*/
daysOfWeekDisabled?: number[] | boolean;
/**Changes the heading of the datepicker when in "days" view.
/** Changes the heading of the datepicker when in "days" view.
* @default: "MMMM YYYY"
*/
dayViewHeaderFormat?: string;
/**Will cause the date picker to stay open after a blur event.
/** Will cause the date picker to stay open after a blur event.
* @default: false
*/
debug?: boolean;
/**Sets the picker default date/time. Overrides useCurrent
/** Sets the picker default date/time. Overrides useCurrent
* @default: false
*/
defaultDate?: boolean | moment.Moment | Date | string;
/**Disables selection of dates in the array, e.g. holidays
/** Disables selection of dates in the array, e.g. holidays
* @default: false
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the dates, values being true.
* eg disabledDates = ["2010-10-10"]; -> disabledDated will be { "2010-01-01": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
disabledDates?: boolean | Array<moment.Moment | Date | string> | any;
/**Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
/** Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
* @default: false
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the hours, values being true.
* eg disabledHours = [0, 1]; -> disabledHours will be { "0": true, "1": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
disabledHours?: boolean | number[] | any;
/**Disables time selection between the given moments
/** Disables time selection between the given moments
* eg: [[moment({ h: 0 }), moment({ h: 8 })], [moment({ h: 18 }), moment({ h: 24 })]]
* @default: false
*/
disabledTimeIntervals?: boolean | moment.Moment[][];
/**Disables selection of dates NOT in the array, e.g. holidays
/** Disables selection of dates NOT in the array, e.g. holidays
* @default: false
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the dates, values being true.
* eg enabledDates = ["2010-10-10"]; -> enabledDated will be { "2010-01-01": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
enabledDates?: boolean | Array<moment.Moment | Date | string> | any;
/**Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
/** Will allow or disallow hour selections (much like disabledTimeIntervals) but will affect all days
* @default: false
* IMPORTANT! The getter returns an Object NOT an Array, with keys being the hours, values being true.
* eg enabledHours = [0, 1]; -> enabledHours will be { "0": true, "1": true }
* https://github.com/Eonasdan/bootstrap-datetimepicker/issues/1499
*/
enabledHours?: boolean | number[];
/**Allows for several input formats to be valid. See: https://github.com/Eonasdan/bootstrap-datetimepicker/pull/666
/** Allows for several input formats to be valid. See: https://github.com/Eonasdan/bootstrap-datetimepicker/pull/666
* @default: false
*/
extraFormats?: boolean | Array<string | moment.MomentBuiltinFormat>;
/**If false, the textbox will not be given focus when the picker is shown
/** If false, the textbox will not be given focus when the picker is shown
* @default: true
*/
focusOnShow?: boolean;
/**See momentjs' docs for valid formats. Format also dictates what components are shown, e.g. MM/dd/YYYY will not display the time picker.
/** See momentjs' docs for valid formats. Format also dictates what components are shown, e.g. MM/dd/YYYY will not display the time picker.
* @default: false
*/
format?: boolean | string | moment.MomentBuiltinFormat;
/**Change the default icons for the pickers functions. */
/** Change the default icons for the pickers functions. */
icons?: Icons;
/**Allow date picker show event to fire even when the associated input element has the readonly="readonly"property.
/** Allow date picker show event to fire even when the associated input element has the readonly="readonly"property.
* @default: false
*/
ignoreReadonly?: boolean;
/**Will display the picker inline without the need of a input field. This will also hide borders and shadows.
/** Will display the picker inline without the need of a input field. This will also hide borders and shadows.
* @default: false
*/
inline?: boolean;
/**Allows for custom events to fire on keyboard press.
/** Allows for custom events to fire on keyboard press.
* eg: keybinds: {
* up: (widget) => console.log(widget),
* "control up": (widget) => console.log(widget)
@@ -408,52 +422,52 @@ export interface DatetimepickerOptions {
* The widget parameter is false, if the datepicker is closed.
*/
keyBinds?: { [key: string]: (widget: boolean | JQuery) => void };
/**Will cause the date picker to not revert or overwrite invalid dates.
/** Will cause the date picker to not revert or overwrite invalid dates.
* @default: false
*/
keepInvalid?: boolean;
/**Will cause the date picker to stay open after selecting a date if no time components are being used.
/** Will cause the date picker to stay open after selecting a date if no time components are being used.
* @default: false
*/
keepOpen?: boolean;
/**See momentjs for valid locales. You must include moment-with-locales.js or a local js file.
/** See momentjs for valid locales. You must include moment-with-locales.js or a local js file.
* @default: moment.locale()
*/
locale?: string;
/**Prevents date/time selections after this date.
/** Prevents date/time selections after this date.
* maxDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected.
* @default: false
*/
maxDate?: boolean | moment.Moment | Date | string;
/**Prevents date/time selections before this date.
/** Prevents date/time selections before this date.
* minDate will override defaultDate and useCurrent if either of these settings are the same day since both options are invalid according to the rules you've selected.
* @default: false
*/
minDate?: boolean | moment.Moment | Date | string;
/**Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
/** Allows custom input formatting For example: the user can enter "yesterday"" or "30 days ago".
* {@link http://eonasdan.github.io/bootstrap-datetimepicker/Functions/#parseinputdate}
*/
parseInputDate?: InputParser;
/**Show the "Clear" button in the icon toolbar.
/** Show the "Clear" button in the icon toolbar.
* Clicking the "Clear" button will set the calendar to null.
* @default: false
*/
showClear?: boolean;
/**Show the "Close" button in the icon toolbar.
/** Show the "Close" button in the icon toolbar.
* Clicking the "Close" button will call hide()
* @default: false
*/
showClose?: boolean;
/**Show the "Today" button in the icon toolbar.
/** Show the "Today" button in the icon toolbar.
* Clicking the "Today" button will set the calendar view and set the date to now.
* @default: false
*/
showTodayButton?: boolean;
/**Shows the picker side by side when using the time and date together.
/** Shows the picker side by side when using the time and date together.
* @default: false
*/
sideBySide?: boolean;
/**Number of minutes the up/down arrow's will move the minutes value in the time picker
/** Number of minutes the up/down arrow's will move the minutes value in the time picker
* @default: 1
*/
stepping?: number;
@@ -462,30 +476,30 @@ export interface DatetimepickerOptions {
* @default: ""
*/
timeZone?: string | null;
/**Changes the placement of the icon toolbar.
/** Changes the placement of the icon toolbar.
* @default: "default"
*/
toolbarPlacement?: "default" | "top" | "bottom";
/**This will change the tooltips over each icon to a custom string */
/** This will change the tooltips over each icon to a custom string */
tooltips?: Tooltips;
/**On show, will set the picker to the current date/time
/** On show, will set the picker to the current date/time
* @default: true
*/
useCurrent?: boolean;
/**Defines if moment should use strict date parsing when considering a date to be valid
/** Defines if moment should use strict date parsing when considering a date to be valid
* @default: false
*/
useStrict?: boolean;
/**This will change the viewDate without changing or setting the selected date.
/** This will change the viewDate without changing or setting the selected date.
* @default: false
*/
viewDate?: boolean | moment.Moment | Date | string;
/**The default view to display when the picker is shown.
/** The default view to display when the picker is shown.
* Note: To limit the picker to selecting, for instance the year and month, use format: MM/YYYY
* @default: "days"
*/
viewMode?: "decades" | "years" | "months" | "days";
/**On picker show, places the widget at the identifier (string) or jQuery object if the element has css position: "relative"
/** On picker show, places the widget at the identifier (string) or jQuery object if the element has css position: "relative"
* @default: null
*/
widgetParent?: string | JQuery | null;
@@ -493,23 +507,23 @@ export interface DatetimepickerOptions {
}
export interface Icons {
/**default: "glyphicon glyphicon-trash" */
/** default: "glyphicon glyphicon-trash" */
clear?: string;
/**default: "glyphicon glyphicon-remove" */
/** default: "glyphicon glyphicon-remove" */
close?: string;
/**default: "glyphicon glyphicon-calendar" */
/** default: "glyphicon glyphicon-calendar" */
date?: string;
/**default: "glyphicon glyphicon-time" */
/** default: "glyphicon glyphicon-time" */
down?: string;
/**default: "glyphicon glyphicon-chevron-left" */
/** default: "glyphicon glyphicon-chevron-left" */
next?: string;
/**default: "glyphicon glyphicon-screenshot" */
/** default: "glyphicon glyphicon-screenshot" */
previous?: string;
/**default: "glyphicon glyphicon-chevron-right" */
/** default: "glyphicon glyphicon-chevron-right" */
time?: string;
/**default: "glyphicon glyphicon-chevron-down" */
/** default: "glyphicon glyphicon-chevron-down" */
today?: string;
/**default: "glyphicon glyphicon-chevron-up" */
/** default: "glyphicon glyphicon-chevron-up" */
up?: string;
}
@@ -551,14 +565,14 @@ export interface Event extends JQueryEventObject {
}
export interface ChangeEvent extends Event {
/**Previous date. False if the previous date is null. */
/** Previous date. False if the previous date is null. */
oldDate: moment.Moment | boolean;
}
export interface UpdateEvent extends JQueryEventObject {
/**Change type as a momentjs format token. e.g. yyyy on year change */
/** Change type as a momentjs format token. e.g. yyyy on year change */
change: string;
/**New viewDate. */
/** New viewDate. */
viewDate: moment.Moment;
}

View File

@@ -7,7 +7,7 @@
* @module braintree-web/american-express
* @description This module is for use with Amex Express Checkout. To accept American Express cards, use Hosted Fields.
*/
declare namespace BraintreeWeb {
declare namespace braintree {
export interface AmericanExpress {
/**
* @static
@@ -24,22 +24,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
}
/**
* @class
* @param {object} options Options
* @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/american-express.create|braintree.american-express.create} instead.</strong>
* @classdesc This class allows you use a nonce to interact with American Express Checkout. To accept American Express cards, use Hosted Fields.
*/
export class AmericanExpress {
/**
* @class
* @param {object} options Options
* @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/american-express.create|braintree.american-express.create} instead.</strong>
* @classdesc This class allows you use a nonce to interact with American Express Checkout. To accept American Express cards, use Hosted Fields.
*/
constructor(options: any);
/**
* Gets the rewards balance associated with a Braintree nonce.
@@ -63,7 +47,7 @@ declare namespace BraintreeWeb {
* });
* });
*/
public getRewardsBalance(options: { nonce: string }, callback: callback): void;
getRewardsBalance(options: { nonce: string }, callback: callback): void;
/**
* Gets the Express Checkout nonce profile given a nonce from American Express.
@@ -87,121 +71,123 @@ declare namespace BraintreeWeb {
* });
* });
*/
public getExpressCheckoutProfile(options: { nonce: string }, callback: callback): void;
getExpressCheckoutProfile(options: { nonce: string }, callback: callback): void;
}
}
// more info https://developer.apple.com/reference/applepayjs/1916082-applepay_js_data_types/paymentrequest
declare namespace braintree {
// more info https://developer.apple.com/reference/applepayjs/1916082-applepay_js_data_types/paymentrequest
// billingContact
// Billing contact information for the user.
// countryCode
//Required.The merchants two- letter ISO 3166 country code.
// currencyCode
// Required.The three- letter ISO 4217 currency code for the payment.
// lineItems
//A set of line items that explain recurring payments and additional charges.
// merchantCapabilities
// Required.The payment capabilities supported by the merchant.The value must be one or more of supports3DS, supportsEMV, supportsCredit, or supportsDebit.
// requiredBillingContactFields
// The billing information that is required from the user.The value must be one or more of postalAddress, phone, email, or name.
// requiredShippingContactFields
// The shipping information that is required from the user.The value must be one or more of postalAddress, phone, email, or name.
// shippingContact
// Shipping contact information for the user.
// shippingMethods
//A set of available shipping methods.Totals for all shipping methods must be non- negative to pass validation.
// shippingType
// How the items are to be shipped.This property is optional.If specified, it must be one or more of shipping, delivery, storePickup, or servicePickup.The default value is shipping.
// supportedNetworks
// Required.The payment networks supported by the merchant.The value must be one or more of amex, discover, interac, masterCard, privateLabel, or visa.
// total
// Required.The total amount for the payment.The total must be greater than zero and have a label to pass validation.
interface ApplePayPaymentRequest {
total: {
label: string;
amount: string;
};
countryCode: string;
currencyCode: string;
supportedNetworks: string[];
merchantCapabilities: string[];
// billingContact
// Billing contact information for the user.
// countryCode
//Required.The merchants two- letter ISO 3166 country code.
// currencyCode
// Required.The three- letter ISO 4217 currency code for the payment.
// lineItems
//A set of line items that explain recurring payments and additional charges.
// merchantCapabilities
// Required.The payment capabilities supported by the merchant.The value must be one or more of supports3DS, supportsEMV, supportsCredit, or supportsDebit.
// requiredBillingContactFields
// The billing information that is required from the user.The value must be one or more of postalAddress, phone, email, or name.
// requiredShippingContactFields
// The shipping information that is required from the user.The value must be one or more of postalAddress, phone, email, or name.
// shippingContact
// Shipping contact information for the user.
// shippingMethods
//A set of available shipping methods.Totals for all shipping methods must be non- negative to pass validation.
// shippingType
// How the items are to be shipped.This property is optional.If specified, it must be one or more of shipping, delivery, storePickup, or servicePickup.The default value is shipping.
// supportedNetworks
// Required.The payment networks supported by the merchant.The value must be one or more of amex, discover, interac, masterCard, privateLabel, or visa.
// total
// Required.The total amount for the payment.The total must be greater than zero and have a label to pass validation.
interface ApplePayPaymentRequest {
total: {
label: string;
amount: string;
};
countryCode: string;
currencyCode: string;
supportedNetworks: string[];
merchantCapabilities: string[];
billingContact?: any;
shippingContact?: any;
shippingMethods?: any;
shippingType?: any;
requiredBillingContactFields?: any;
requiredShippingContactFields?: any;
}
billingContact?: any;
shippingContact?: any;
shippingMethods?: any;
shippingType?: any;
requiredBillingContactFields?: any;
requiredShippingContactFields?: any;
}
declare enum ApplePayStatusCodes {
// The requested action succeeded.
STATUS_SUCCESS = 1,
// The requested action failed.
STATUS_FAILURE,
// The billing address is not valid.
STATUS_INVALID_BILLING_POSTAL_ADDRESS,
// The shipping address is not valid.
STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,
// The shipping contact information is not valid.
STATUS_INVALID_SHIPPING_CONTACT,
// The required PIN information was not provided. Cards on the China Union Pay payment network may require a PIN to authenticate the transaction.
STATUS_PIN_REQUIRED,
// The PIN information is not valid.Cards on the China Union Pay network may require a PIN.
STATUS_PIN_INCORRECT,
// The maximum number of tries for a PIN has been reached and the user has been locked out. Cards on the China Union Pay network may require a PIN.
STATUS_PIN_LOCKOUT,
}
export enum ApplePayStatusCodes {
// The requested action succeeded.
STATUS_SUCCESS = 1,
// The requested action failed.
STATUS_FAILURE,
// The billing address is not valid.
STATUS_INVALID_BILLING_POSTAL_ADDRESS,
// The shipping address is not valid.
STATUS_INVALID_SHIPPING_POSTAL_ADDRESS,
// The shipping contact information is not valid.
STATUS_INVALID_SHIPPING_CONTACT,
// The required PIN information was not provided. Cards on the China Union Pay payment network may require a PIN to authenticate the transaction.
STATUS_PIN_REQUIRED,
// The PIN information is not valid.Cards on the China Union Pay network may require a PIN.
STATUS_PIN_INCORRECT,
// The maximum number of tries for a PIN has been reached and the user has been locked out. Cards on the China Union Pay network may require a PIN.
STATUS_PIN_LOCKOUT,
}
interface ApplePayPayload {
merchantIdentifier: string;
domainName: string;
displayName: string;
}
interface ApplePayPayload {
merchantIdentifier: string;
domainName: string;
displayName: string;
}
declare class ApplePaySession {
constructor(version: number, request: ApplePayPaymentRequest);
export class ApplePaySession {
constructor(version: number, request: ApplePayPaymentRequest);
canMakePayments(): boolean;
canMakePayments(): boolean;
canMakePaymentsWithActiveCard(merchantIdentifier: string): boolean;
canMakePaymentsWithActiveCard(merchantIdentifier: string): boolean;
completeMerchantValidation(merchantSession: any): void;
completeMerchantValidation(merchantSession: any): void;
abort(): void;
abort(): void;
begin(): void;
begin(): void;
completePayment(status: ApplePayStatusCodes): void;
completePayment(status: ApplePayStatusCodes): void;
completePaymentMethodSelection(newTotal: any, newLineItems: any): void;
completePaymentMethodSelection(newTotal: any, newLineItems: any): void;
completeShippingContactSelection(status: ApplePayStatusCodes, newShippingMethods: any, newTotal: any, newLineItems: any): void;
completeShippingContactSelection(status: ApplePayStatusCodes, newShippingMethods: any, newTotal: any, newLineItems: any): void;
completeShippingMethodSelection(status: ApplePayStatusCodes, newTotal: any, newLineItems: any): void;
completeShippingMethodSelection(status: ApplePayStatusCodes, newTotal: any, newLineItems: any): void;
supportsVersion(version: number): boolean;
supportsVersion(version: number): boolean;
oncancel: (event: any) => void;
oncancel: (event: any) => void;
onpaymentauthorized: (event: any) => void;
onpaymentauthorized: (event: any) => void;
onpaymentmethodselected: (event: any) => void;
onpaymentmethodselected: (event: any) => void;
onshippingcontactselected: (event: any) => void;
onshippingcontactselected: (event: any) => void;
onshippingmethodselected: (event: any) => void;
onshippingmethodselected: (event: any) => void;
onvalidatemerchant: (event: any) => void;
onvalidatemerchant: (event: any) => void;
}
}
/**
* @module braintree-web/apple-pay
* @description Accept Apple Pay on the Web. *This component is currently in beta and is subject to change.*
*/
declare namespace BraintreeWeb {
declare namespace braintree {
export interface ApplePay {
/**
* @static
@@ -218,22 +204,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
}
/**
* @class
* @param {object} options Options
* @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/apple-pay.create|braintree.apple-pay.create} instead.</strong>
* @classdesc This class represents an Apple Pay component. Instances of this class have methods for validating the merchant server and tokenizing payments.
*/
export class ApplePay {
/**
* @class
* @param {object} options Options
* @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/apple-pay.create|braintree.apple-pay.create} instead.</strong>
* @classdesc This class represents an Apple Pay component. Instances of this class have methods for validating the merchant server and tokenizing payments.
*/
constructor(options: any);
/**
* Merges a payment request with Braintree defaults
@@ -260,7 +230,7 @@ declare namespace BraintreeWeb {
* // { total: { }, countryCode: 'US', currencyCode: 'USD', merchantCapabilities: [ ], supportedNetworks: [ ] }
*
*/
public createPaymentRequest(paymentRequest: ApplePayPaymentRequest): ApplePayPaymentRequest
createPaymentRequest(paymentRequest: ApplePayPaymentRequest): ApplePayPaymentRequest
/**
* Validates the merchant website, as required by ApplePaySession before payment can be authorized.
@@ -302,7 +272,7 @@ declare namespace BraintreeWeb {
* };
* });
*/
public performValidation(options: { validationURL: string, displayName?: string, merchantIdentifier?: string }, callback: callback): void;
performValidation(options: { validationURL: string, displayName?: string, merchantIdentifier?: string }, callback: callback): void;
/**
* Tokenizes an Apple Pay payment.
@@ -332,16 +302,14 @@ declare namespace BraintreeWeb {
* };
* });
*/
public tokenize(options: { token: any }, callback: callback): void;
tokenize(options: { token: any }, callback: callback): void;
}
}
/** @module braintree-web/client */
declare namespace BraintreeWeb {
declare namespace braintree {
/**
* This object is returned by {@link Client#getConfiguration|getConfiguration}. This information is used extensively by other Braintree modules to properly configure themselves.
* @typedef {object} Client~configuration
* @property {object} client The braintree-web/client parameters.
* @property {string} client.authorization A tokenizationKey or clientToken.
* @property {object} gatewayConfiguration Gateway-supplied configuration.
@@ -398,30 +366,13 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
}
/**
* @class
* @param {Client~configuration} configuration Options
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/client.create|braintree.client.create} instead.</strong>
* @classdesc This class is required by many other Braintree components. It serves as the base API layer that communicates with our servers. It is also capable of being used to formulate direct calls to our servers, such as direct credit card tokenization. See {@link Client#request}.
*/
export class Client {
/**
* @class
* @param {Client~configuration} configuration Options
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/client.create|braintree.client.create} instead.</strong>
* @classdesc This class is required by many other Braintree components. It serves as the base API layer that communicates with our servers. It is also capable of being used to formulate direct calls to our servers, such as direct credit card tokenization. See {@link Client#request}.
*/
constructor(configuration: Configuration);
/**
* Returns a copy of the configuration values.
* @public
* @returns {Client~configuration} configuration
*/
public getConfiguration(): Configuration;
getConfiguration(): Configuration;
/**
* Used by other modules to formulate all network requests to the Braintree gateway. It is also capable of being used directly from your own form to tokenize credit card information. However, be sure to satisfy PCI compliance if you use direct card tokenization.
@@ -470,13 +421,12 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
public request(options: { method: string, endpoint: string, data: any, timeout?: number }, callback: callback): void;
request(options: { method: string, endpoint: string, data: any, timeout?: number }, callback: callback): void;
}
}
/** @module braintree-web/data-collector */
declare namespace BraintreeWeb {
declare namespace braintree {
export interface DataCollector {
/**
* @static
@@ -496,24 +446,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
}
/**
* @class
* @global
* @name DataCollector
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/data-collector.create|braintree-web.data-collector.create} instead.</strong>
* @classdesc This class is used for advanced fraud integration with PayPal and Kount. Instances of this class have {@link DataCollector#deviceData|deviceData} which is used to correlate user sessions with server transactions. Before using DataCollector, make sure you have enabled advanced fraud protection in the Braintree gateway. To use your own Kount ID, contact our support team ([support@braintreepayments.com](mailto:support@braintreepayments.com) or [877.434.2894](tel:877.434.2894)).
*/
export class DataCollector {
/**
* @class
* @global
* @name DataCollector
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/data-collector.create|braintree-web.data-collector.create} instead.</strong>
* @classdesc This class is used for advanced fraud integration with PayPal and Kount. Instances of this class have {@link DataCollector#deviceData|deviceData} which is used to correlate user sessions with server transactions.
*/
constructor();
/**
* @memberof DataCollector
@@ -534,12 +466,11 @@ declare namespace BraintreeWeb {
* @returns {void}
*/
teardown(callback?: callback): void;
}
}
/** @module braintree-web/hosted-fields */
declare namespace BraintreeWeb {
declare namespace braintree {
/**
* Fields used in {@link module:braintree-web/hosted-fields~fieldOptions fields options}
* @typedef {object} field
@@ -578,7 +509,6 @@ declare namespace BraintreeWeb {
}
/**
* @typedef {object} HostedFields~hostedFieldsCard
* @description Information about the card type, sent in {@link HostedFields~stateObject|stateObjects}.
* @property {string} type The code-friendly representation of the card type. It will be one of the following strings:
* - `american-express`
@@ -618,7 +548,6 @@ declare namespace BraintreeWeb {
}
/**
* @typedef {object} HostedFields~hostedFieldsFieldData
* @description Data about Hosted Fields fields, sent in {@link HostedFields~stateObject|stateObjects}.
* @property {HTMLElement} container Reference to the container DOM element on your page associated with the current event.
* @property {boolean} isFocused Whether or not the input is currently focused.
@@ -641,7 +570,6 @@ declare namespace BraintreeWeb {
}
/**
* @typedef {object} HostedFields~stateObject
* @description The event payload sent from {@link HostedFields#on|on} or {@link HostedFields#getState|getState}.
* @property {HostedFields~hostedFieldsCard[]} cards
* This will return an array of potential {@link HostedFields~hostedFieldsCard|cards}. If the card type has been determined, the array will contain only one card.
@@ -679,7 +607,6 @@ declare namespace BraintreeWeb {
}
/**
* @typedef {object} HostedFields~tokenizePayload
* @property {string} nonce The payment method nonce.
* @property {object} details Additional account details.
* @property {string} details.cardType Type of card, ex: Visa, MasterCard.
@@ -781,22 +708,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
}
/**
* @class HostedFields
* @param {object} options The Hosted Fields {@link module:braintree-web/hosted-fields.create create} options.
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/hosted-fields.create|braintree-web.hosted-fields.create} instead.</strong>
* @classdesc This class represents a Hosted Fields component produced by {@link module:braintree-web/hosted-fields.create|braintree-web/hosted-fields.create}. Instances of this class have methods for interacting with the input fields within Hosted Fields' iframes.
*/
export class HostedFields {
/**
* @class HostedFields
* @param {object} options The Hosted Fields {@link module:braintree-web/hosted-fields.create create} options.
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/hosted-fields.create|braintree-web.hosted-fields.create} instead.</strong>
* @classdesc This class represents a Hosted Fields component produced by {@link module:braintree-web/hosted-fields.create|braintree-web/hosted-fields.create}. Instances of this class have methods for interacting with the input fields within Hosted Fields' iframes.
*/
constructor(options: any);
/**
* @name HostedFields#on
@@ -829,7 +740,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
public teardown(callback?: callback): void;
teardown(callback?: callback): void;
/**
* Tokenizes fields and returns a nonce payload.
@@ -872,7 +783,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
public tokenize(options?: { vault: boolean }, callback?: callback): void;
tokenize(options?: { vault: boolean }, callback?: callback): void;
/**
* Add a class to a {@link module:braintree-web/hosted-fields~field field}. Useful for updating field styles when events occur elsewhere in your checkout.
@@ -889,7 +800,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
public addClass(field: string, classname: string, callback?: callback): void;
addClass(field: string, classname: string, callback?: callback): void;
/**
* Removes a class to a {@link module:braintree-web/hosted-fields~field field}. Useful for updating field styles when events occur elsewhere in your checkout.
@@ -910,7 +821,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
public removeClass(field: string, classname: string, callback?: callback): void;
removeClass(field: string, classname: string, callback?: callback): void;
/**
* Sets the placeholder of a {@link module:braintree-web/hosted-fields~field field}.
@@ -940,7 +851,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
public setPlaceholder(field: string, placeholder: string, callback?: callback): void;
setPlaceholder(field: string, placeholder: string, callback?: callback): void;
/**
* Clear the value of a {@link module:braintree-web/hosted-fields~field field}.
@@ -960,7 +871,7 @@ declare namespace BraintreeWeb {
* hostedFieldsInstance.clear('cvv');
* hostedFieldsInstance.clear('expirationDate');
*/
public clear(field: string, callback?: callback): void;
clear(field: string, callback?: callback): void;
/**
* Returns an {@link HostedFields~stateObject|object} that includes the state of all fields and possible card types.
@@ -973,14 +884,13 @@ declare namespace BraintreeWeb {
* return state.fields[key].isValid;
* });
*/
public getState(): any;
getState(): any;
}
}
/** @module braintree-web/paypal */
declare namespace BraintreeWeb {
declare namespace braintree {
/**
* @typedef {object} PayPal~tokenizeReturn
* @property {Function} close A handle to close the PayPal checkout flow.
*/
interface PayPalTokenizeReturn {
@@ -988,7 +898,6 @@ declare namespace BraintreeWeb {
}
/**
* @typedef {object} PayPal~tokenizePayload
* @property {string} nonce The payment method nonce.
* @property {string} type The payment method type, always `PayPalAccount`.
* @property {object} details Additional PayPal account details.
@@ -1082,20 +991,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
}
/**
* @class
* @param {object} options see {@link module:braintree-web/paypal.create|paypal.create}
* @classdesc This class represents a PayPal component. Instances of this class have methods for launching auth dialogs and other programmatic interactions with the PayPal component.
*/
export class PayPal {
/**
* @class
* @param {object} options see {@link module:braintree-web/paypal.create|paypal.create}
* @classdesc This class represents a PayPal component. Instances of this class have methods for launching auth dialogs and other programmatic interactions with the PayPal component.
*/
constructor(options: any);
/**
* Launches the PayPal login flow and returns a nonce payload. Only one PayPal login flow should be active at a time. One way to achieve this is to disable your PayPal button while the flow is open.
@@ -1192,7 +1087,7 @@ declare namespace BraintreeWeb {
* });
* @returns {PayPal~tokenizeReturn} A handle to close the PayPal checkout frame.
*/
public tokenize(options: { flow: string, intent: string, offerCredit: boolean, useraction: string, amount: (string | number), currency: string, displayName: string, locale: string, enableShippingAddress: boolean, shippingAddressOverride: PayPalShippingAddress, shippingAddressEditable: boolean, billingAgreementDescription: string }, callback: callback): PayPalTokenizeReturn;
tokenize(options: { flow: string, intent: string, offerCredit: boolean, useraction: string, amount: (string | number), currency: string, displayName: string, locale: string, enableShippingAddress: boolean, shippingAddressOverride: PayPalShippingAddress, shippingAddressEditable: boolean, billingAgreementDescription: string }, callback: callback): PayPalTokenizeReturn;
/**
* Cleanly tear down anything set up by {@link module:braintree-web/paypal.create|create}.
@@ -1200,15 +1095,13 @@ declare namespace BraintreeWeb {
* @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
* @returns {void}
*/
public teardown(callback?: () => void): void;
teardown(callback?: () => void): void;
}
}
/** @module braintree-web/three-d-secure */
declare namespace BraintreeWeb {
declare namespace braintree {
/**
* @typedef {object} ThreeDSecure~verifyPayload
* @property {string} nonce The new payment method nonce produced by the 3D Secure lookup. The original nonce passed into {@link ThreeDSecure#verifyCard|verifyCard} was consumed. This new nonce should be used to transact on your server.
* @property {object} details Additional account details.
* @property {string} details.cardType Type of card, ex: Visa, MasterCard.
@@ -1250,23 +1143,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
}
/**
* @class
* @param {object} options 3D Secure {@link module:braintree-web/three-d-secure.create create} options
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create} instead.</strong>
* @classdesc This class represents a ThreeDSecure component produced by {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create}. Instances of this class have a method for launching a 3D Secure authentication flow.
*/
export class ThreeDSecure {
/**
* @class
* @param {object} options 3D Secure {@link module:braintree-web/three-d-secure.create create} options
* @description <strong>Do not use this constructor directly. Use {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create} instead.</strong>
* @classdesc This class represents a ThreeDSecure component produced by {@link module:braintree-web/three-d-secure.create|braintree.threeDSecure.create}. Instances of this class have a method for launching a 3D Secure authentication flow.
*/
constructor(options: any);
/**
* @callback ThreeDSecure~addFrameCallback
@@ -1329,7 +1205,7 @@ declare namespace BraintreeWeb {
* }
* });
*/
public verifyCard(options: { nonce: string, amount: number, addFrame: (err?: BraintreeError, iframe?: HTMLIFrameElement) => void, removeFrame: () => void }, callback: callback): void;
verifyCard(options: { nonce: string, amount: number, addFrame: (err?: BraintreeError, iframe?: HTMLIFrameElement) => void, removeFrame: () => void }, callback: callback): void;
/**
* Cancel the 3DS flow and return the verification payload if available.
@@ -1349,7 +1225,7 @@ declare namespace BraintreeWeb {
* verifyPayload.liabilityShiftPossible; // boolean
* });
*/
public cancelVerifyCard(callback: callback): void;
cancelVerifyCard(callback: callback): void;
/**
* Cleanly tear down anything set up by {@link module:braintree-web/three-d-secure.create|create}
@@ -1357,7 +1233,7 @@ declare namespace BraintreeWeb {
* @param {errback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
* @returns {void}
*/
public teardown(callback?: callback): void;
teardown(callback?: callback): void;
}
}
@@ -1365,9 +1241,8 @@ declare namespace BraintreeWeb {
* @module braintree-web/unionpay
* @description This module allows you to accept UnionPay payments. *It is currently in beta and is subject to change.*
*/
declare namespace BraintreeWeb {
declare namespace braintree {
/**
* @typedef {object} UnionPay~tokenizePayload
* @property {string} nonce The payment method nonce.
* @property {string} type Always <code>CreditCard</code>.
* @property {object} details Additional account details:
@@ -1388,7 +1263,6 @@ declare namespace BraintreeWeb {
}
/**
* @typedef {object} UnionPay~enrollPayload
* @property {string} enrollmentId UnionPay enrollment ID. This value should be passed to `tokenize`.
* @property {boolean} smsCodeRequired UnionPay `smsCodeRequired` flag.
* </p><b>true</b> - the user will receive an SMS code that needs to be supplied for tokenization.
@@ -1400,7 +1274,6 @@ declare namespace BraintreeWeb {
}
/**
* @typedef {object} UnionPay~fetchCapabilitiesPayload
* @property {boolean} isUnionPay Determines if this card is a UnionPay card.
* @property {boolean} isDebit Determines if this card is a debit card. This property is only present if `isUnionPay` is `true`.
* @property {object} unionPay UnionPay specific properties. This property is only present if `isUnionPay` is `true`.
@@ -1443,22 +1316,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
}
/**
* @class
* @param {object} options See {@link module:braintree-web/unionpay.create|unionpay.create}.
* @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/unionpay.create|braintree-web.unionpay.create} instead.</strong>
* @classdesc This class represents a UnionPay component. Instances of this class have methods for {@link UnionPay#fetchCapabilities fetching capabilities} of UnionPay cards, {@link UnionPay#enroll enrolling} a UnionPay card, and {@link UnionPay#tokenize tokenizing} a UnionPay card.
*/
export class UnionPay {
/**
* @class
* @param {object} options See {@link module:braintree-web/unionpay.create|unionpay.create}.
* @description <strong>You cannot use this constructor directly. Use {@link module:braintree-web/unionpay.create|braintree-web.unionpay.create} instead.</strong>
* @classdesc This class represents a UnionPay component. Instances of this class have methods for {@link UnionPay#fetchCapabilities fetching capabilities} of UnionPay cards, {@link UnionPay#enroll enrolling} a UnionPay card, and {@link UnionPay#tokenize tokenizing} a UnionPay card.
*/
constructor(options: any);
/**
* Fetches the capabilities of a card, including whether or not the SMS enrollment process is required.
@@ -1531,7 +1388,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
public fetchCapabilities(options: { card: any, hostedFields: HostedFields }, callback: callback): void;
fetchCapabilities(options: { card: any, hostedFields: HostedFields }, callback: callback): void;
/**
* Enrolls a UnionPay card. Use {@link UnionPay#fetchCapabilities|fetchCapabilities} to determine if the SMS enrollment process is required.
@@ -1594,7 +1451,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
public enroll(options: { card: any, hostedFields: HostedFields, mobile: any }, callback: callback): void;
enroll(options: { card: any, hostedFields: HostedFields, mobile: any }, callback: callback): void;
/**
* Tokenizes a UnionPay card and returns a nonce payload.
@@ -1643,7 +1500,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
public tokenize(options: { card: any, hostedFields: HostedFields, enrollmentId: string, smsCode: string }, callback: callback): void;
tokenize(options: { card: any, hostedFields: HostedFields, enrollmentId: string, smsCode: string }, callback: callback): void;
/**
* Cleanly tear down anything set up by {@link module:braintree-web/unionpay.create|create}. This only needs to be called when using UnionPay with Hosted Fields.
@@ -1659,8 +1516,7 @@ declare namespace BraintreeWeb {
* });
* @returns {void}
*/
public teardown(callback?: callback): void;
teardown(callback?: callback): void;
}
/**
@@ -1683,21 +1539,6 @@ declare namespace BraintreeWeb {
* @type {string}
*/
VERSION: string;
}
/**
* @class
* @param {object} options See {@link module:braintree-web/us-bank-account.create|us-bank-account.create}.
* @classdesc This class represents a US Bank Account component. Instances of this class can tokenize raw bank details or present a bank login. <strong>You cannot use this constructor directly. Use {@link module:braintree-web/us-bank-account.create|braintree.us-bank-account.create} instead.</strong>
*/
export class USBankAccount {
/**
* @class
* @param {object} options See {@link module:braintree-web/us-bank-account.create|us-bank-account.create}.
* @classdesc This class represents a US Bank Account component. Instances of this class can tokenize raw bank details or present a bank login. <strong>You cannot use this constructor directly. Use {@link module:braintree-web/us-bank-account.create|braintree.us-bank-account.create} instead.</strong>
*/
constructor(options: any)
/**
* Tokenizes bank information to return a payment method nonce. You can tokenize bank details by providing information like account and routing numbers. You can also tokenize with a bank login UI that prompts the customer to log into their bank account.
@@ -1778,7 +1619,7 @@ declare namespace BraintreeWeb {
* });
* });
*/
public tokenize(options: { mandateText: string, bankDetails: any, bankLogin: any }, callback: callback): void;
tokenize(options: { mandateText: string, bankDetails: any, bankLogin: any }, callback: callback): void;
/**
* Cleanly tear down anything set up by {@link module:braintree-web/us-bank-account.create|create}.
@@ -1786,77 +1627,53 @@ declare namespace BraintreeWeb {
* @param {callback} [callback] Called once teardown is complete. No data is returned if teardown completes successfully.
* @returns {void}
*/
public teardown(callback?: callback): void;
}
}
declare namespace BraintreeError {
/**
* Enum for {@link BraintreeError} types.
* @name BraintreeError.types
* @enum
* @readonly
* @memberof BraintreeError
* @property {string} CUSTOMER An error caused by the customer.
* @property {string} MERCHANT An error that is actionable by the merchant.
* @property {string} NETWORK An error due to a network problem.
* @property {string} INTERNAL An error caused by Braintree code.
* @property {string} UNKNOWN An error where the origin is unknown.
*/
export enum Types {
CUSTOMER,
MERCHANT,
NETWORK,
INTERNAL,
UNKNOWN
teardown(callback?: callback): void;
}
}
/**
* @class
* @global
* @param {object} options Construction options
* @classdesc This class is used to report error conditions, frequently as the first parameter to callbacks throughout the Braintree SDK.
* @description <strong>You cannot use this constructor directly. Interact with instances of this class through {@link callback callbacks}.</strong>
*/
declare class BraintreeError {
/**
* @class
* @global
* @param {object} options Construction options
* @classdesc This class is used to report error conditions, frequently as the first parameter to callbacks throughout the Braintree SDK.
* @description <strong>You cannot use this constructor directly. Interact with instances of this class through {@link callback callbacks}.</strong>
*/
constructor(options: any);
declare namespace braintree {
export namespace BraintreeError {
/**
* Enum for {@link BraintreeError} types.
* @name BraintreeError.types
* @enum
* @readonly
* @memberof BraintreeError
* @property {string} CUSTOMER An error caused by the customer.
* @property {string} MERCHANT An error that is actionable by the merchant.
* @property {string} NETWORK An error due to a network problem.
* @property {string} INTERNAL An error caused by Braintree code.
* @property {string} UNKNOWN An error where the origin is unknown.
*/
export type Types = "CUSTOMER" | "MERCHANT" | "NETWORK" | "INTERNAL" | "UNKNOWN";
}
/**
* @type {string}
* @description A code that corresponds to specific errors.
*/
code: string;
export interface BraintreeError {
/**
* @type {string}
* @description A code that corresponds to specific errors.
*/
code: string;
/**
* @type {string}
* @description A short description of the error.
*/
message: string;
/**
* @type {string}
* @description A short description of the error.
*/
message: string;
/**
* @type {BraintreeError.types}
* @description The type of error.
*/
type: BraintreeError.Types;
/**
* @type {BraintreeError.types}
* @description The type of error.
*/
type: BraintreeError.Types;
/**
* @type {object=}
* @description Additional information about the error, such as an underlying network error response.
*/
details: any;
}
/**
* @type {object=}
* @description Additional information about the error, such as an underlying network error response.
*/
details: any;
}
declare namespace BraintreeWeb {
/**
* @global
* @callback callback
@@ -1895,39 +1712,40 @@ declare namespace BraintreeWeb {
* braintreeClient.create(...);
* });
*/
interface BraintreeStatic {
declare namespace braintree {
/** @type {module:braintree-web/client} */
client: BraintreeWeb.Client;
export var client: braintree.Client;
/** @type {module:braintree-web/paypal} */
paypal: BraintreeWeb.PayPal;
export var paypal: braintree.PayPal;
/** @type {module:braintree-web/hosted-fields} */
hostedFields: BraintreeWeb.HostedFields;
export var hostedFields: braintree.HostedFields;
/** @type {module:braintree-web/three-d-secure} */
threeDSecure: BraintreeWeb.ThreeDSecure;
export var threeDSecure: braintree.ThreeDSecure;
/** @type {module:braintree-web/data-collector} */
dataCollector: BraintreeWeb.DataCollector;
export var dataCollector: braintree.DataCollector;
/** @type {module:braintree-web/american-express} */
americanExpress: BraintreeWeb.AmericanExpress;
export var americanExpress: braintree.AmericanExpress;
/** @type {module:braintree-web/unionpay} */
unionpay: BraintreeWeb.UnionPay;
export var unionpay: braintree.UnionPay;
/** @type {module:braintree-web/apple-pay} */
applePay: BraintreeWeb.ApplePay;
export var applePay: braintree.ApplePay;
/** @type {module:braintree-web/us-bank-account} */
usBankAccount: BraintreeWeb.USBankAccount;
/** @type {module:braintree-web/us-bank-account} */
export var usBankAccount: braintree.USBankAccount;
/**
* @description The current version of the SDK, i.e. `3.0.2`.
* @type {string}
*/
VERSION: string;
export var VERSION: string;
}
declare var braintree: BraintreeStatic;
export = braintree;
export as namespace braintree;

View File

@@ -0,0 +1,440 @@
import * as braintree from 'braintree-web';
let version: string = braintree.VERSION;
let clientToken: string = "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiOiI0YjlhYzVmYmI4ZTNkYzQzMmFkZjJhNzBlNjZlMWNjY2M5ODRkYzE4ZTM4YmY4NjYzZTM5NjM3NWZjYmQzY2U5fGNyZWF0ZWRfYXQ9MjAxNi0wOS0wOFQwNTowMzo0MC4xNjk1NTUwMzUrMDAwMFx1MDAyNm1lcmNoYW50X2lkPTM0OHBrOWNnZjNiZ3l3MmJcdTAwMjZwdWJsaWNfa2V5PTJuMjQ3ZHY4OWJxOXZtcHIiLCJjb25maWdVcmwiOiJodHRwczovL2FwaS5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tOjQ0My9tZXJjaGFudHMvMzQ4cGs5Y2dmM2JneXcyYi9jbGllbnRfYXBpL3YxL2NvbmZpZ3VyYXRpb24iLCJjaGFsbGVuZ2VzIjpbXSwiZW52aXJvbm1lbnQiOiJzYW5kYm94IiwiY2xpZW50QXBpVXJsIjoiaHR0cHM6Ly9hcGkuc2FuZGJveC5icmFpbnRyZWVnYXRld2F5LmNvbTo0NDMvbWVyY2hhbnRzLzM0OHBrOWNnZjNiZ3l3MmIvY2xpZW50X2FwaSIsImFzc2V0c1VybCI6Imh0dHBzOi8vYXNzZXRzLmJyYWludHJlZWdhdGV3YXkuY29tIiwiYXV0aFVybCI6Imh0dHBzOi8vYXV0aC52ZW5tby5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tIiwiYW5hbHl0aWNzIjp7InVybCI6Imh0dHBzOi8vY2xpZW50LWFuYWx5dGljcy5zYW5kYm94LmJyYWludHJlZWdhdGV3YXkuY29tLzM0OHBrOWNnZjNiZ3l3MmIifSwidGhyZWVEU2VjdXJlRW5hYmxlZCI6dHJ1ZSwicGF5cGFsRW5hYmxlZCI6dHJ1ZSwicGF5cGFsIjp7ImRpc3BsYXlOYW1lIjoiQWNtZSBXaWRnZXRzLCBMdGQuIChTYW5kYm94KSIsImNsaWVudElkIjpudWxsLCJwcml2YWN5VXJsIjoiaHR0cDovL2V4YW1wbGUuY29tL3BwIiwidXNlckFncmVlbWVudFVybCI6Imh0dHA6Ly9leGFtcGxlLmNvbS90b3MiLCJiYXNlVXJsIjoiaHR0cHM6Ly9hc3NldHMuYnJhaW50cmVlZ2F0ZXdheS5jb20iLCJhc3NldHNVcmwiOiJodHRwczovL2NoZWNrb3V0LnBheXBhbC5jb20iLCJkaXJlY3RCYXNlVXJsIjpudWxsLCJhbGxvd0h0dHAiOnRydWUsImVudmlyb25tZW50Tm9OZXR3b3JrIjp0cnVlLCJlbnZpcm9ubWVudCI6Im9mZmxpbmUiLCJ1bnZldHRlZE1lcmNoYW50IjpmYWxzZSwiYnJhaW50cmVlQ2xpZW50SWQiOiJtYXN0ZXJjbGllbnQzIiwiYmlsbGluZ0FncmVlbWVudHNFbmFibGVkIjp0cnVlLCJtZXJjaGFudEFjY291bnRJZCI6ImFjbWV3aWRnZXRzbHRkc2FuZGJveCIsImN1cnJlbmN5SXNvQ29kZSI6IlVTRCJ9LCJjb2luYmFzZUVuYWJsZWQiOmZhbHNlLCJtZXJjaGFudElkIjoiMzQ4cGs5Y2dmM2JneXcyYiIsInZlbm1vIjoib2ZmIn0=";
braintree.client.create({
authorization: clientToken
}, function (error: braintree.BraintreeError, clientInstance: any) {
var form: HTMLFormElement = document.getElementById('my-form-id') as HTMLFormElement;
var data: { creditCard: braintree.CreditCardInfo } = {
creditCard: {
number: form['cc-number'].value,
cvv: form['cc-cvv'].value,
expirationDate: form['cc-date'].value,
billingAddress: {
postalCode: form['cc-postal'].value
}
}
};
clientInstance.request({
endpoint: 'payment_methods/credit_cards',
method: 'post',
data: data
}, function (requestErr: braintree.BraintreeError, response: { creditCards: any[]; }) {
if (requestErr) { throw new Error(requestErr.message); }
console.log('Got nonce:', response.creditCards[0].nonce);
});
braintree.hostedFields.create({
client: clientInstance,
styles: {
'input': {
'font-size': '16pt',
'color': '#3A3A3A'
},
'.number': {
'font-family': 'monospace'
},
'.valid': {
'color': 'green'
}
},
fields: {
number: {
selector: '#card-number'
},
cvv: {
selector: '#cvv',
type: 'password'
},
expirationMonth: {
selector: '#expiration-month',
select: {
options: ["01 - Jan", "02 - Feb", "03 - Mar", "04 - Apr", "05 - May", "06 - Jun", "07 - Jul", "08 - Aug", "09 - Sep", "10 - Oct", "11 - Nov", "12 - Dec"]
}
},
expirationYear: {
selector: '#expiration-year',
select: true
}
}
}, function (hostedFieldsErr?: braintree.BraintreeError, hostedFieldsInstance?: any) {
if (hostedFieldsErr) {
// Handle error in Hosted Fields creation
console.log(`Error Code: ${error.code}, Type: ${error.type}, Message: ${error.message}, Details: ${error.details}`);
return;
}
let form = new HTMLFormElement();
form.addEventListener('submit', function (event: Event) {
event.preventDefault();
hostedFieldsInstance.tokenize(function (tokenizeErr: braintree.BraintreeError, payload: braintree.HostedFieldsTokenizePayload) {
if (tokenizeErr) {
// Handle error in Hosted Fields tokenization
switch (tokenizeErr.code) {
case 'HOSTED_FIELDS_FIELDS_EMPTY':
console.error('All fields are empty! Please fill out the form.');
break;
case 'HOSTED_FIELDS_FIELDS_INVALID':
console.error('Some fields are invalid:', tokenizeErr.details.invalidFieldKeys);
break;
case 'HOSTED_FIELDS_FAILED_TOKENIZATION':
console.error('Tokenization failed server side. Is the card valid?');
break;
case 'HOSTED_FIELDS_TOKENIZATION_NETWORK_ERROR':
console.error('Network error occurred when tokenizing.');
break;
default:
console.error('Something bad happened!', tokenizeErr);
}
return;
}
// Put `payload.nonce` into the `payment-method-nonce` input, and then
// submit the form. Alternatively, you could send the nonce to your server
// with AJAX.
(document.querySelector('input[name="payment-method-nonce"]') as HTMLInputElement).value = payload.nonce;
form.submit();
});
}, false);
hostedFieldsInstance.on('focus', function (event: braintree.HostedFieldsStateObject) {
console.log(event.emittedBy, 'has been focused');
});
hostedFieldsInstance.teardown(function (teardownErr: braintree.BraintreeError) {
if (teardownErr) {
console.error('Could not tear down Hosted Fields!');
} else {
console.info('Hosted Fields has been torn down!');
}
});
hostedFieldsInstance.tokenize({
vault: true
}, function (tokenizeErr: braintree.BraintreeError, payload: braintree.HostedFieldsTokenizePayload) {
if (tokenizeErr) {
console.error(tokenizeErr);
} else {
console.log('Got nonce:', payload.nonce);
}
});
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: braintree.BraintreeError) {
if (addClassErr) {
console.error(addClassErr);
}
});
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: braintree.BraintreeError) {
if (addClassErr) {
console.error(addClassErr);
return;
}
// some time later...
hostedFieldsInstance.removeClass('number', 'custom-class');
});
hostedFieldsInstance.setPlaceholder('number', '4111 1111 1111 1111', function (placeholderErr: braintree.BraintreeError) {
if (placeholderErr) {
console.error(placeholderErr);
}
});
hostedFieldsInstance.on('cardTypeChange', function (event: braintree.HostedFieldsStateObject) {
// Update the placeholder value if there is only one possible card type
if (event.cards.length === 1) {
braintree.hostedFields.setPlaceholder('cvv', event.cards[0].code.name, function (placeholderErr: braintree.BraintreeError) {
if (placeholderErr) {
// Handle errors, such as invalid field name
console.error(placeholderErr);
}
});
}
});
hostedFieldsInstance.clear('number', function (clearErr: braintree.BraintreeError) {
if (clearErr) {
console.error(clearErr);
}
});
hostedFieldsInstance.clear('number');
hostedFieldsInstance.clear('cvv');
hostedFieldsInstance.clear('expirationDate');
var state = braintree.hostedFields.getState();
var formValid = Object.keys(state.fields).every(function (key) {
return state.fields[key].isValid;
});
});
braintree.applePay.create({ client: clientInstance }, function (createErr?: braintree.BraintreeError, applePayInstance?: any) {
if (createErr) {
// Handle error in client creation
console.log(`Error Code: ${error.code}, Type: ${error.type}, Message: ${error.message}, Details: ${error.details}`);
return;
}
let request = {
countryCode: 'US',
currencyCode: 'USD',
supportedNetworks: ['visa', 'masterCard'],
merchantCapabilities: ['supports3DS'],
total: { label: 'Your Label', amount: '10.00' },
};
var paymentRequest = braintree.applePay.createPaymentRequest(request);
console.log(paymentRequest);
// { total: { }, countryCode: 'US', currencyCode: 'USD', merchantCapabilities: [ ], supportedNetworks: [ ] }
});
braintree.applePay.create({ client: clientInstance }, function (createErr, applePayInstance) {
let request = {
countryCode: 'US',
currencyCode: 'USD',
supportedNetworks: ['visa', 'masterCard'],
merchantCapabilities: ['supports3DS'],
total: { label: 'Your Label', amount: '10.00' },
};
var session = new braintree.ApplePaySession(1, request);
session.onvalidatemerchant = function (event: { validationURL: string }) {
braintree.applePay.performValidation({
validationURL: event.validationURL
}, function (err, validationData) {
if (err) {
console.error(err);
session.abort();
return;
}
session.completeMerchantValidation(validationData);
});
};
});
braintree.applePay.create({ client: clientInstance }, function (createErr, applePayInstance) {
let request = {
countryCode: 'US',
currencyCode: 'USD',
supportedNetworks: ['visa', 'masterCard'],
merchantCapabilities: ['supports3DS'],
total: { label: 'Your Label', amount: '10.00' },
};
var session = new braintree.ApplePaySession(1, request);
session.onpaymentauthorized = function (event) {
braintree.applePay.tokenize({
token: event.payment.token
}, function (err, tokenizedPayload) {
if (err) {
session.completePayment(braintree.ApplePayStatusCodes.STATUS_FAILURE);
return;
}
session.completePayment(braintree.ApplePayStatusCodes.STATUS_SUCCESS);
// Send the tokenizedPayload to your server.
});
};
});
braintree.paypal.create({
client: clientInstance
}, function (createErr, paypalInstance) {
if (createErr) {
if (createErr.code === 'PAYPAL_BROWSER_NOT_SUPPORTED') {
console.error('This browser is not supported.');
} else {
console.error('Error!', createErr);
}
}
let button = new HTMLButtonElement();
button.addEventListener('click', function () {
// Disable the button so that we don't attempt to open multiple popups.
button.setAttribute('disabled', 'disabled');
// Because PayPal tokenization opens a popup, this must be called
// as a result of a user action, such as a button click.
paypalInstance.tokenize({
flow: 'vault' // Required
// Any other tokenization options
}, function (tokenizeErr: braintree.BraintreeError, payload: braintree.PayPalTokenizePayload) {
button.removeAttribute('disabled');
if (tokenizeErr) {
// Handle tokenization errors or premature flow closure
switch (tokenizeErr.code) {
case 'PAYPAL_POPUP_CLOSED':
console.error('Customer closed PayPal popup.');
break;
case 'PAYPAL_ACCOUNT_TOKENIZATION_FAILED':
console.error('PayPal tokenization failed. See details:', tokenizeErr.details);
break;
case 'PAYPAL_FLOW_FAILED':
console.error('Unable to initialize PayPal flow. Are your options correct?', tokenizeErr.details);
break;
default:
console.error('Error!', tokenizeErr);
}
} else {
// Submit payload.nonce to your server
}
});
});
});
braintree.unionpay.create({ client: clientInstance }, function (createErr, unionpayInstance) {
if (createErr) {
console.error(createErr);
return;
}
unionpayInstance.fetchCapabilities({
card: {
number: '4111111111111111'
}
}, function (fetchErr: braintree.BraintreeError, cardCapabilities: braintree.UnionPayFetchCapabilitiesPayload) {
if (fetchErr) {
console.error(fetchErr);
return;
}
if (cardCapabilities.isUnionPay) {
if (cardCapabilities.unionPay && !cardCapabilities.unionPay.isSupported) {
// Braintree cannot process this UnionPay card.
// Ask the user for a different card.
return;
}
if (cardCapabilities.isDebit) {
// CVV and expiration date are not required
} else {
// CVV and expiration date are required
}
// Show mobile phone number field for enrollment
}
});
unionpayInstance.enroll({
card: {
number: '4111111111111111',
expirationMonth: '12',
expirationYear: '2038'
},
mobile: {
countryCode: '62',
number: '111111111111'
}
}, function (enrollErr: braintree.BraintreeError, response: braintree.UnionPayEnrollPayload) {
if (enrollErr) {
console.error(enrollErr);
return;
}
if (response.smsCodeRequired) {
// If smsCodeRequired, wait for SMS auth code from customer
// Then use response.enrollmentId during {@link UnionPay#tokenize}
} else {
// SMS code is not required from the user.
// {@link UnionPay#tokenize} can be called immediately
}
});
let enrollResponse: {
enrollmentId: string
};
unionpayInstance.tokenize({
card: {
number: '4111111111111111',
expirationMonth: '12',
expirationYear: '2038',
cvv: '123'
},
enrollmentId: enrollResponse.enrollmentId, // Returned from enroll
smsCode: '11111' // Received by customer's phone, if SMS enrollment was required. Otherwise it should be omitted
}, function (tokenizeErr: braintree.BraintreeError, response: braintree.UnionPayTokenizePayload) {
if (tokenizeErr) {
console.error(tokenizeErr);
return;
}
// Send response.nonce to your server
});
unionpayInstance.teardown(function (teardownErr: braintree.BraintreeError) {
if (teardownErr) {
console.error('Could not tear down UnionPay.');
} else {
console.log('UnionPay has been torn down.');
}
});
});
});
let existingNonce = "fake-valid-nonce";
let submitNonceToServer: (nonce: string) => void;
braintree.threeDSecure.verifyCard({
nonce: existingNonce,
amount: 123.45,
addFrame: function (err, iframe) {
// Set up your UI and add the iframe.
let my3DSContainer = document.createElement('div');
my3DSContainer.appendChild(iframe);
document.body.appendChild(my3DSContainer);
},
removeFrame: function () {
let my3DSContainer = document.createElement('div');
// Remove UI that you added in addFrame.
document.body.removeChild(my3DSContainer);
}
}, function (err: braintree.BraintreeError, payload: braintree.ThreeDSecureVerifyPayload) {
if (err) {
console.error(err);
return;
}
if (payload.liabilityShifted) {
// Liablity has shifted
submitNonceToServer(payload.nonce);
} else if (payload.liabilityShiftPossible) {
// Liablity may still be shifted
// Decide if you want to submit the nonce
} else {
// Liablity has not shifted and will not shift
// Decide if you want to submit the nonce
}
});
braintree.threeDSecure.cancelVerifyCard(function (err: braintree.BraintreeError, verifyPayload: braintree.ThreeDSecureVerifyPayload) {
if (err) {
// Handle error
console.log(err.message); // No verification payload available
return;
}
verifyPayload.nonce; // The nonce returned from the 3ds lookup call
verifyPayload.liabilityShifted; // boolean
verifyPayload.liabilityShiftPossible; // boolean
});

View File

@@ -4,10 +4,10 @@ let clientToken: string = "eyJ2ZXJzaW9uIjoyLCJhdXRob3JpemF0aW9uRmluZ2VycHJpbnQiO
braintree.client.create({
authorization: clientToken
}, function (error: BraintreeError, clientInstance: any) {
}, function (error: braintree.BraintreeError, clientInstance: any) {
var form: HTMLFormElement = document.getElementById('my-form-id') as HTMLFormElement;
var data: { creditCard: BraintreeWeb.CreditCardInfo } = {
var data: { creditCard: braintree.CreditCardInfo } = {
creditCard: {
number: form['cc-number'].value,
cvv: form['cc-cvv'].value,
@@ -22,7 +22,7 @@ braintree.client.create({
endpoint: 'payment_methods/credit_cards',
method: 'post',
data: data
}, function (requestErr: BraintreeError, response: { creditCards: any[]; }) {
}, function (requestErr: braintree.BraintreeError, response: { creditCards: any[]; }) {
if (requestErr) { throw new Error(requestErr.message); }
console.log('Got nonce:', response.creditCards[0].nonce);
@@ -62,7 +62,7 @@ braintree.client.create({
select: true
}
}
}, function (hostedFieldsErr?: BraintreeError, hostedFieldsInstance?: any) {
}, function (hostedFieldsErr?: braintree.BraintreeError, hostedFieldsInstance?: any) {
if (hostedFieldsErr) {
// Handle error in Hosted Fields creation
@@ -75,7 +75,7 @@ braintree.client.create({
form.addEventListener('submit', function (event: Event) {
event.preventDefault();
hostedFieldsInstance.tokenize(function (tokenizeErr: BraintreeError, payload: BraintreeWeb.HostedFieldsTokenizePayload) {
hostedFieldsInstance.tokenize(function (tokenizeErr: braintree.BraintreeError, payload: braintree.HostedFieldsTokenizePayload) {
if (tokenizeErr) {
// Handle error in Hosted Fields tokenization
switch (tokenizeErr.code) {
@@ -105,11 +105,11 @@ braintree.client.create({
});
}, false);
hostedFieldsInstance.on('focus', function (event: BraintreeWeb.HostedFieldsStateObject) {
hostedFieldsInstance.on('focus', function (event: braintree.HostedFieldsStateObject) {
console.log(event.emittedBy, 'has been focused');
});
hostedFieldsInstance.teardown(function (teardownErr: BraintreeError) {
hostedFieldsInstance.teardown(function (teardownErr: braintree.BraintreeError) {
if (teardownErr) {
console.error('Could not tear down Hosted Fields!');
} else {
@@ -119,7 +119,7 @@ braintree.client.create({
hostedFieldsInstance.tokenize({
vault: true
}, function (tokenizeErr: BraintreeError, payload: BraintreeWeb.HostedFieldsTokenizePayload) {
}, function (tokenizeErr: braintree.BraintreeError, payload: braintree.HostedFieldsTokenizePayload) {
if (tokenizeErr) {
console.error(tokenizeErr);
} else {
@@ -127,13 +127,13 @@ braintree.client.create({
}
});
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: BraintreeError) {
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: braintree.BraintreeError) {
if (addClassErr) {
console.error(addClassErr);
}
});
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: BraintreeError) {
hostedFieldsInstance.addClass('number', 'custom-class', function (addClassErr: braintree.BraintreeError) {
if (addClassErr) {
console.error(addClassErr);
return;
@@ -143,16 +143,16 @@ braintree.client.create({
hostedFieldsInstance.removeClass('number', 'custom-class');
});
hostedFieldsInstance.setPlaceholder('number', '4111 1111 1111 1111', function (placeholderErr: BraintreeError) {
hostedFieldsInstance.setPlaceholder('number', '4111 1111 1111 1111', function (placeholderErr: braintree.BraintreeError) {
if (placeholderErr) {
console.error(placeholderErr);
}
});
hostedFieldsInstance.on('cardTypeChange', function (event: BraintreeWeb.HostedFieldsStateObject) {
hostedFieldsInstance.on('cardTypeChange', function (event: braintree.HostedFieldsStateObject) {
// Update the placeholder value if there is only one possible card type
if (event.cards.length === 1) {
braintree.hostedFields.setPlaceholder('cvv', event.cards[0].code.name, function (placeholderErr: BraintreeError) {
braintree.hostedFields.setPlaceholder('cvv', event.cards[0].code.name, function (placeholderErr: braintree.BraintreeError) {
if (placeholderErr) {
// Handle errors, such as invalid field name
console.error(placeholderErr);
@@ -161,7 +161,7 @@ braintree.client.create({
}
});
hostedFieldsInstance.clear('number', function (clearErr: BraintreeError) {
hostedFieldsInstance.clear('number', function (clearErr: braintree.BraintreeError) {
if (clearErr) {
console.error(clearErr);
}
@@ -178,7 +178,7 @@ braintree.client.create({
});
});
braintree.applePay.create({ client: clientInstance }, function (createErr?: BraintreeError, applePayInstance?: any) {
braintree.applePay.create({ client: clientInstance }, function (createErr?: braintree.BraintreeError, applePayInstance?: any) {
if (createErr) {
// Handle error in client creation
console.log(`Error Code: ${error.code}, Type: ${error.type}, Message: ${error.message}, Details: ${error.details}`);
@@ -209,7 +209,7 @@ braintree.client.create({
total: { label: 'Your Label', amount: '10.00' },
};
var session = new ApplePaySession(1, request);
var session = new braintree.ApplePaySession(1, request);
session.onvalidatemerchant = function (event: { validationURL: string }) {
braintree.applePay.performValidation({
@@ -234,17 +234,17 @@ braintree.client.create({
total: { label: 'Your Label', amount: '10.00' },
};
var session = new ApplePaySession(1, request);
var session = new braintree.ApplePaySession(1, request);
session.onpaymentauthorized = function (event) {
braintree.applePay.tokenize({
token: event.payment.token
}, function (err, tokenizedPayload) {
if (err) {
session.completePayment(ApplePayStatusCodes.STATUS_FAILURE);
session.completePayment(braintree.ApplePayStatusCodes.STATUS_FAILURE);
return;
}
session.completePayment(ApplePayStatusCodes.STATUS_SUCCESS);
session.completePayment(braintree.ApplePayStatusCodes.STATUS_SUCCESS);
// Send the tokenizedPayload to your server.
});
@@ -273,7 +273,7 @@ braintree.client.create({
paypalInstance.tokenize({
flow: 'vault' // Required
// Any other tokenization options
}, function (tokenizeErr: BraintreeError, payload: BraintreeWeb.PayPalTokenizePayload) {
}, function (tokenizeErr: braintree.BraintreeError, payload: braintree.PayPalTokenizePayload) {
button.removeAttribute('disabled');
if (tokenizeErr) {
@@ -309,7 +309,7 @@ braintree.client.create({
card: {
number: '4111111111111111'
}
}, function (fetchErr: BraintreeError, cardCapabilities: BraintreeWeb.UnionPayFetchCapabilitiesPayload) {
}, function (fetchErr: braintree.BraintreeError, cardCapabilities: braintree.UnionPayFetchCapabilitiesPayload) {
if (fetchErr) {
console.error(fetchErr);
return;
@@ -342,7 +342,7 @@ braintree.client.create({
countryCode: '62',
number: '111111111111'
}
}, function (enrollErr: BraintreeError, response: BraintreeWeb.UnionPayEnrollPayload) {
}, function (enrollErr: braintree.BraintreeError, response: braintree.UnionPayEnrollPayload) {
if (enrollErr) {
console.error(enrollErr);
return;
@@ -370,7 +370,7 @@ braintree.client.create({
},
enrollmentId: enrollResponse.enrollmentId, // Returned from enroll
smsCode: '11111' // Received by customer's phone, if SMS enrollment was required. Otherwise it should be omitted
}, function (tokenizeErr: BraintreeError, response: BraintreeWeb.UnionPayTokenizePayload) {
}, function (tokenizeErr: braintree.BraintreeError, response: braintree.UnionPayTokenizePayload) {
if (tokenizeErr) {
console.error(tokenizeErr);
return;
@@ -379,7 +379,7 @@ braintree.client.create({
// Send response.nonce to your server
});
unionpayInstance.teardown(function (teardownErr: BraintreeError) {
unionpayInstance.teardown(function (teardownErr: braintree.BraintreeError) {
if (teardownErr) {
console.error('Could not tear down UnionPay.');
} else {
@@ -407,7 +407,7 @@ braintree.threeDSecure.verifyCard({
// Remove UI that you added in addFrame.
document.body.removeChild(my3DSContainer);
}
}, function (err: BraintreeError, payload: BraintreeWeb.ThreeDSecureVerifyPayload) {
}, function (err: braintree.BraintreeError, payload: braintree.ThreeDSecureVerifyPayload) {
if (err) {
console.error(err);
return;
@@ -425,7 +425,7 @@ braintree.threeDSecure.verifyCard({
}
});
braintree.threeDSecure.cancelVerifyCard(function (err: BraintreeError, verifyPayload: BraintreeWeb.ThreeDSecureVerifyPayload) {
braintree.threeDSecure.cancelVerifyCard(function (err: braintree.BraintreeError, verifyPayload: braintree.ThreeDSecureVerifyPayload) {
if (err) {
// Handle error
console.log(err.message); // No verification payload available
@@ -435,4 +435,4 @@ braintree.threeDSecure.cancelVerifyCard(function (err: BraintreeError, verifyPay
verifyPayload.nonce; // The nonce returned from the 3ds lookup call
verifyPayload.liabilityShifted; // boolean
verifyPayload.liabilityShiftPossible; // boolean
});
});

View File

@@ -18,6 +18,7 @@
},
"files": [
"index.d.ts",
"braintree-web-tests.ts"
"test/web.ts",
"test/node.ts"
]
}
}

View File

@@ -3,8 +3,8 @@ import camelcaseKeys = require('camelcase-keys');
camelcaseKeys({'foo-bar': true});
// => {fooBar: true}
camelcaseKeys({'foo-bar': true, 'nested': {unicorn_rainbow: true}}, {deep: true});
camelcaseKeys({'foo-bar': true, nested: {unicorn_rainbow: true}}, {deep: true});
// => {fooBar: true, nested: {unicornRainbow: true}}
camelcaseKeys({'_': [], 'foo-bar': true});
// => {_: [], fooBar: true}
camelcaseKeys({_: [], 'foo-bar': true});
// => {_: [], fooBar: true}

View File

@@ -8,7 +8,8 @@ const text = 'Always after me lucky charms.';
let offset = 0;
const iv = setInterval(() => {
let y = 0, dy = 1;
let y = 0;
let dy = 1;
for (let i = 0; i < 40; i++) {
const color = colors[(i + offset) % colors.length];
const c = text[(i + offset) % text.length];

View File

@@ -5,14 +5,13 @@
// Interfaces
declare namespace chunkedDc {
/** common.ts **/
/** common.ts */
interface CommonStatic {
HEADER_LENGTH: number;
}
/** chunker.ts **/
/** chunker.ts */
interface Chunker extends IterableIterator<Uint8Array> {
hasNext: boolean;
@@ -24,7 +23,7 @@ declare namespace chunkedDc {
new(id: number, message: Uint8Array, chunkSize: number): Chunker;
}
/** unchunker.ts **/
/** unchunker.ts */
type MessageListener = (message: Uint8Array, context?: any) => void;
@@ -38,13 +37,12 @@ declare namespace chunkedDc {
new(): Unchunker;
}
/** main.ts **/
/** main.ts */
interface Standalone {
Chunker: ChunkerStatic;
Unchunker: UnchunkerStatic;
}
}
// Entry point for the packed ES5 version:

View File

@@ -27,21 +27,21 @@ declare namespace Clipboard {
* @param {Element} elem Current element
* @returns {String} Only 'cut' or 'copy'.
*/
action?: (elem: Element) => string;
action?(elem: Element): string;
/**
* Overwrites default target input element.
* @param {Element} elem Current element
* @returns {Element} <input> element to use.
*/
target?: (elem: Element) => Element;
target?(elem: Element): Element;
/**
* Returns the explicit text to copy.
* @param {Element} elem Current element
* @returns {String} Text to be copied.
*/
text?: (elem: Element) => string;
text?(elem: Element): string;
}
interface Event {

View File

@@ -89,4 +89,4 @@ myCalendar
.setEvents([])
.addEvents([])
.removeEvents(event => event.id === 'idToRemove')
.destroy();
.destroy();

View File

@@ -16,7 +16,7 @@ expect([1, 2, 3]).to.part.include([1, 4]);
expect(10, "Age").to.be.above(5);
const func = function() { return arguments; };
const func = function() { return arguments; }; // tslint:disable-line only-arrow-functions
expect(func()).to.be.arguments();
expect([1, 2]).to.be.an.array();

View File

@@ -174,7 +174,7 @@ interface Settings {
/**
* Truncate long assertion error messages for readability?
* Defaults to true.
*/
*/
truncateMessages?: boolean;
/**
* Ignore object prototypes when doing a deep comparison?

View File

@@ -1,8 +1,9 @@
let requirePeer = codependency.register(module), package: any;
requirePeer = codependency.register(module, {index: ["dependencies", "devDependencies"]});
requirePeer = codependency.get("some-middleware");
package = requirePeer("some-peer-dependency-package");
package = requirePeer("some-peer-dependency-package", {optional: true});
package = requirePeer("some-peer-dependency-package", {dontThrow: true});
package = requirePeer("some-peer-dependency-package", {optional: true, dontThrow: true});
package = requirePeer.resolve("peer-package-name");
let requirePeer = codependency.register(module);
let package: any;
requirePeer = codependency.register(module, {index: ["dependencies", "devDependencies"]});
requirePeer = codependency.get("some-middleware");
package = requirePeer("some-peer-dependency-package");
package = requirePeer("some-peer-dependency-package", {optional: true});
package = requirePeer("some-peer-dependency-package", {dontThrow: true});
package = requirePeer("some-peer-dependency-package", {optional: true, dontThrow: true});
package = requirePeer.resolve("peer-package-name");

View File

@@ -22,8 +22,8 @@ interface RequirePeerFunctionOptions {
interface RequirePeerFunction {
(name: string, options?: RequirePeerFunctionOptions): any;
resolve: (name: string) => DependencyInfo;
resolve(name: string): DependencyInfo;
}
export function register(baseModule: NodeModule, options?: {index: string[]}): RequirePeerFunction;
export function get(middlewareName: string): RequirePeerFunction;
export function get(middlewareName: string): RequirePeerFunction;

View File

@@ -1,66 +1,62 @@
import cs = require('coinstring');
var privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
var privateKeyHexBuf = new Buffer(privateKeyHex, 'hex');
var version = 0x80; // Bitcoin private key
let privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
let privateKeyHexBuf = new Buffer(privateKeyHex, 'hex');
let version = 0x80; // Bitcoin private key
console.log(cs.encode(privateKeyHexBuf, version));
// => 5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD
var hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8"; // hash representing uncompressed
var hash160Buf = new Buffer(hash160, 'hex');
var version = 0x00; // Bitcoin public address
let hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8"; // hash representing uncompressed
let hash160Buf = new Buffer(hash160, 'hex');
version = 0x00; // Bitcoin public address
console.log(cs.encode(hash160Buf, version));
// => 16UjcYNBG9GTK4uq2f7yYEbuifqCzoLMGS
var privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
// for compressed, append "01"
privateKeyHex += '01';
var privateKeyHexBuf = new Buffer(privateKeyHex, 'hex');
var version = 0x80; // Bitcoin private key
privateKeyHexBuf = new Buffer(privateKeyHex, 'hex');
version = 0x80; // Bitcoin private key
console.log(cs.encode(privateKeyHexBuf, version));
// => KwomKti1X3tYJUUMb1TGSM2mrZk1wb1aHisUNHCQXTZq5auC2qc3
var hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8"; // hash representing uncompressed
var hash160Buf = new Buffer(hash160, 'hex');
var version = 0x1E; // Dogecoin public address
hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8"; // hash representing uncompressed
hash160Buf = new Buffer(hash160, 'hex');
version = 0x1E; // Dogecoin public address
console.log(cs.encode(hash160Buf, version));
// => DAcq9oJpZZAjr56RmF7Y5zmWboZWQ4HAsW
var data = "000000000000000000873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d50800e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35";
var buffer = new Buffer(data, 'hex');
var versionBuffer = new Buffer('0488ade4', 'hex'); // 0488ade4 is a consant listed in the aforementioned bip32 wiki.
const data = "000000000000000000873dff81c02f525623fd1fe5167eac3a55a049de3d314bb42ee227ffed37d50800e8f32e723decf4051aefac8e2c93c9c5b214313817cdb01a1494b917c8436b35";
const buffer = new Buffer(data, 'hex');
const versionBuffer = new Buffer('0488ade4', 'hex'); // 0488ade4 is a consant listed in the aforementioned bip32 wiki.
console.log(cs.encode(buffer, versionBuffer));
// => xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi
privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
privateKeyHexBuf = new Buffer(privateKeyHex, 'hex');
version = 0x80; // Bitcoin private key
var privateKeyHex = "1184cd2cdd640ca42cfc3a091c51d549b2f016d454b2774019c2b2d2e08529fd";
var privateKeyHexBuf = new Buffer(privateKeyHex, 'hex');
var version = 0x80; // Bitcoin private key
var toBtcWif = cs.createEncoder(version);
const toBtcWif = cs.createEncoder(version);
// later in your program
console.log(toBtcWif(privateKeyHexBuf));
// => 5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD
const wif = "5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD";
version = 0x80; // Bitcoin private key
var wif = "5Hx15HFGyep2CfPxsJKe2fXJsCVn5DEiyoeGGF6JZjGbTRnqfiD";
var version = 0x80; // Bitcoin private key
const fromBtcWif = cs.createDecoder(version);
var fromBtcWif = cs.createDecoder(version);
hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8"; // hash representing uncompressed
hash160Buf = new Buffer(hash160, 'hex');
version = 0x6F; // Bitcoin Testnet Address
var hash160 = "3c176e659bea0f29a3e9bf7880c112b1b31b4dc8"; // hash representing uncompressed
var hash160Buf = new Buffer(hash160, 'hex');
var version = 0x6F; // Bitcoin Testnet Address
var testnetAddressValidator = cs.createValidator(version);
console.log(testnetAddressValidator("mkzgubTA5Ahi6BPSkE6MN9pEafRutznkMe")); // => true
const testnetAddressValidator = cs.createValidator(version);
console.log(testnetAddressValidator("mkzgubTA5Ahi6BPSkE6MN9pEafRutznkMe")); // => true

View File

@@ -48,46 +48,46 @@ interface Color {
export function setTheme(theme: any): void;
export var enabled: boolean;
export let enabled: boolean;
export var strip: Color;
export var stripColors: Color;
export const strip: Color;
export const stripColors: Color;
export var black: Color;
export var red: Color;
export var green: Color;
export var yellow: Color;
export var blue: Color;
export var magenta: Color;
export var cyan: Color;
export var white: Color;
export var gray: Color;
export var grey: Color;
export const black: Color;
export const red: Color;
export const green: Color;
export const yellow: Color;
export const blue: Color;
export const magenta: Color;
export const cyan: Color;
export const white: Color;
export const gray: Color;
export const grey: Color;
export var bgBlack: Color;
export var bgRed: Color;
export var bgGreen: Color;
export var bgYellow: Color;
export var bgBlue: Color;
export var bgMagenta: Color;
export var bgCyan: Color;
export var bgWhite: Color;
export const bgBlack: Color;
export const bgRed: Color;
export const bgGreen: Color;
export const bgYellow: Color;
export const bgBlue: Color;
export const bgMagenta: Color;
export const bgCyan: Color;
export const bgWhite: Color;
export var reset: Color;
export var bold: Color;
export var dim: Color;
export var italic: Color;
export var underline: Color;
export var inverse: Color;
export var hidden: Color;
export var strikethrough: Color;
export const reset: Color;
export const bold: Color;
export const dim: Color;
export const italic: Color;
export const underline: Color;
export const inverse: Color;
export const hidden: Color;
export const strikethrough: Color;
export var rainbow: Color;
export var zebra: Color;
export var america: Color;
export var trap: Color;
export var random: Color;
export var zalgo: Color;
export const rainbow: Color;
export const zebra: Color;
export const america: Color;
export const trap: Color;
export const random: Color;
export const zalgo: Color;
declare global {
interface String {
@@ -130,4 +130,4 @@ declare global {
random: string;
zalgo: string;
}
}
}

View File

@@ -1,4 +1,4 @@
export var enabled: boolean;
export const enabled: boolean;
export function strip(str: string): string;
export function stripColors(str: string): string;

View File

@@ -23,51 +23,51 @@ interface LoggedOutOptions {
}
/**
* Ensure that a user is logged in before proceeding to next route middleware.
*
* This middleware ensures that a user is logged in. If a request is received
* that is unauthenticated, the request will be redirected to a login page (by
* default to `/login`).
*
* Additionally, `returnTo` will be be set in the session to the URL of the
* current request. After authentication, this value can be used to redirect
* the user to the page that was originally requested.
*
* Examples:
*
* app.get('/profile',
* ensureLoggedIn(),
* function(req, res) { ... });
*
* app.get('/profile',
* ensureLoggedIn('/signin'),
* function(req, res) { ... });
*
* app.get('/profile',
* ensureLoggedIn({ redirectTo: '/session/new', setReturnTo: false }),
* function(req, res) { ... });
*/
* Ensure that a user is logged in before proceeding to next route middleware.
*
* This middleware ensures that a user is logged in. If a request is received
* that is unauthenticated, the request will be redirected to a login page (by
* default to `/login`).
*
* Additionally, `returnTo` will be be set in the session to the URL of the
* current request. After authentication, this value can be used to redirect
* the user to the page that was originally requested.
*
* Examples:
*
* app.get('/profile',
* ensureLoggedIn(),
* function(req, res) { ... });
*
* app.get('/profile',
* ensureLoggedIn('/signin'),
* function(req, res) { ... });
*
* app.get('/profile',
* ensureLoggedIn({ redirectTo: '/session/new', setReturnTo: false }),
* function(req, res) { ... });
*/
export function ensureLoggedIn(options?: LoggedInOptions | string): RequestHandler;
/**
* Ensure that no user is logged in before proceeding to next route middleware.
*
* This middleware ensures that no user is logged in. If a request is received
* that is authenticated, the request will be redirected to another page (by
* default to `/`).
*
* Examples:
*
* app.get('/login',
* ensureLoggedOut(),
* function(req, res) { ... });
*
* app.get('/login',
* ensureLoggedOut('/home'),
* function(req, res) { ... });
*
* app.get('/login',
* ensureLoggedOut({ redirectTo: '/home' }),
* function(req, res) { ... });
*/
* Ensure that no user is logged in before proceeding to next route middleware.
*
* This middleware ensures that no user is logged in. If a request is received
* that is authenticated, the request will be redirected to another page (by
* default to `/`).
*
* Examples:
*
* app.get('/login',
* ensureLoggedOut(),
* function(req, res) { ... });
*
* app.get('/login',
* ensureLoggedOut('/home'),
* function(req, res) { ... });
*
* app.get('/login',
* ensureLoggedOut({ redirectTo: '/home' }),
* function(req, res) { ... });
*/
export function ensureLoggedOut(options?: LoggedOutOptions | string): RequestHandler;

View File

@@ -2,11 +2,11 @@ import convert = require("convert-source-map");
// tslint:disable:max-line-length
var json = convert
const json = convert
.fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
.toJSON();
var modified = convert
const modified = convert
.fromComment('//@ sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZm9vLmpzIiwic291cmNlcyI6WyJjb25zb2xlLmxvZyhcImhpXCIpOyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFBQSIsInNvdXJjZVJvb3QiOiIvIn0=')
.setProperty('sources', ['CONSOLE.LOG("HI");'])
.toJSON();

View File

@@ -35,7 +35,6 @@ export interface SourceMapConverter {
getProperty(key: string): any;
}
/** Returns source map converter from given object */
export function fromObject(obj: any): SourceMapConverter;
@@ -72,13 +71,13 @@ export function removeComments(src: string): string;
export function removeMapFileComments(src: string): string;
/** Returns the regex used to find source map comments */
export var commentRegex: RegExp;
export const commentRegex: RegExp;
/** Returns the regex used to find source map comments pointing to map files */
export var mapFileCommentRegex: RegExp;
export const mapFileCommentRegex: RegExp;
/** Returns a comment that links to an external source map via file.
* By default, the comment is formatted like: //# sourceMappingURL=..., which you would normally see in a JS source file.
* When options.multiline == true, the comment is formatted like: /*# sourceMappingURL=... *\/, which you would find in a CSS source file.
*/
export function generateMapFileComment(file: string, options?: { multiline?: boolean }): string;
export function generateMapFileComment(file: string, options?: { multiline?: boolean }): string;

View File

@@ -3,9 +3,9 @@ import * as http from 'http';
const server = http.createServer((req, res) => {
const cookies = new Cookies(req, res);
let unsigned: string,
signed: string,
tampered: string;
let unsigned: string;
let signed: string;
let tampered: string;
if (req.url === "/set") {
cookies

View File

@@ -26,13 +26,13 @@ and limitations under the License.
interface SymbolConstructor {
/**
* Non-standard. Use simple mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
*/
* Non-standard. Use simple mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
*/
useSimple(): void;
/**
* Non-standard. Use setter mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
*/
* Non-standard. Use setter mode for core-js symbols. See https://github.com/zloirock/core-js/#caveats-when-using-symbol-polyfill
*/
userSetter(): void;
}
@@ -80,202 +80,202 @@ interface Set<T> {
interface ArrayConstructor {
/**
* Appends new elements to an array, and returns the new length of the array.
* @param items New elements of the Array.
*/
* Appends new elements to an array, and returns the new length of the array.
* @param items New elements of the Array.
*/
push<T>(array: ArrayLike<T>, ...items: T[]): number;
/**
* Removes the last element from an array and returns it.
*/
* Removes the last element from an array and returns it.
*/
pop<T>(array: ArrayLike<T>): T;
/**
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
* Combines two or more arrays.
* @param items Additional items to add to the end of array1.
*/
concat<T>(array: ArrayLike<T>, ...items: Array<T[]| T>): T[];
/**
* Adds all the elements of an array separated by the specified separator string.
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
*/
* Adds all the elements of an array separated by the specified separator string.
* @param separator A string used to separate one element of an array from the next in the resulting String. If omitted, the array elements are separated with a comma.
*/
join<T>(array: ArrayLike<T>, separator?: string): string;
/**
* Reverses the elements in an Array.
*/
* Reverses the elements in an Array.
*/
reverse<T>(array: ArrayLike<T>): T[];
/**
* Removes the first element from an array and returns it.
*/
* Removes the first element from an array and returns it.
*/
shift<T>(array: ArrayLike<T>): T;
/**
* Returns a section of an array.
* @param start The beginning of the specified portion of the array.
* @param end The end of the specified portion of the array.
*/
* Returns a section of an array.
* @param start The beginning of the specified portion of the array.
* @param end The end of the specified portion of the array.
*/
slice<T>(array: ArrayLike<T>, start?: number, end?: number): T[];
/**
* Sorts an array.
* @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.
*/
* Sorts an array.
* @param compareFn The name of the function used to determine the order of the elements. If omitted, the elements are sorted in ascending, ASCII character order.
*/
sort<T>(array: ArrayLike<T>, compareFn?: (a: T, b: T) => number): T[];
/**
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
* @param start The zero-based location in the array from which to start removing elements.
* @param deleteCount The number of elements to remove.
* @param items Elements to insert into the array in place of the deleted elements.
*/
* Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements.
* @param start The zero-based location in the array from which to start removing elements.
* @param deleteCount The number of elements to remove.
* @param items Elements to insert into the array in place of the deleted elements.
*/
splice<T>(array: ArrayLike<T>, start: number, deleteCount?: number, ...items: T[]): T[];
/**
* Inserts new elements at the start of an array.
* @param items Elements to insert at the start of the Array.
*/
* Inserts new elements at the start of an array.
* @param items Elements to insert at the start of the Array.
*/
unshift<T>(array: ArrayLike<T>, ...items: T[]): number;
/**
* Returns the index of the first occurrence of a value in an array.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
*/
* Returns the index of the first occurrence of a value in an array.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at index 0.
*/
indexOf<T>(array: ArrayLike<T>, searchElement: T, fromIndex?: number): number;
/**
* Returns the index of the last occurrence of a specified value in an array.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.
*/
* Returns the index of the last occurrence of a specified value in an array.
* @param searchElement The value to locate in the array.
* @param fromIndex The array index at which to begin the search. If fromIndex is omitted, the search starts at the last index in the array.
*/
lastIndexOf<T>(array: ArrayLike<T>, earchElement: T, fromIndex?: number): number;
/**
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments.
* The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
* Determines whether all the members of an array satisfy the specified test.
* @param callbackfn A function that accepts up to three arguments.
* The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
every<T>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments.
* The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments.
* The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
some<T>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
/**
* Performs the specified action for each element in an array.
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
* Performs the specified action for each element in an array.
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
forEach<T>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => void, thisArg?: any): void;
/**
* Calls a defined callback function on each element of an array, and returns an array that contains the results.
* @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
* Calls a defined callback function on each element of an array, and returns an array that contains the results.
* @param callbackfn A function that accepts up to three arguments. The map method calls the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
map<T, U>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => U, thisArg?: any): U[];
/**
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
* Returns the elements of an array that meet the condition specified in a callback function.
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
filter<T>(array: ArrayLike<T>, callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): T[];
/**
* Calls the specified callback function for all the elements in an array.
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
* The first call to the callbackfn function provides this value as an argument instead of an array value.
*/
* Calls the specified callback function for all the elements in an array.
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
* The first call to the callbackfn function provides this value as an argument instead of an array value.
*/
reduce<T, U>(array: ArrayLike<T>, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
/**
* Calls the specified callback function for all the elements in an array.
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
* The first call to the callbackfn function provides this value as an argument instead of an array value.
*/
* Calls the specified callback function for all the elements in an array.
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
* The first call to the callbackfn function provides this value as an argument instead of an array value.
*/
reduce<T>(array: ArrayLike<T>, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
* The first call to the callbackfn function provides this value as an argument instead of an array value.
*/
* Calls the specified callback function for all the elements in an array, in descending order.
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
* The first call to the callbackfn function provides this value as an argument instead of an array value.
*/
reduceRight<T, U>(array: ArrayLike<T>, callbackfn: (previousValue: U, currentValue: T, currentIndex: number, array: T[]) => U, initialValue: U): U;
/**
* Calls the specified callback function for all the elements in an array, in descending order.
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
* The first call to the callbackfn function provides this value as an argument instead of an array value.
*/
* Calls the specified callback function for all the elements in an array, in descending order.
* The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduceRight method calls the callbackfn function one time for each element in the array.
* @param initialValue If initialValue is specified, it is used as the initial value to start the accumulation.
* The first call to the callbackfn function provides this value as an argument instead of an array value.
*/
reduceRight<T>(array: ArrayLike<T>, callbackfn: (previousValue: T, currentValue: T, currentIndex: number, array: T[]) => T, initialValue?: T): T;
/**
* Returns an array of key, value pairs for every entry in the array
*/
* Returns an array of key, value pairs for every entry in the array
*/
entries<T>(array: ArrayLike<T>): IterableIterator<[number, T]>;
/**
* Returns an list of keys in the array
*/
* Returns an list of keys in the array
*/
keys<T>(array: ArrayLike<T>): IterableIterator<number>;
/**
* Returns an list of values in the array
*/
* Returns an list of values in the array
*/
values<T>(array: ArrayLike<T>): IterableIterator<T>;
/**
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find<T>(array: ArrayLike<T>, predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): T;
/**
* Returns the index of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
* Returns the index of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
findIndex<T>(array: ArrayLike<T>, predicate: (value: T) => boolean, thisArg?: any): number;
/**
* Returns the this object after filling the section identified by start and end with value
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
* Returns the this object after filling the section identified by start and end with value
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill<T>(array: ArrayLike<T>, value: T, start?: number, end?: number): T[];
/**
* Returns the this object after copying a section of the array identified by start and end
* to the same array starting at position target
* @param target If target is negative, it is treated as length+target where length is the
* length of the array.
* @param start If start is negative, it is treated as length+start. If end is negative, it
* is treated as length+end.
* @param end If not specified, length of the this object is used as its default value.
*/
* Returns the this object after copying a section of the array identified by start and end
* to the same array starting at position target
* @param target If target is negative, it is treated as length+target where length is the
* length of the array.
* @param start If start is negative, it is treated as length+start. If end is negative, it
* is treated as length+end.
* @param end If not specified, length of the this object is used as its default value.
*/
copyWithin<T>(array: ArrayLike<T>, target: number, start: number, end?: number): T[];
includes<T>(array: ArrayLike<T>, value: T, fromIndex?: number): boolean;
@@ -290,23 +290,23 @@ interface ArrayConstructor {
interface ObjectConstructor {
/**
* Non-standard.
*/
* Non-standard.
*/
isObject(value: any): boolean;
/**
* Non-standard.
*/
* Non-standard.
*/
classof(value: any): string;
/**
* Non-standard.
*/
* Non-standard.
*/
define<T>(target: T, mixin: any): T;
/**
* Non-standard.
*/
* Non-standard.
*/
make<T>(proto: T, mixin?: any): T;
}
@@ -322,8 +322,8 @@ interface Log extends Console {
}
/**
* Non-standard.
*/
* Non-standard.
*/
declare var log: Log;
// #############################################################################################
@@ -369,8 +369,8 @@ interface DictConstructor {
}
/**
* Non-standard.
*/
* Non-standard.
*/
declare var Dict: DictConstructor;
// #############################################################################################
@@ -380,8 +380,8 @@ declare var Dict: DictConstructor;
interface Function {
/**
* Non-standard.
*/
* Non-standard.
*/
part(...args: any[]): any;
}
@@ -392,13 +392,13 @@ interface Function {
interface Date {
/**
* Non-standard.
*/
* Non-standard.
*/
format(template: string, locale?: string): string;
/**
* Non-standard.
*/
* Non-standard.
*/
formatUTC(template: string, locale?: string): string;
}
@@ -409,13 +409,13 @@ interface Date {
interface Array<T> {
/**
* Non-standard.
*/
* Non-standard.
*/
turn<U>(callbackfn: (memo: U, value: T, index: number, array: T[]) => void, memo?: U): U;
/**
* Non-standard.
*/
* Non-standard.
*/
turn(callbackfn: (memo: T[], value: T, index: number, array: T[]) => void, memo?: T[]): T[];
}
@@ -426,8 +426,8 @@ interface Array<T> {
interface Number {
/**
* Non-standard.
*/
* Non-standard.
*/
[Symbol.iterator](): IterableIterator<number>;
}
@@ -438,13 +438,13 @@ interface Number {
interface String {
/**
* Non-standard.
*/
* Non-standard.
*/
escapeHTML(): string;
/**
* Non-standard.
*/
* Non-standard.
*/
unescapeHTML(): string;
}

View File

@@ -4,7 +4,6 @@ cpy(['src/*.png', '!src/goat.png'], 'dist').then(() => {
console.log('files copied');
});
cpy('foo.js', 'destination', {
rename: basename => `prefix-${basename}`
});
});

View File

@@ -4,4 +4,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = cpy;
declare function cpy(src: string | string[], dest: string, opts?: { cwd?: string, parents?: boolean, rename?: (s: string) => string }): Promise<void>;
declare function cpy(
src: string | string[],
dest: string,
opts?: { cwd?: string, parents?: boolean, rename?(s: string): string }): Promise<void>;

View File

@@ -7,7 +7,6 @@ const c = new Croppie(document.getElementById('item'), {
enableOrientation: false,
});
c.bind({
url: 'demo/demo-2.jpg',
orientation: 4,

View File

@@ -27,7 +27,6 @@ export default class Croppie {
destroy(): void;
}
export type CropType = 'square' | 'circle';
export type Format = 'jpeg' | 'png' | 'webp';

16
types/csrf/csrf-tests.ts Normal file
View File

@@ -0,0 +1,16 @@
import Tokens = require('csrf');
const csrf = new Tokens();
// test synchronous secret/token creation
const secret = csrf.secretSync();
const token = csrf.create(secret);
csrf.verify(secret, token);
// test asynchronous secret/token creation
csrf.secret((err: Error, secret: string) => {
if (err) throw err;
const token = csrf.create(secret);
csrf.verify(secret, token);
});

62
types/csrf/index.d.ts vendored Normal file
View File

@@ -0,0 +1,62 @@
// Type definitions for b_ 1.3
// Project: https://github.com/pillarjs/csrf
// Definitions by: Markis Taylor <https://github.com/markis>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type SecretCallback = (err: Error | null, secret: string) => void;
interface TokensOptions {
/**
* The string length of the salt (default: 8)
*/
saltLength: number;
/**
* The byte length of the secret key (default: 18)
*/
secretLength: number;
}
declare class Tokens {
/**
* Token generation/verification class.
*
* @param {object} [options]
* @param {number} [options.saltLength=8] The string length of the salt
* @param {number} [options.secretLength=18] The byte length of the secret key
* @public
*/
constructor(options?: TokensOptions)
/**
* Create a new CSRF token.
*
* @param {string} secret The secret for the token.
* @public
*/
create(secret: string): string;
/**
* Create a new secret key.
*
* @param {function} [callback]
* @public
*/
secret(callback?: SecretCallback): Promise<string>;
/**
* Create a new secret key synchronously.
* @public
*/
secretSync(): string;
/**
* Verify if a given token is valid for a given secret.
*
* @param {string} secret
* @param {string} token
* @public
*/
verify(secret: string, token: string): boolean;
}
export = Tokens;

22
types/csrf/tsconfig.json Normal file
View File

@@ -0,0 +1,22 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"csrf-tests.ts"
]
}

1
types/csrf/tslint.json Normal file
View File

@@ -0,0 +1 @@
{ "extends": "../tslint.json" }

View File

@@ -12,7 +12,6 @@ stringify([["1", "2", "3"], ["4", "5", "6"]], {
// nothing
});
stream = stringify({ delimiter: "," });
stream.write(["1", "2", "3"]);

View File

@@ -55,7 +55,6 @@ declare namespace stringify {
* special values are 'auto', 'unix', 'mac', 'windows', 'unicode'; defaults to 'auto' (discovered in source or 'unix' if no source is specified).
*/
rowDelimiter?: string;
}
interface Stringifier extends NodeJS.ReadWriteStream {

View File

@@ -183,7 +183,7 @@ declare namespace csvtojson {
* @param {string} str the string to convert
* @return {Converter} returns this object for chaining
*/
fromString(str: string): this
fromString(str: string): this;
/**
* Reads in a CSV from a string.
@@ -197,7 +197,7 @@ declare namespace csvtojson {
* @param {string} filePath the path to the CSV file
* @return {Converter} returns this object for chaining
*/
fromFile(filePath: string): this
fromFile(filePath: string): this;
/**
* Reads in a CSV from a file.
@@ -211,7 +211,7 @@ declare namespace csvtojson {
* @param {Stream} stream the stream
* @return {Converter} returns this object for chaining
*/
fromStream(stream: NodeJS.ReadableStream): this
fromStream(stream: NodeJS.ReadableStream): this;
/**
* Reads in a CSV from a stream.

View File

@@ -1 +1,6 @@
{ "extends": "../tslint.json" }
{
"extends": "../tslint.json",
"rules": {
"ban-types": false
}
}

View File

@@ -1,2 +1,2 @@
import { currencies } from "./index";
export = currencies;
export = currencies;

View File

@@ -42,6 +42,5 @@ currencyFormatter.format(-10, {
// => ($10)
import currencies = require('currency-formatter/currencies');
currencies === currencyFormatter.currencies;

View File

@@ -153,8 +153,8 @@ export function bisectRight(array: Date[], x: Date, lo?: number, hi?: number): n
export const bisect: typeof bisectRight;
export interface Bisector<T, U> {
left: (array: T[], x: U, lo?: number, hi?: number) => number;
right: (array: T[], x: U, lo?: number, hi?: number) => number;
left(array: T[], x: U, lo?: number, hi?: number): number;
right(array: T[], x: U, lo?: number, hi?: number): number;
}
export function bisector<T, U>(comparator: (a: T, b: U) => number): Bisector<T, U>;

View File

@@ -61,10 +61,10 @@ export interface Axis<Domain> {
(context: Selection<AxisContainerElement, any, any, any>): void;
/**
* Render the axis to the given context.
*
* @param context A transition defined on SVG containers (either SVG or G elements).
*/
* Render the axis to the given context.
*
* @param context A transition defined on SVG containers (either SVG or G elements).
*/
(context: TransitionLike<AxisContainerElement, any>): void;
/**
@@ -142,10 +142,10 @@ export interface Axis<Domain> {
tickArguments(args: [AxisTimeInterval, string]): this;
/**
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
*
* @param args An array with arguments suitable for the scale to be used for tick generation
*/
* Sets the arguments that will be passed to scale.ticks and scale.tickFormat when the axis is rendered, and returns the axis generator.
*
* @param args An array with arguments suitable for the scale to be used for tick generation
*/
tickArguments(args: any[]): this;
/**

View File

@@ -55,7 +55,6 @@ let circleDrag: d3Drag.DragBehavior<SVGCircleElement, CircleDatum, CircleDatum |
// This drag behavior will use a custom subject accessor to set the subject of the drag event
let circleCustomDrag: d3Drag.DragBehavior<SVGCircleElement, CircleDatum, CustomSubject | d3Drag.SubjectPosition>;
// create new drag behavior ------------------------------------------
circleDrag = d3Drag.drag<SVGCircleElement, CircleDatum>(); // Use short form method
@@ -99,7 +98,6 @@ filterFn = function(d) {
// chainable
circleDrag = circleDrag.filter(function(d, i, group) {
return (d.color !== 'green' && this.r.baseVal.value < 10) ? !event.button : true; // 'this' is SVGCircleElement and d is CircleDatum
});
@@ -192,10 +190,8 @@ const wrongSelection: Selection<HTMLDivElement, any, any, any> = select<HTMLDivE
// Test Drag Event Interface
// -----------------------------------------------------------------------------
let e: d3Drag.D3DragEvent<SVGCircleElement, CircleDatum, CircleDatum | d3Drag.SubjectPosition> = event;
circleDrag = e.target; // target return drag behavior
const type: string = e.type;
@@ -224,7 +220,6 @@ handler = e.on('dragged');
// fails, handler with wrong datum type
// let wrongHandler4: ((this:SVGCircleElement, d:{test: number}, i: number, group: SVGCircleElement[] | NodeListOf<SVGCircleElement>)=> void) | undefined = e.on('dragged');
// -----------------------------------------------------------------------------
// Test dragDisable() and dragEnable()
// -----------------------------------------------------------------------------

View File

@@ -7,12 +7,10 @@
import { ArrayLike, Selection, ValueFn } from 'd3-selection';
// --------------------------------------------------------------------------
// Shared Type Definitions and Interfaces
// --------------------------------------------------------------------------
/**
* DraggedElementBaseType serves as an alias for the 'minimal' data type which can be selected
* without 'd3-drag' (and related code in 'd3-selection') trying to use properties internally which would otherwise not
@@ -20,7 +18,6 @@ import { ArrayLike, Selection, ValueFn } from 'd3-selection';
*/
export type DraggedElementBaseType = Element;
/**
* Container element type usable for mouse/touch functions
*/

View File

@@ -4,11 +4,11 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/** A parser and formatter for DSV (CSV and TSV) files. Extracted from D3. */
declare var loader: (
/** the symbol used to seperate cells in the row.*/
declare function loader(
/** the symbol used to seperate cells in the row. */
delimiter: string,
/** example: "text/plain" */
encoding?: string) => D3Dsv;
encoding?: string): D3Dsv;
export = loader;
export as namespace d3_dsv;
@@ -16,21 +16,21 @@ export as namespace d3_dsv;
/** A parser and formatter for DSV (CSV and TSV) files. Extracted from D3. */
interface D3Dsv {
/**
Parses the specified string, which is the contents of a CSV file, returning an array of objects representing the parsed rows.
The string is assumed to be RFC4180-compliant.
Unlike the parseRows method, this method requires that the first line of the CSV file contains a comma-separated list of column names;
these column names become the attributes on the returned objects.
For example, consider the following CSV file:
Year,Make,Model,Length
1997,Ford,E350,2.34
2000,Mercury,Cougar,2.38
The resulting JavaScript array is:
[ {"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"},
{"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"} ]
*/
* Parses the specified string, which is the contents of a CSV file, returning an array of objects representing the parsed rows.
* The string is assumed to be RFC4180-compliant.
* Unlike the parseRows method, this method requires that the first line of the CSV file contains a comma-separated list of column names;
* these column names become the attributes on the returned objects.
* For example, consider the following CSV file:
*
* Year,Make,Model,Length
* 1997,Ford,E350,2.34
* 2000,Mercury,Cougar,2.38
*
* The resulting JavaScript array is:
*
* [ {"Year": "1997", "Make": "Ford", "Model": "E350", "Length": "2.34"},
* {"Year": "2000", "Make": "Mercury", "Model": "Cougar", "Length": "2.38"} ]
*/
parse<TRow>(
table: string,
/** coerce cells (strings) into different types or modify them. return null to strip this row from the output results. */
@@ -38,42 +38,42 @@ interface D3Dsv {
): TRow[];
/**
Parses the specified string, which is the contents of a CSV file, returning an array of arrays representing the parsed rows.
The string is assumed to be RFC4180-compliant.
Unlike the parse method, this method treats the header line as a standard row, and should be used whenever the CSV file does not contain a header.
Each row is represented as an array rather than an object.
Rows may have variable length.
For example, consider the following CSV file:
1997,Ford,E350,2.34
2000,Mercury,Cougar,2.38
The resulting JavaScript array is:
[ ["1997", "Ford", "E350", "2.34"],
["2000", "Mercury", "Cougar", "2.38"] ]
Note that the values themselves are always strings; they will not be automatically converted to numbers. See parse for details.
*/
* Parses the specified string, which is the contents of a CSV file, returning an array of arrays representing the parsed rows.
* The string is assumed to be RFC4180-compliant.
* Unlike the parse method, this method treats the header line as a standard row, and should be used whenever the CSV file does not contain a header.
* Each row is represented as an array rather than an object.
* Rows may have variable length.
* For example, consider the following CSV file:
*
* 1997,Ford,E350,2.34
* 2000,Mercury,Cougar,2.38
* The resulting JavaScript array is:
*
* [ ["1997", "Ford", "E350", "2.34"],
* ["2000", "Mercury", "Cougar", "2.38"] ]
* Note that the values themselves are always strings; they will not be automatically converted to numbers. See parse for details.
*/
parseRows<TRow>(
table: string,
/** coerce cells (strings) into different types or modify them. return null to strip this row from the output results.*/
/** coerce cells (strings) into different types or modify them. return null to strip this row from the output results. */
accessor?: (row: string[]) => TRow
): TRow[];
/**
Converts the specified array of rows into comma-separated values format, returning a string.
This operation is the reverse of parse.
Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,).
Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes.
Each row should be an object, and all object properties will be converted into fields.
For greater control over which properties are converted, convert the rows into arrays containing only the properties that should be converted and use formatRows.
*/
* Converts the specified array of rows into comma-separated values format, returning a string.
* This operation is the reverse of parse.
* Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,).
* Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes.
*
* Each row should be an object, and all object properties will be converted into fields.
* For greater control over which properties are converted, convert the rows into arrays containing only the properties that should be converted and use formatRows.
*/
format(rows: any[]): string;
/**
Converts the specified array of rows into comma-separated values format, returning a string.
This operation is the reverse of parseRows. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,).
Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes.
*/
* Converts the specified array of rows into comma-separated values format, returning a string.
* This operation is the reverse of parseRows. Each row will be separated by a newline (\n), and each column within each row will be separated by a comma (,).
* Values that contain either commas, double-quotes (") or newlines will be escaped using double-quotes.
*/
formatRows(rows: any[]): string;
}

View File

@@ -23,7 +23,6 @@ t_out = d3Ease.easeCubicIn(t_in);
t_out = d3Ease.easeCubicOut(t_in);
t_out = d3Ease.easeCubicInOut(t_in);
let easePolyFactory: d3Ease.PolynomialEasingFactory;
easePolyFactory = d3Ease.easePoly;

View File

@@ -94,25 +94,24 @@ export interface PolynomialEasingFactory {
* Symmetric polynomial easing/easing factory; scales polyIn for t in [0, 0.5] and polyOut for t in [0.5, 1].
* If the exponent is not specified, it defaults to 3, equivalent to cubic.
*/
export var easePoly: PolynomialEasingFactory;
export const easePoly: PolynomialEasingFactory;
/**
* Polynomial easing/easing factory; raises t to the specified exponent.
* If the exponent is not specified, it defaults to 3, equivalent to cubicIn.
*/
export var easePolyIn: PolynomialEasingFactory;
export const easePolyIn: PolynomialEasingFactory;
/**
* Reverse polynomial easing/easing factory; equivalent to 1 - polyIn(1 - t).
* If the exponent is not specified, it defaults to 3, equivalent to cubicOut.
*/
export var easePolyOut: PolynomialEasingFactory;
export const easePolyOut: PolynomialEasingFactory;
/**
* Symmetric polynomial easing/easing factory; scales polyIn for t in [0, 0.5] and polyOut for t in [0.5, 1].
* If the exponent is not specified, it defaults to 3, equivalent to cubic.
*/
export var easePolyInOut: PolynomialEasingFactory;
export const easePolyInOut: PolynomialEasingFactory;
/**
* Symmetric sinusoidal easing; scales sinIn for t in [0, 0.5] and sinOut for t in [0.5, 1].
@@ -226,7 +225,6 @@ export function easeBounceOut(normalizedTime: number): number;
*/
export function easeBounceInOut(normalizedTime: number): number;
/**
* Anticipatory easing function factory
*/
@@ -249,26 +247,25 @@ export interface BackEasingFactory {
* Symmetric anticipatory easing; scales backIn for t in [0, 0.5] and backOut for t in [0.5, 1].
* The degree of overshoot is configurable; it not specified, it defaults to 1.70158.
*/
export var easeBack: BackEasingFactory;
export const easeBack: BackEasingFactory;
/**
* Anticipatory easing, like a dancer bending his knees before jumping off the floor.
* The degree of overshoot is configurable; it not specified, it defaults to 1.70158.
*/
export var easeBackIn: BackEasingFactory;
export const easeBackIn: BackEasingFactory;
/**
* Reverse anticipatory easing; equivalent to 1 - backIn(1 - t).
* The degree of overshoot is configurable; it not specified, it defaults to 1.70158.
*/
export var easeBackOut: BackEasingFactory;
export const easeBackOut: BackEasingFactory;
/**
* Symmetric anticipatory easing; scales backIn for t in [0, 0.5] and backOut for t in [0.5, 1].
* The degree of overshoot is configurable; it not specified, it defaults to 1.70158.
*/
export var easeBackInOut: BackEasingFactory;
export const easeBackInOut: BackEasingFactory;
/**
* Elastic easing function factory
@@ -287,11 +284,11 @@ export interface ElasticEasingFactory {
*/
amplitude(a: number): ElasticEasingFactory;
/**
* Returns a new elastic easing with the specified amplitude a.
* Defaults to 0.3,if not specified.
*
* @param p Period for elastic easing.
*/
* Returns a new elastic easing with the specified amplitude a.
* Defaults to 0.3,if not specified.
*
* @param p Period for elastic easing.
*/
period(p: number): ElasticEasingFactory;
}
@@ -300,25 +297,25 @@ export interface ElasticEasingFactory {
* The amplitude and period of the oscillation are configurable;
* if not specified, they default to 1 and 0.3, respectively.
*/
export var easeElastic: ElasticEasingFactory;
export const easeElastic: ElasticEasingFactory;
/**
* Elastic easing, like a rubber band.
* The amplitude and period of the oscillation are configurable;
* if not specified, they default to 1 and 0.3, respectively.
*/
export var easeElasticIn: ElasticEasingFactory;
export const easeElasticIn: ElasticEasingFactory;
/**
* Reverse elastic easing; equivalent to 1 - elasticIn(1 - t).
* The amplitude and period of the oscillation are configurable;
* if not specified, they default to 1 and 0.3, respectively.
*/
export var easeElasticOut: ElasticEasingFactory;
export const easeElasticOut: ElasticEasingFactory;
/**
* Symmetric elastic easing; scales elasticIn for t in [0, 0.5] and elasticOut for t in [0.5, 1].
* The amplitude and period of the oscillation are configurable;
* if not specified, they default to 1 and 0.3, respectively.
*/
export var easeElasticInOut: ElasticEasingFactory;
export const easeElasticInOut: ElasticEasingFactory;

View File

@@ -6,7 +6,6 @@
* are not intended as functional tests.
*/
import * as d3Force from 'd3-force';
// -------------------------------------------------------------------------------------
@@ -30,7 +29,6 @@ interface Graph {
links: SimLink[];
}
const graph: Graph = {
nodes: [
{ id: 'Myriel', group: 1, r: 5 },
@@ -112,7 +110,6 @@ forceCollide = d3Force.forceCollide<SimNode>((node, index, nodes) => {
return n.r;
});
// Configure Collision force -----------------------------------------------------------
let radiusAccessor: (node: SimNode, i: number, nodes: SimNode[]) => number;
@@ -139,7 +136,6 @@ num = forceCollide.strength();
forceCollide = forceCollide.iterations(10);
num = forceCollide.iterations();
// Use Collision force -----------------------------------------------------------------
forceCollide.initialize(graph.nodes);
@@ -157,7 +153,6 @@ forceLink = d3Force.forceLink<SimNode, SimLink>();
// with link data
forceLink = d3Force.forceLink<SimNode, SimLink>(graph.links);
// Configure Link force -----------------------------------------------------------
let linkNumberAccessor: (link: SimLink, i: number, links: SimLink[]) => number;
@@ -181,7 +176,6 @@ num = simLink.value;
num = simLink.d;
num = simLink.s;
// id (node id accessor)
forceLink = forceLink.id((node, index, nodes) => {
@@ -220,13 +214,11 @@ linkNumberAccessor = forceLink.strength();
forceLink = forceLink.iterations(10);
num = forceLink.iterations();
// Use Link force -----------------------------------------------------------------
forceLink.initialize(graph.nodes);
forceLink(0.1); // alpha
// ManyBody ============================================================================
// create ManyBody force --------------------------------------------------------------
@@ -255,7 +247,6 @@ simNodeNumberAccessor = forceCharge.strength();
forceCharge = forceCharge.theta(0.8);
num = forceCharge.theta();
// distanceMin
forceCharge = forceCharge.distanceMin(1);
@@ -266,13 +257,11 @@ num = forceCharge.distanceMin();
forceCharge = forceCharge.distanceMax(1000);
num = forceCharge.distanceMax();
// Use ManyBody force -----------------------------------------------------------------
forceCharge.initialize(graph.nodes);
forceCharge(0.1); // alpha
// ForceX ==============================================================================
// create ForceX force --------------------------------------------------------------
@@ -327,7 +316,6 @@ simNodeNumberAccessor = forcePosX.x();
forcePosX.initialize(graph.nodes);
forcePosX(0.1); // alpha
// ForceY ==============================================================================
// create ForceY force --------------------------------------------------------------
@@ -388,7 +376,6 @@ forcePosY(0.1); // alpha
// Create Force Simulation =============================================================
let nodeSimulation: d3Force.Simulation<SimNode, undefined>;
let nodeLinkSimulation: d3Force.Simulation<SimNode, SimLink>;
@@ -435,7 +422,6 @@ num = nodeLinkSimulation.alphaTarget();
nodeLinkSimulation = nodeLinkSimulation.velocityDecay(0.4);
num = nodeLinkSimulation.velocityDecay();
// force() -----------------------------------------------------------------------------
nodeSimulation = nodeSimulation.force('posx', forcePosX);
@@ -444,7 +430,6 @@ nodeSimulation.force('posy', forcePosY);
// Remove force
nodeSimulation = nodeSimulation.force('posx', null);
nodeLinkSimulation = nodeLinkSimulation.force('link', forceLink);
nodeLinkSimulation
@@ -480,7 +465,6 @@ simLinks = nodeLinkSimulation.force<d3Force.ForceLink<SimNode, SimLink>>('link')
// fLink = nodeLinkSimulation.force('link')!; // fails, as ForceLink specific properties are missing from 'generic' force
// on() --------------------------------------------------------------------------------
function drawLink(d: SimLink) {
@@ -502,7 +486,6 @@ function drawNode(d: SimNode) {
}
nodeLinkSimulation = nodeLinkSimulation.on('tick', function ticked() {
const that: d3Force.Simulation<SimNode, SimLink> = this;
if (context) {

View File

@@ -3,7 +3,6 @@
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Last module patch version validated against: 1.0.4
// -----------------------------------------------------------------------
@@ -356,7 +355,6 @@ export interface Force<NodeDatum extends SimulationNodeDatum, LinkDatum extends
initialize?(nodes: NodeDatum[]): void;
}
// Centering ------------------------------------------------------------
/**
@@ -668,7 +666,6 @@ export interface ForceLink<NodeDatum extends SimulationNodeDatum, LinkDatum exte
* @param iterations Number of iterations.
*/
iterations(iterations: number): this;
}
/**

View File

@@ -597,7 +597,7 @@ const context: d3Geo.GeoContext = {
// geoTransform(...) ====================================================
const transformFunction: { stream: (s: d3Geo.GeoStream) => {} } = d3Geo.geoTransform({});
const transformFunction: { stream(s: d3Geo.GeoStream): {} } = d3Geo.geoTransform({});
interface CustomTranformProto extends d3Geo.GeoTransformPrototype {
a: number;
@@ -612,7 +612,7 @@ customTransformProto = {
a: 10
};
const t: { stream: (s: d3Geo.GeoStream) => (CustomTranformProto & d3Geo.GeoStream) } = d3Geo.geoTransform(customTransformProto);
const t: { stream(s: d3Geo.GeoStream): CustomTranformProto & d3Geo.GeoStream } = d3Geo.geoTransform(customTransformProto);
// geoIdentity() ========================================================

View File

@@ -699,14 +699,14 @@ export interface GeoProjection extends GeoStreamWrapper {
*/
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature<GeoGeometryObjects, any>): this;
/**
* Sets the projections scale and translate to fit the specified geographic feature collection in the center of the given extent.
* Returns the projection.
*
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
*
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
*/
* Sets the projections scale and translate to fit the specified geographic feature collection in the center of the given extent.
* Returns the projection.
*
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
*
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
*/
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): this;
/**
* Sets the projections scale and translate to fit the specified geographic geometry object in the center of the given extent.
@@ -719,14 +719,14 @@ export interface GeoProjection extends GeoStreamWrapper {
*/
fitExtent(extent: [[number, number], [number, number]], object: GeoGeometryObjects): this;
/**
* Sets the projections scale and translate to fit the specified geographic geometry collection in the center of the given extent.
* Returns the projection.
*
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
*
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
*/
* Sets the projections scale and translate to fit the specified geographic geometry collection in the center of the given extent.
* Returns the projection.
*
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
*
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
*/
fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection<GeoGeometryObjects>): this;
/**
@@ -1340,7 +1340,7 @@ export interface GeoTransformPrototype {
*
* @param methods An object with custom method implementations, which are used to create a transform projection.
*/
export function geoTransform<T extends GeoTransformPrototype>(methods: T): { stream: (s: GeoStream) => (T & GeoStream) };
export function geoTransform<T extends GeoTransformPrototype>(methods: T): { stream(s: GeoStream): T & GeoStream };
// geoIdentity() =================================================================
@@ -1382,14 +1382,14 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
*/
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeature<GeoGeometryObjects, any>): this;
/**
* Sets the projections scale and translate to fit the specified geographic feature collection in the center of the given extent.
* Returns the projection.
*
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
*
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
*/
* Sets the projections scale and translate to fit the specified geographic feature collection in the center of the given extent.
* Returns the projection.
*
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
*
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
* @param object A geographic feature collection supported by d3-geo (An extension of GeoJSON feature collection).
*/
fitExtent(extent: [[number, number], [number, number]], object: ExtendedFeatureCollection<ExtendedFeature<GeoGeometryObjects, any>>): this;
/**
* Sets the projections scale and translate to fit the specified geographic geometry object in the center of the given extent.
@@ -1402,14 +1402,14 @@ export interface GeoIdentityTranform extends GeoStreamWrapper {
*/
fitExtent(extent: [[number, number], [number, number]], object: GeoGeometryObjects): this;
/**
* Sets the projections scale and translate to fit the specified geographic geometry collection in the center of the given extent.
* Returns the projection.
*
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
*
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
*/
* Sets the projections scale and translate to fit the specified geographic geometry collection in the center of the given extent.
* Returns the projection.
*
* Any clip extent is ignored when determining the new scale and translate. The precision used to compute the bounding box of the given object is computed at an effective scale of 150.
*
* @param extent The extent, specified as an array [[x₀, y₀], [x₁, y₁]], where x₀ is the left side of the bounding box, y₀ is the top, x₁ is the right and y₁ is the bottom.
* @param object A geographic geometry collection supported by d3-geo (An extension of GeoJSON geometry collection).
*/
fitExtent(extent: [[number, number], [number, number]], object: ExtendedGeometryCollection<GeoGeometryObjects>): this;
/**

View File

@@ -92,7 +92,6 @@ linearScaleNumString = linearScaleNumString.domain(domainNumeric);
linearScaleNumString = linearScaleNumString.domain(domainNumbers);
domainNumbers = linearScaleNumString.domain();
// range(...) -----------------------------------------------------------------
linearScaleNumber = linearScaleNumber.range(rangeNumbers);
@@ -138,7 +137,6 @@ linearScaleNumString = linearScaleNumber.interpolate((a, b) => {
// nice(...) -----------------------------------------------------------------------
// chainable
linearScaleNumber = linearScaleNumber.nice();
linearScaleNumber = linearScaleNumber.nice(5);
@@ -180,7 +178,6 @@ powerScaleNumber = d3Scale.scalePow();
powerScaleString = d3Scale.scalePow<string>();
powerScaleNumString = d3Scale.scalePow<number, string>();
let squarerootScaleNumber: d3Scale.ScalePower<number, number>;
let squarerootScaleString: d3Scale.ScalePower<string, string>;
let squarerootScaleNumString: d3Scale.ScalePower<number, string>;
@@ -211,7 +208,6 @@ powerScaleNumString = powerScaleNumString.domain(domainNumeric);
powerScaleNumString = powerScaleNumString.domain(domainNumbers);
domainNumbers = powerScaleNumString.domain();
// range(...) -----------------------------------------------------------------
powerScaleNumber = powerScaleNumber.range(rangeNumbers);
@@ -282,7 +278,6 @@ const copiedPowerScale: d3Scale.ScalePower<number, string> = powerScaleNumString
// Logarithmic Scale Factory
// -------------------------------------------------------------------------------
// scaleLog() ---------------------------------------------------------------------
let logScaleNumber: d3Scale.ScaleLogarithmic<number, number>;
@@ -293,7 +288,6 @@ logScaleNumber = d3Scale.scaleLog();
logScaleString = d3Scale.scaleLog<string>();
logScaleNumString = d3Scale.scaleLog<number, string>();
// ScaleLogarithmic Interface ========================================================
// base --------------------------------------------------------------------
@@ -316,7 +310,6 @@ logScaleNumString = logScaleNumString.domain(domainNumeric);
logScaleNumString = logScaleNumString.domain(domainNumbers);
domainNumbers = logScaleNumString.domain();
// range(...) -----------------------------------------------------------------
logScaleNumber = logScaleNumber.range(rangeNumbers);
@@ -393,10 +386,8 @@ let identityScale: d3Scale.ScaleIdentity;
identityScale = d3Scale.scaleIdentity();
// ScaleIdentity Interface ========================================================
// domain(...) -----------------------------------------------------------------
identityScale = identityScale.domain(domainNumeric);
@@ -434,12 +425,10 @@ tickFormatNumberFn = identityScale.tickFormat(5, '+%');
outputNumber = identityScale(10);
// copy(...) -----------------------------------------------------------------
const copiedIdentityScale: d3Scale.ScaleIdentity = identityScale.copy();
// -------------------------------------------------------------------------------
// Time Scale Factories
// -------------------------------------------------------------------------------
@@ -454,7 +443,6 @@ localTimeScaleNumber = d3Scale.scaleTime();
localTimeScaleString = d3Scale.scaleTime<string>();
localTimeScaleNumString = d3Scale.scaleTime<number, string>();
let utcScaleNumber: d3Scale.ScaleTime<number, number>;
let utcScaleString: d3Scale.ScaleTime<string, string>;
let utcScaleNumString: d3Scale.ScaleTime<number, string>;
@@ -475,7 +463,6 @@ domainDates = localTimeScaleString.domain();
localTimeScaleNumString = localTimeScaleNumString.domain(domainDates);
domainDates = localTimeScaleNumString.domain();
// range(...) -----------------------------------------------------------------
localTimeScaleNumber = localTimeScaleNumber.range(rangeNumbers);
@@ -534,7 +521,6 @@ if (timeInterval !== null) {
ticksDates = localTimeScaleNumString.ticks(timeInterval);
}
// tickFormat(...) -----------------------------------------------------------------
tickFormatDateFn = localTimeScaleNumber.tickFormat();
@@ -543,7 +529,6 @@ if (timeInterval !== null) {
tickFormatDateFn = localTimeScaleNumber.tickFormat(timeInterval, '%I %p');
}
// (...) value mapping from domain to output -----------------------------------
outputNumber = localTimeScaleNumber(new Date(2016, 6, 4));
@@ -595,8 +580,6 @@ outputString = sequentialScaleColorString(10);
const copiedSequentialScale: d3Scale.ScaleSequential<string> = sequentialScaleColorString.copy();
// -------------------------------------------------------------------------------
// Color Interpolators for Sequential Scale Factory
// -------------------------------------------------------------------------------
@@ -619,7 +602,6 @@ colorInterpolator = d3Scale.interpolateCool;
colorInterpolator = d3Scale.interpolateCubehelixDefault;
// -------------------------------------------------------------------------------
// Quantize Scale Factory
// -------------------------------------------------------------------------------
@@ -632,7 +614,6 @@ let quantizeScaleString: d3Scale.ScaleQuantize<string>;
quantizeScaleNumber = d3Scale.scaleQuantize();
quantizeScaleString = d3Scale.scaleQuantize<string>();
// ScaleQuantize Interface ========================================================
// domain(...) -----------------------------------------------------------------
@@ -649,7 +630,6 @@ rangeNumbers = quantizeScaleNumber.range();
quantizeScaleString = quantizeScaleString.range(['steelblue', 'brown']);
rangeStrings = quantizeScaleString.range();
// invertExtent(...) -----------------------------------------------------------------
numExtent = quantizeScaleNumber.invertExtent(500);
@@ -681,12 +661,10 @@ outputNumber = quantizeScaleNumber(0.51);
const copiedQuantizeScale: d3Scale.ScaleQuantize<number> = quantizeScaleNumber.copy();
// -------------------------------------------------------------------------------
// Quantile Scale Factory
// -------------------------------------------------------------------------------
// scaleQuantile() -----------------------------------------------------------------
let quantileScaleNumber: d3Scale.ScaleQuantile<number>;
@@ -695,7 +673,6 @@ let quantileScaleString: d3Scale.ScaleQuantile<string>;
quantileScaleNumber = d3Scale.scaleQuantile();
quantileScaleString = d3Scale.scaleQuantile<string>();
// ScaleQuantile Interface ========================================================
// domain(...) -----------------------------------------------------------------
@@ -714,7 +691,6 @@ rangeNumbers = quantileScaleNumber.range();
quantileScaleString = quantileScaleString.range(['q25', 'q50', 'q75']);
rangeStrings = quantileScaleString.range();
// invertExtent(...) -----------------------------------------------------------------
numExtent = quantileScaleNumber.invertExtent(2);
@@ -733,7 +709,6 @@ outputNumber = quantileScaleNumber(0.51);
const copiedQuantileScale: d3Scale.ScaleQuantile<number> = quantileScaleNumber.copy();
// -------------------------------------------------------------------------------
// Threshold Scale Factory
// -------------------------------------------------------------------------------
@@ -746,7 +721,6 @@ let thresholdScaleNumberString: d3Scale.ScaleThreshold<number, string>;
thresholdScaleNumberNumber = d3Scale.scaleThreshold();
thresholdScaleNumberString = d3Scale.scaleThreshold<number, string>();
// ScaleThreshold Interface ========================================================
// domain(...) -----------------------------------------------------------------
@@ -764,7 +738,6 @@ rangeNumbers = thresholdScaleNumberNumber.range();
thresholdScaleNumberString = thresholdScaleNumberString.range(['steelblue', 'seagreen', 'brown']);
rangeStrings = thresholdScaleNumberString.range();
// invertExtent(...) -----------------------------------------------------------------
numOrUndefinedExtent = thresholdScaleNumberNumber.invertExtent(100);
@@ -781,7 +754,6 @@ outputString = thresholdScaleNumberString(0.9);
const copiedThresholdScale: d3Scale.ScaleThreshold<number, string> = thresholdScaleNumberString.copy();
// -------------------------------------------------------------------------------
// Ordinal Scale Factory
// -------------------------------------------------------------------------------
@@ -794,7 +766,6 @@ let ordinalScaleStringNumber: d3Scale.ScaleOrdinal<string, number>;
ordinalScaleStringString = d3Scale.scaleOrdinal<string>();
ordinalScaleStringNumber = d3Scale.scaleOrdinal<string, number>();
// ScaleOrdinal Interface ========================================================
// domain(...) -----------------------------------------------------------------
@@ -812,7 +783,6 @@ rangeStrings = ordinalScaleStringString.range();
ordinalScaleStringNumber = ordinalScaleStringNumber.range([-1, 0, 1]);
rangeNumbers = ordinalScaleStringNumber.range();
// unknown(...) and d3Scale.scaleImplicit --------------------------------------
const implicit: { name: 'implicit' } = d3Scale.scaleImplicit;
@@ -839,7 +809,6 @@ outputNumber = ordinalScaleStringNumber('negative');
const copiedOrdinalScale: d3Scale.ScaleOrdinal<string, number> = ordinalScaleStringNumber.copy();
// -------------------------------------------------------------------------------
// Band Scale Factory
// -------------------------------------------------------------------------------
@@ -852,7 +821,6 @@ let bandScaleCoercible: d3Scale.ScaleBand<StringCoercible>;
bandScaleString = d3Scale.scaleBand();
bandScaleCoercible = d3Scale.scaleBand<StringCoercible>();
// ScaleBand Interface ========================================================
// domain(...) -----------------------------------------------------------------
@@ -870,12 +838,10 @@ let rangeExtent: [number, number] = bandScaleString.range();
bandScaleCoercible = bandScaleCoercible.range([0, 300]);
rangeExtent = bandScaleCoercible.range();
// rangeRound(...) -----------------------------------------------------------------
bandScaleString = bandScaleString.rangeRound([0, 300]);
// round(...) -----------------------------------------------------------------
bandScaleCoercible = bandScaleCoercible.round(true);
@@ -891,7 +857,6 @@ num = bandScaleString.paddingInner();
bandScaleString = bandScaleString.paddingOuter(0.1);
num = bandScaleString.paddingOuter();
// padding(...) -----------------------------------------------------------------
bandScaleString = bandScaleString.padding(0.1);
@@ -910,7 +875,6 @@ num = bandScaleString.bandwidth();
num = bandScaleString.step();
// (...) value mapping from domain to output -----------------------------------
outputNumberMaybe = bandScaleString('neutral');
@@ -921,7 +885,6 @@ outputNumberMaybe = bandScaleCoercible(new StringCoercible('negative'));
const copiedBandScale: d3Scale.ScaleBand<StringCoercible> = bandScaleCoercible.copy();
// -------------------------------------------------------------------------------
// Point Scale Factory
// -------------------------------------------------------------------------------
@@ -934,7 +897,6 @@ let pointScaleCoercible: d3Scale.ScalePoint<StringCoercible>;
pointScaleString = d3Scale.scalePoint();
pointScaleCoercible = d3Scale.scalePoint<StringCoercible>();
// ScalePoint Interface ========================================================
// domain(...) -----------------------------------------------------------------
@@ -952,18 +914,15 @@ rangeExtent = pointScaleString.range();
pointScaleCoercible = pointScaleCoercible.range([0, 300]);
rangeExtent = pointScaleCoercible.range();
// rangeRound(...) -----------------------------------------------------------------
pointScaleString = pointScaleString.rangeRound([0, 300]);
// round(...) -----------------------------------------------------------------
pointScaleCoercible = pointScaleCoercible.round(true);
roundingFlag = pointScaleCoercible.round();
// padding(...) -----------------------------------------------------------------
pointScaleString = pointScaleString.padding(0.1);

View File

@@ -33,16 +33,15 @@ export interface InterpolatorFactory<T, U> {
* A helper interface for a continuous scale defined over a numeric domain.
*/
export interface ScaleContinuousNumeric<Range, Output> {
/**
* Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
*
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
*
* Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
*
* @param value A numeric value from the domain.
*/
* Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
*
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
*
* Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
*
* @param value A numeric value from the domain.
*/
(value: number | { valueOf(): number }): Output;
/**
@@ -163,7 +162,6 @@ export interface ScaleContinuousNumeric<Range, Output> {
* Returns an exact copy of this scale. Changes to this scale will not affect the returned scale, and vice versa.
*/
copy(): this;
}
// -------------------------------------------------------------------------------
@@ -188,7 +186,6 @@ export interface ScaleContinuousNumeric<Range, Output> {
* convert the interpolated range element to a corresponding output element.
*/
export interface ScaleLinear<Range, Output> extends ScaleContinuousNumeric<Range, Output> {
/**
* Returns the scales current interpolator factory, which defaults to interpolate.
*/
@@ -222,7 +219,6 @@ export interface ScaleLinear<Range, Output> extends ScaleContinuousNumeric<Range
* @param interpolate An interpolation factory. The generics for Range and Output of the scale must correpond to the interpolation factory applied to the scale.
*/
interpolate<NewOutput>(interpolate: InterpolatorFactory<Range, NewOutput>): ScaleLinear<Range, NewOutput>;
}
/**
@@ -281,7 +277,6 @@ export function scaleLinear<Range, Output>(): ScaleLinear<Range, Output>;
* convert the interpolated range element to a corresponding output element.
*/
export interface ScalePower<Range, Output> extends ScaleContinuousNumeric<Range, Output> {
/**
* Returns the scales current interpolator factory, which defaults to interpolate.
*/
@@ -428,7 +423,6 @@ export function scaleSqrt<Range, Output>(): ScalePower<Range, Output>;
* convert the interpolated range element to a corresponding output element.
*/
export interface ScaleLogarithmic<Range, Output> extends ScaleContinuousNumeric<Range, Output> {
/**
* Returns a copy of the scales current domain.
*/
@@ -578,16 +572,15 @@ export function scaleLog<Range, Output>(): ScaleLogarithmic<Range, Output>;
* These scales are occasionally useful when working with pixel coordinates, say in conjunction with an axis or brush.
*/
export interface ScaleIdentity {
/**
* Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
*
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
*
* Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
*
* @param value A numeric value from the domain.
*/
* Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
*
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
*
* Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
*
* @param value A numeric value from the domain.
*/
(value: number | { valueOf(): number }): number;
/**
@@ -688,7 +681,6 @@ export interface ScaleIdentity {
*/
export function scaleIdentity(): ScaleIdentity;
// -------------------------------------------------------------------------------
// Time Scale Factories
// -------------------------------------------------------------------------------
@@ -710,16 +702,15 @@ export function scaleIdentity(): ScaleIdentity;
* convert the interpolated range element to a corresponding output element.
*/
export interface ScaleTime<Range, Output> {
/**
* Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
*
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
*
* Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
*
* @param value A temporal value from the domain. If the value is not a Date, it will be coerced to Date.
*/
* Given a value from the domain, returns the corresponding value from the range, subject to interpolation, if any.
*
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
*
* Note: The interpolation function applied by the scale may change the output type from the range type as part of the interpolation.
*
* @param value A temporal value from the domain. If the value is not a Date, it will be coerced to Date.
*/
(value: Date | number | { valueOf(): number }): Output;
/**
@@ -1022,14 +1013,13 @@ export function scaleUtc<Range, Output>(): ScaleTime<Range, Output>;
* The generic corresponds to the data type of the output of the interpolator underlying the scale.
*/
export interface ScaleSequential<Output> {
/**
* Given a value from the domain, returns the corresponding value from the output range, subject to interpolation.
*
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
*
* @param value A numeric value from the domain.
*/
* Given a value from the domain, returns the corresponding value from the output range, subject to interpolation.
*
* If the given value is outside the domain, and clamping is not enabled, the mapping may be extrapolated such that the returned value is outside the range.
*
* @param value A numeric value from the domain.
*/
(value: number | { valueOf(): number }): Output;
/**
@@ -1209,7 +1199,7 @@ export interface ScaleQuantize<Range> {
*/
range(range: Range[]): this;
/**
/**
* Returns approximately count representative values from the scales domain.
*
* If count is not specified, it defaults to 10.
@@ -1282,7 +1272,6 @@ export function scaleQuantize<Range>(): ScaleQuantize<Range>;
* The generic correponds to the data type of range elements.
*/
export interface ScaleQuantile<Range> {
/**
* Given a value in the input domain, returns the corresponding value in the output range.
*
@@ -1542,7 +1531,6 @@ export function scaleOrdinal<Domain extends { toString(): string }, Range>(range
*/
export const scaleImplicit: { name: 'implicit' };
// -------------------------------------------------------------------------------
// Band Scale Factory
// -------------------------------------------------------------------------------
@@ -1828,7 +1816,6 @@ export function scalePoint(): ScalePoint<string>;
*/
export function scalePoint<Domain extends { toString(): string }>(): ScalePoint<Domain>;
// -------------------------------------------------------------------------------
// Categorical Color Schemas for Ordinal Scales
// -------------------------------------------------------------------------------

View File

@@ -552,17 +552,17 @@ interface Selection<GElement extends BaseType, Datum, PElement extends BaseType,
*/
filter(selector: string): Selection<GElement, Datum, PElement, PDatum>;
/**
* Filters the selection, returning a new selection that contains only the elements for
* which the specified filter is true.
*
* The returned filtered selection preserves the parents of this selection, but like array.filter,
* it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed.
*
* The generic refers to the type of element which will be selected after applying the filter, i.e. if the element types
* contained in a pre-filter selection are narrowed to a subset as part of the filtering.
*
* @param selector A CSS selector string to match when filtering.
*/
* Filters the selection, returning a new selection that contains only the elements for
* which the specified filter is true.
*
* The returned filtered selection preserves the parents of this selection, but like array.filter,
* it does not preserve indexes as some elements may be removed; use selection.select to preserve the index, if needed.
*
* The generic refers to the type of element which will be selected after applying the filter, i.e. if the element types
* contained in a pre-filter selection are narrowed to a subset as part of the filtering.
*
* @param selector A CSS selector string to match when filtering.
*/
filter<FilteredElement extends BaseType>(selector: string): Selection<FilteredElement, Datum, PElement, PDatum>;
/**
* Filter the selection, returning a new selection that contains only the elements for

View File

@@ -1990,14 +1990,14 @@ export interface Symbol<This, Datum> {
/**
* Constructs a new symbol generator with the default settings.
*/
export function symbol(): Symbol<any, any>;
export function symbol(): Symbol<any, any>; // tslint:disable-line ban-types
/**
* Constructs a new symbol generator with the default settings.
*
* The generic corrsponds to the data type of the datum underlying the symbol.
*/
export function symbol<Datum>(): Symbol<any, Datum>;
export function symbol<Datum>(): Symbol<any, Datum>; // tslint:disable-line ban-types
/**
* Constructs a new symbol generator with the default settings.
@@ -2005,7 +2005,7 @@ export function symbol<Datum>(): Symbol<any, Datum>;
* The first generic corresponds to the "this" context within which the symbol generator is invoked.
* The second generic corrsponds to the data type of the datum underlying the symbol.
*/
export function symbol<This, Datum>(): Symbol<This, Datum>;
export function symbol<This, Datum>(): Symbol<This, Datum>; // tslint:disable-line ban-types
/**
* An array containing the set of all built-in symbol types: circle, cross, diamond, square, star, triangle, and wye.

View File

@@ -1,4 +1,5 @@
import moment = require("moment")
import daterangepicker = require("daterangepicker");
function tests_simple() {
$('#daterange').daterangepicker();
@@ -65,5 +66,15 @@ function tests_simple() {
showCustomRangeLabel: false
}, cb);
$('#endDate').daterangepicker({
singleDatePicker: true,
startDate: moment()
});
});
}
declare const host: HTMLElement;
function test_from_amd() {
var picker = new daterangepicker(host);
console.log(picker.startDate.format("YYYY-MM-DD"));
}

View File

@@ -9,11 +9,21 @@ import moment = require("moment");
declare global {
interface JQuery {
daterangepicker(settings?: daterangepicker.Settings): JQuery;
daterangepicker(settings?: daterangepicker.Settings, callback?: (start?: string | Date | moment.Moment, end?: string | Date | moment.Moment, label?: string) => any): JQuery;
daterangepicker(settings?: daterangepicker.Settings, callback?: daterangepicker.DataRangePickerCallback): JQuery;
}
}
declare const daterangepicker: daterangepicker.DateRangePicker;
declare namespace daterangepicker {
type DataRangePickerCallback = (start?: string | Date | moment.Moment, end?: string | Date | moment.Moment, label?: string) => any;
interface DateRangePicker {
new (element: HTMLElement, settings?: daterangepicker.Settings, callback?: DataRangePickerCallback): DateRangePicker;
startDate: moment.Moment;
endDate: moment.Moment;
}
interface DatepickerEventObject extends JQueryEventObject {
date: Date;

View File

@@ -19,4 +19,4 @@ score = hackerCalculator(upvotes, posted);
let wilsonCalculator = wilsonScore();
score = wilsonCalculator(upvotes, downvotes);
wilsonCalculator = wilsonScore(1.0);
score = wilsonCalculator(upvotes, downvotes);
score = wilsonCalculator(upvotes, downvotes);

View File

@@ -10,4 +10,4 @@ const expected = { foo: { bar: 3, baz: 4 },
array: [ { does: 'work', too: [ 1, 2, 3, 4, 5, 6 ] }, { really: 'yes' } ],
quux: 5 };
const result = deepmerge<any>(x, y);
const result = deepmerge<any>(x, y);

View File

@@ -10,8 +10,8 @@ declare function deepmerge<T>(x: T, y: T, options?: deepmerge.Options<T>): T;
declare namespace deepmerge {
interface Options<T> {
clone?: boolean;
arrayMerge?: (destination: T, source: T, options?: Options<T>) => T;
arrayMerge?(destination: T, source: T, options?: Options<T>): T;
}
function all<T>(objects: T[], options?: Options<T>): T;
}
}

View File

@@ -1,6 +1,6 @@
import del = require("del");
var paths = ["build", "dist/**/*.js"];
let paths = ["build", "dist/**/*.js"];
del(["tmp/*.js", "!tmp/unicorn.js"]);
@@ -26,7 +26,6 @@ del("tmp/*.js", {force: true}).then((paths: string[]) => {
console.log('Deleted files/folders:\n', paths.join('\n'));
});
var paths: string[];
paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"]);
paths = del.sync(["tmp/*.js", "!tmp/unicorn.js"], {force: true});

View File

@@ -8,10 +8,9 @@ const port: number = 8000;
detect(port, (err: Error, _port: number) => {
});
function* yieldSyntax() {
const _port: number = yield detect(port);
};
}
/**
* use as a promise

View File

@@ -21,4 +21,4 @@ const entry: number | null = rangeOne.index(1);
const stringified: string = rangeOne.toString();
// clone
const rangeThree: DiscontinuousRange = rangeOne.clone();
const rangeThree: DiscontinuousRange = rangeOne.clone();

View File

@@ -7,7 +7,6 @@
* Represents a discontinuous range of numbers.
*/
declare class DiscontinuousRange {
/**
* Creates a discontinuous range at rangeStart, and ending at
* rangeEnd. If rangeEnd is not specified, a range containing
@@ -70,4 +69,4 @@ declare class DiscontinuousRange {
clone(): DiscontinuousRange;
}
export = DiscontinuousRange;
export = DiscontinuousRange;

View File

@@ -55,4 +55,70 @@ docker.createContainer({ Tty: true }, (err, container) => {
container.start((err, data) => {
// NOOP
});
});
});
docker.pruneContainers((err, response) => {
// NOOP
});
docker.pruneImages((err, response) => {
// NOOP
});
docker.pruneNetworks((err, response) => {
// NOOP
});
docker.pruneVolumes((err, response) => {
// NOOP
});
const plugin = docker.getPlugin('pluginName', 'remoteName');
plugin.configure((err, response) => {
// NOOP;
});
plugin.disable((err, response) => {
// NOOP
});
plugin.enable((err, response) => {
// NOOP
});
plugin.inspect((err, response) => {
// NOOP
});
plugin.privileges((err, response) => {
// NOOP
});
plugin.pull({}, (err, response) => {
// NOOP
});
plugin.push((err, response) => {
// NOOP
});
plugin.remove((err, response) => {
// NOOP
});
plugin.upgrade({}, (err, response) => {
// NOOP
});
const secret = docker.getSecret('secretName');
secret.inspect((err, response) => {
// NOOP
});
secret.remove((err, response) => {
// NOOP
});
secret.update((err, response) => {
// NOOP
});

View File

@@ -1,6 +1,6 @@
// Type definitions for dockerode 2.3
// Type definitions for dockerode 2.4
// Project: https://github.com/apocas/dockerode
// Definitions by: Carl Winkler <https://github.com/seikho>
// Definitions by: Carl Winkler <https://github.com/seikho>, Nicolas Laplante <https://github.com/nlaplante>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
@@ -8,7 +8,6 @@
import * as stream from 'stream';
import * as events from 'events';
declare namespace Dockerode {
interface Container {
inspect(options: {}, callback: Callback<ContainerInspectInfo>): void;
@@ -94,8 +93,8 @@ declare namespace Dockerode {
tag(options: {}, callback: Callback<any>): void;
tag(callback: Callback<any>): void;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
remove(options: {}, callback: Callback<ImageRemoveInfo>): void;
remove(callback: Callback<ImageRemoveInfo>): void;
modem: any;
id?: string;
@@ -137,6 +136,49 @@ declare namespace Dockerode {
id?: string;
}
interface Plugin {
modem: any;
name: string;
remote: any;
inspect(callback: Callback<PluginInspectInfo>): void;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
privileges(callback: Callback<any>): void;
pull(options: {}, callback: Callback<any>): void;
enable(options: {}, callback: Callback<any>): void;
enable(callback: Callback<any>): void;
disable(options: {}, callback: Callback<any>): void;
disable(callback: Callback<any>): void;
push(options: {}, callback: Callback<any>): void;
push(callback: Callback<any>): void;
configure(options: {}, callback: Callback<any>): void;
configure(callback: Callback<any>): void;
upgrade(auth: any, options: {}, callback: Callback<any>): void;
upgrade(auth: any, callback: Callback<any>): void;
}
interface Secret {
inspect(callback: Callback<SecretInfo>): void;
update(options: {}, callback: Callback<any>): void;
update(callback: Callback<any>): void;
remove(options: {}, callback: Callback<any>): void;
remove(callback: Callback<any>): void;
modem: any;
id?: string;
}
interface Network {
inspect(callback: Callback<any>): void;
@@ -546,6 +588,137 @@ declare namespace Dockerode {
protocol?: "https" | "http";
timeout?: number;
}
interface SecretVersion {
Index: number;
}
interface ServiceSpec {
Name: string;
}
interface SecretInfo {
ID: string;
Version: SecretVersion;
CreatedAt: string;
UpdatedAt?: string;
Spec?: ServiceSpec;
}
interface PluginInfo {
Id?: string;
Name: string;
Enabled: boolean;
Settings: PluginSettings;
PluginReference?: string;
Config: PluginConfig;
}
type PluginInspectInfo = PluginInfo;
interface PluginSettings {
Mounts: PluginMount[];
Env: string[];
Args: string[];
Devices: PluginDevice[];
}
interface PluginConfig {
Description: string;
Documentation: string;
Interface: any;
Entrypoint: string[];
WorkDir: string;
User?: User;
Network: Network;
Linux: Linux;
PropagatedMount: string;
Mounts: PluginMount[];
Env: PluginEnv[];
Args: Args;
rootfs: any;
}
interface Interface {
Types: PluginInterfaceType[];
Socket: string;
}
interface PluginInterfaceType {
Prefix: string;
Capability: string;
Version: string;
}
interface PluginMount {
Name: string;
Description: string;
Settable: string[];
Source: string;
Destination: string;
Type: string;
Options: string[];
}
interface Linux {
Capabilities: string[];
AllowAllDevices: boolean;
Devices: PluginDevice[];
}
interface PluginDevice {
Name: string;
Description: string;
Settable: string[];
Path: string;
}
interface Network {
Type: string;
}
interface PluginEnv {
Name: string;
Description: string;
Settable: string[];
Value: string;
}
interface Args {
Name: string;
Description: string;
Settable: string[];
Value: string;
}
interface User {
UID: number;
GID: number;
}
interface ImageRemoveInfo {
Untagged: string;
Deleted: string;
}
interface PruneImagesInfo {
ImagesDeleted: ImageRemoveInfo[];
SpaceReclaimed: number;
}
interface PruneVolumesInfo {
VolumesDeleted: string[];
SpaceReclaimed: number;
}
interface PruneContainersInfo {
ContainersDeleted: string[];
SpaceReclaimed: number;
}
interface PruneNetworksInfo {
NetworksDeleted: string[];
}
}
type Callback<T> = (error?: any, result?: T) => void;
@@ -575,6 +748,8 @@ declare class Dockerode {
getVolume(name: string): Dockerode.Volume;
getPlugin(name: string, remote: any): Dockerode.Plugin;
getService(id: string): Dockerode.Service;
getTask(id: string): Dockerode.Task;
@@ -583,6 +758,8 @@ declare class Dockerode {
getNetwork(id: string): Dockerode.Network;
getSecret(id: string): Dockerode.Secret;
getExec(id: string): Dockerode.Exec;
listContainers(options: {}, callback: Callback<Dockerode.ContainerInfo[]>): void;
@@ -600,12 +777,22 @@ declare class Dockerode {
listTasks(options: {}, callback: Callback<any[]>): void;
listTasks(callback: Callback<any[]>): void;
listSecrets(options: {}, callback: Callback<Dockerode.SecretInfo[]>): void;
listSecrets(callback: Callback<Dockerode.SecretInfo[]>): void;
listPlugins(options: {}, callback: Callback<Dockerode.PluginInfo[]>): void;
listPlugins(callback: Callback<Dockerode.PluginInfo[]>): void;
listVolumes(options: {}, callback: Callback<any[]>): void;
listVolumes(callback: Callback<any[]>): void;
listNetworks(options: {}, callback: Callback<any[]>): void;
listNetworks(callback: Callback<any[]>): void;
createSecret(options: {}, callback: Callback<any>): void;
createPlugin(options: {}, callback: Callback<any>): void;
createVolume(options: {}, callback: Callback<any>): void;
createService(options: {}, callback: Callback<any>): void;
@@ -614,6 +801,18 @@ declare class Dockerode {
searchImages(options: {}, callback: Callback<any>): void;
pruneImages(options: {}, callback: Callback<Dockerode.PruneImagesInfo>): void;
pruneImages(callback: Callback<Dockerode.PruneImagesInfo>): void;
pruneContainers(options: {}, callback: Callback<Dockerode.PruneContainersInfo>): void;
pruneContainers(callback: Callback<Dockerode.PruneContainersInfo>): void;
pruneVolumes(options: {}, callback: Callback<Dockerode.PruneVolumesInfo>): void;
pruneVolumes(callback: Callback<Dockerode.PruneVolumesInfo>): void;
pruneNetworks(options: {}, callback: Callback<Dockerode.PruneNetworksInfo>): void;
pruneNetworks(callback: Callback<Dockerode.PruneNetworksInfo>): void;
info(callback: Callback<any>): void;
version(callback: Callback<any>): void;
@@ -638,6 +837,8 @@ declare class Dockerode {
swarmUpdate(options: {}, callback: Callback<any>): void;
swarmInspect(callback: Callback<any>): void;
modem: any;
}

View File

@@ -1,7 +1,7 @@
import Dragster = require("dragster");
var dropzone = document.getElementById("my-dropzone") as HTMLElement;
var dragster = new Dragster(dropzone);
const dropzone = document.getElementById("my-dropzone") as HTMLElement;
const dragster = new Dragster(dropzone);
dragster.removeListeners();
dragster.reset();
dragster.reset();

View File

@@ -20,4 +20,4 @@ declare var Dragster: Dragster.DragsterStatic;
export = Dragster;
// Support as a global
export as namespace Dragster;
export as namespace Dragster;

Some files were not shown because too many files have changed in this diff Show More