Apply new lint rules in more packages (#15521)

This commit is contained in:
Andy 2017-03-30 12:33:22 -07:00 committed by GitHub
parent 4173a37d30
commit 4cac3c5b44
59 changed files with 503 additions and 544 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

@ -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

@ -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

@ -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';

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;

View File

@ -32,7 +32,8 @@ describe('createSpy', () => {
});
describe('A spy', () => {
let targetContext: any, targetArguments: any;
let targetContext: any;
let targetArguments: any;
const target = {
method() {
targetContext = this;
@ -88,7 +89,8 @@ describe('A spy', () => {
});
describe('that calls some other function', () => {
let otherContext: any, otherArguments: any;
let otherContext: any;
let otherArguments: any;
function otherFn() {
otherContext = this;
otherArguments = Array.prototype.slice.call(arguments, 0);

View File

@ -2,4 +2,4 @@
import isRoot = require('is-root');
isRoot();
// => true
// => true

View File

@ -12,4 +12,4 @@ export interface Configuration {
export function init(element: string, config: Configuration): void;
export as namespace ityped;
export as namespace ityped;

View File

@ -15,4 +15,4 @@ init("#anotherSelector", {
loop: false
});
init("#anotherOne", {});
init("#anotherOne", {});

View File

@ -50,7 +50,6 @@ declare namespace jimp {
}
} | PresetFont;
class JimpImage {
constructor(width: number, height: number, callback?: Callback<JimpImage>);
constructor(width: number, height: number, initialColor: number, callback?: Callback<JimpImage>);

View File

@ -36,20 +36,20 @@ Jimp.read("http://www.example.com/path/to/lenna.jpg", (err, image) => {
// do stuff with the image (if no exception)
});
var image = new Jimp(1, 2);
var w = 0;
var h = 0;
var x = 0;
var y = 0;
var f = 0;
var src = '';
var horz = Jimp.HORIZONTAL_ALIGN_CENTER;
var vert = Jimp.VERTICAL_ALIGN_BOTTOM;
var deg = 90;
var val = 0.5;
var hex = 0xFFFFFFFF;
var r = 0;
var n = 1;
let image = new Jimp(1, 2);
const w = 0;
const h = 0;
const x = 0;
const y = 0;
const f = 0;
const src = '';
const horz = Jimp.HORIZONTAL_ALIGN_CENTER;
const vert = Jimp.VERTICAL_ALIGN_BOTTOM;
const deg = 90;
const val = 0.5;
const hex = 0xFFFFFFFF;
const r = 0;
const n = 1;
/* Resize */
image.contain(w, h); // scale the image to the given width and height, some parts of the image may be letter boxed
image.cover(w, h); // scale the image to the given width and height, some parts of the image may be clipped
@ -112,15 +112,15 @@ image.resize(250, 250, Jimp.RESIZE_BEZIER);
image.contain(250, 250, Jimp.HORIZONTAL_ALIGN_LEFT | Jimp.VERTICAL_ALIGN_TOP);
var path = '';
var str = '';
var width = 0;
const path = '';
const str = '';
const width = 0;
Jimp.loadFont(path).then(font => { // load font from .fnt file
image.print(font, x, y, str); // print a message on an image
image.print(font, x, y, str, width); // print a message on an image with text wrapped at width
});
var cb = (err: Error, data: any) => {};
const cb = (err: Error, data: any) => {};
Jimp.loadFont(path, cb); // using a callback pattern
Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then(font => {
@ -129,17 +129,16 @@ Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then(font => {
image.write(path, cb); // Node-style callback will be fired when write is successful
var file = "new_name." + image.getExtension();
const file = "new_name." + image.getExtension();
image.write(file);
var mime = 'image/png';
const mime = 'image/png';
image.getBuffer(mime, cb); // Node-style callback will be fired with result
image.getBase64(mime, cb); // Node-style callback will be fired with result
image.quality(n); // set the quality of saved JPEG, 0 - 100
var bool = true;
var number = 0;
const bool = true;
const number = 0;
image.rgba(bool); // set whether PNGs are saved as RGBA (true, default) or RGB (false)
image.filterType(number); // set the filter type for the saved PNG
image.deflateLevel(number); // set the deflate level for the saved PNG
@ -160,10 +159,10 @@ image.scan(0, 0, image.bitmap.width, image.bitmap.height, function(x, y, idx) {
// idx is the position start position of this rgba tuple in the bitmap Buffer
// this is the image
var red = this.bitmap.data[ idx + 0 ];
var green = this.bitmap.data[ idx + 1 ];
var blue = this.bitmap.data[ idx + 2 ];
var alpha = this.bitmap.data[ idx + 3 ];
const red = this.bitmap.data[ idx + 0 ];
const green = this.bitmap.data[ idx + 1 ];
const blue = this.bitmap.data[ idx + 2 ];
const alpha = this.bitmap.data[ idx + 3 ];
// rgba values run from 0 - 255
// e.g. this.bitmap.data[idx] = 0; // removes red from this pixel
@ -171,35 +170,34 @@ image.scan(0, 0, image.bitmap.width, image.bitmap.height, function(x, y, idx) {
image.getPixelColor(x, y); // returns the colour of that pixel e.g. 0xFFFFFFFF
image.setPixelColor(hex, x, y); // sets the colour of that pixel
var g = 0;
var b = 0;
var a = 0;
const g = 0;
const b = 0;
const a = 0;
Jimp.rgbaToInt(r, g, b, a); // e.g. converts 255, 255, 255, 255 to 0xFFFFFFFF
Jimp.intToRGBA(hex); // e.g. converts 0xFFFFFFFF to {r: 255, g: 255, b: 255, a:255}
var image = new Jimp(256, 256, (err, image) => {
image = new Jimp(256, 256, (err, image) => {
// this image is 256 x 256, every pixel is set to 0x00000000
});
var image = new Jimp(256, 256, 0xFF0000FF, (err, image) => {
image = new Jimp(256, 256, 0xFF0000FF, (err, image) => {
// this image is 256 x 256, every pixel is set to 0xFF0000FF
});
image.hash(); // aHgG4GgoFjA
image.hash(2); // 1010101011010000101010000100101010010000011001001001010011100100
var image1 = new Jimp(0, 1);
var image2 = new Jimp(0, 1);
const image1 = new Jimp(0, 1);
const image2 = new Jimp(0, 1);
Jimp.distance(image1, image2); // returns a number 0-1, where 0 means the two images are perceived to be identical
var threshold = 0;
var diff = Jimp.diff(image1, image2, threshold); // threshold ranges 0-1 (default: 0.1)
const threshold = 0;
let diff = Jimp.diff(image1, image2, threshold); // threshold ranges 0-1 (default: 0.1)
diff.image; // a Jimp image showing differences
diff.percent; // the proportion of different pixels (0-1), where 0 means the images are pixel identical
var distance = Jimp.distance(image, image2); // perceived distance
var diff = Jimp.diff(image, image2); // pixel difference
const distance = Jimp.distance(image, image2); // perceived distance
diff = Jimp.diff(image, image2); // pixel difference
if (distance < 0.15 || diff.percent < 0.15) {
// images match
@ -217,4 +215,4 @@ Jimp.read("lenna.png", (err, image) => {
image.write("lena-half-bw.png");
});
});
});
});

View File

@ -5,14 +5,15 @@
/// <reference types="jquery"/>
declare var jui: JuiStatic;
export const jui: JuiStatic;
interface UtilBase {
/**
* @property browser check browser agent
* @property {Boolean} browser.webkit Webkit
* @property {Boolean} browser.mozilla Mozilla
* @property {Boolean} browser.msie IE */
* @property {Boolean} browser.msie IE
*/
browser: {
webkit: boolean,
mozilla: boolean,
@ -389,11 +390,11 @@ interface JuiStatic {
includeAll(): any[];
/**
* @method add
* Adds a component object created
*
* @param {Object} ui UI instance
*/
* @method add
* Adds a component object created
*
* @param {Object} ui UI instance
*/
add(uiIns: any): void;
/**

View File

@ -40,9 +40,9 @@ jui.ready([ "grid.table" ], (table: GridTable) => {
]);
const table_3_submit: Function = (index: number) => {
const name = $(table_3.root).find(".name").val(),
age = $(table_3.root).find(".age").val(),
location = $(table_3.root).find(".location").val();
const name = $(table_3.root).find(".name").val();
const age = $(table_3.root).find(".age").val();
const location = $(table_3.root).find(".location").val();
//noinspection TypeScriptValidateTypes
table_3.update(index, { name, age, location });

View File

@ -5,4 +5,4 @@
declare function leftPad(str: string|number, len: number, ch?: string|number): string;
export = leftPad;
export = leftPad;

View File

@ -12,4 +12,4 @@ leftPad(1, 2, "0");
// => "01"
leftPad(17, 5, 0);
// => "00017"
// => "00017"

View File

@ -102,7 +102,7 @@ declare class Libpq extends EventEmitter {
* @returns {boolean} true if data was read; false if there was an error. You can access
* error details with [[Libpq.errorMessage]].
*/
consumeInput(): boolean
consumeInput(): boolean;
/**
* Retrieves the last error message from the connection. This is intended to be used after most

View File

@ -67,5 +67,5 @@ interface XmppOptions {
interface Bosh {
url?: string;
prebind?: (error: any, data: any) => void;
prebind?(error: any, data: any): void;
}

View File

@ -66,17 +66,17 @@ export class JID {
/**
* Convenience method to distinguish users
**/
*/
bare(): JID;
/**
* Comparison function
**/
*/
equals(other: JID): boolean;
/**
* http://xmpp.org/rfcs/rfc6122.html#addressing-localpart
**/
*/
setLocal(local: string, escape?: any): void;
getLocal(unescape?: any): string;

View File

@ -55,4 +55,4 @@ ns.storingen({}, (err, data) => {
} else {
console.log(data);
}
});
});

View File

@ -7,5 +7,5 @@ opener('./my-file.txt');
opener('firefox');
opener('npm run lint');
var editor = opener('documentation.odt');
const editor = opener('documentation.odt');
editor.unref();

View File

@ -3,4 +3,4 @@ import pad = require('pad');
pad('pad', 5); // "pad "
pad(5, 'pad'); // " pad"
pad('pad', 5, '+'); // "pad++"
pad(5, 'pad', '+'); // "++pad"
pad(5, 'pad', '+'); // "++pad"

50
types/pem/index.d.ts vendored
View File

@ -144,9 +144,9 @@ type Callback<T> = (error: any, result: T) => any;
* @param {PrivateKeyCreationOptions} [options] private key encryption settings, defaults to empty object (no enryption)
* @param {Callback<{ key: string }>} callback Callback function with an error object and {key}
*/
declare function createPrivateKey(keyBitsize: number, options: PrivateKeyCreationOptions, callback: Callback<{ key: string }>): void;
declare function createPrivateKey(optionsOrKeyBitsize: number | PrivateKeyCreationOptions, callback: Callback<{ key: string }>): void;
declare function createPrivateKey(callback: Callback<{ key: string }>): void;
export function createPrivateKey(keyBitsize: number, options: PrivateKeyCreationOptions, callback: Callback<{ key: string }>): void;
export function createPrivateKey(optionsOrKeyBitsize: number | PrivateKeyCreationOptions, callback: Callback<{ key: string }>): void;
export function createPrivateKey(callback: Callback<{ key: string }>): void;
/**
* Creates a dhparam key
@ -154,8 +154,8 @@ declare function createPrivateKey(callback: Callback<{ key: string }>): void;
* @param {Number} [keyBitsize=512] Size of the key, defaults to 512bit
* @param {Callback<{ dhparam: any }>} callback Callback function with an error object and {dhparam}
*/
declare function createDhparam(keyBitsize: number, callback: Callback<{ dhparam: any }>): void;
declare function createDhparam(callback: Callback<{ dhparam: any }>): void;
export function createDhparam(keyBitsize: number, callback: Callback<{ dhparam: any }>): void;
export function createDhparam(callback: Callback<{ dhparam: any }>): void;
/**
* Creates a Certificate Signing Request
@ -166,8 +166,8 @@ declare function createDhparam(callback: Callback<{ dhparam: any }>): void;
* @param {CSRCreationOptions} [options] Optional options object
* @param {Callback<{ csr: string, clientKey: string }>} callback Callback function with an error object and {csr, clientKey}
*/
declare function createCSR(options: CSRCreationOptions, callback: Callback<{ csr: string, clientKey: string }>): void;
declare function createCSR(callback: Callback<{ csr: string, clientKey: string }>): void;
export function createCSR(options: CSRCreationOptions, callback: Callback<{ csr: string, clientKey: string }>): void;
export function createCSR(callback: Callback<{ csr: string, clientKey: string }>): void;
/**
* Creates a certificate based on a CSR. If CSR is not defined, a new one
@ -177,8 +177,8 @@ declare function createCSR(callback: Callback<{ csr: string, clientKey: string }
* @param {Object} [CertificateCreationOptions] Optional options object
* @param {Callback<CertificateCreationResult>} callback Callback function with an error object and {certificate, csr, clientKey, serviceKey}
*/
declare function createCertificate(options: CertificateCreationOptions, callback: Callback<CertificateCreationResult>): void;
declare function createCertificate(callback: Callback<CertificateCreationResult>): void;
export function createCertificate(options: CertificateCreationOptions, callback: Callback<CertificateCreationResult>): void;
export function createCertificate(callback: Callback<CertificateCreationResult>): void;
/**
* Reads subject data from a certificate or a CSR
@ -186,8 +186,8 @@ declare function createCertificate(callback: Callback<CertificateCreationResult>
* @param {String} certificate PEM encoded CSR or certificate
* @param {Callback<CertificateSubjectReadResult>} callback Callback function with an error object and {country, state, locality, organization, organizationUnit, commonName, emailAddress}
*/
declare function readCertificateInfo(certificate: string, callback: Callback<CertificateSubjectReadResult>): void;
declare function readCertificateInfo(callback: Callback<CertificateSubjectReadResult>): void;
export function readCertificateInfo(certificate: string, callback: Callback<CertificateSubjectReadResult>): void;
export function readCertificateInfo(callback: Callback<CertificateSubjectReadResult>): void;
/**
* Exports a public key from a private key, CSR or certificate
@ -195,8 +195,8 @@ declare function readCertificateInfo(callback: Callback<CertificateSubjectReadRe
* @param {String} certificate PEM encoded private key, CSR or certificate
* @param {Callback<{ publicKey: string }>} callback Callback function with an error object and {publicKey}
*/
declare function getPublicKey(certificate: string, callback: Callback<{ publicKey: string }>): void;
declare function getPublicKey(callback: Callback<{ publicKey: string }>): void;
export function getPublicKey(certificate: string, callback: Callback<{ publicKey: string }>): void;
export function getPublicKey(callback: Callback<{ publicKey: string }>): void;
/**
* Gets the fingerprint for a certificate
@ -205,9 +205,9 @@ declare function getPublicKey(callback: Callback<{ publicKey: string }>): void;
* @param {HashFunction} hash Hash function to use (either md5 sha1 or sha256, defaults to sha256)
* @param {Callback<{ fingerprint: string }>} callback Callback function with an error object and {fingerprint}
*/
declare function getFingerprint(certificate: string, hash: HashFunction, callback: Callback<{ fingerprint: string }>): void;
declare function getFingerprint(certificate: string, callback: Callback<{ fingerprint: string }>): void;
declare function getFingerprint(callback: Callback<{ fingerprint: string }>): void;
export function getFingerprint(certificate: string, hash: HashFunction, callback: Callback<{ fingerprint: string }>): void;
export function getFingerprint(certificate: string, callback: Callback<{ fingerprint: string }>): void;
export function getFingerprint(callback: Callback<{ fingerprint: string }>): void;
/**
* Gets the modulus from a certificate, a CSR or a private key
@ -216,8 +216,8 @@ declare function getFingerprint(callback: Callback<{ fingerprint: string }>): vo
* @param {String} password password for the certificate
* @param {Callback<{ modulus: any }>} callback Callback function with an error object and {modulus}
*/
declare function getModulus(certificate: string, password: string, callback: Callback<{ modulus: any }>): void;
declare function getModulus(certificate: string, callback: Callback<{ modulus: any }>): void;
export function getModulus(certificate: string, password: string, callback: Callback<{ modulus: any }>): void;
export function getModulus(certificate: string, callback: Callback<{ modulus: any }>): void;
/**
* Gets the size and prime of DH parameters
@ -225,7 +225,7 @@ declare function getModulus(certificate: string, callback: Callback<{ modulus: a
* @param {String} dh DH parameters PEM encoded
* @param {Callback<{ size: any, prime: any }>} callback Callback function with an error object and {size, prime}
*/
declare function getDhparamInfo(dh: string, callback: Callback<{ size: any, prime: any }>): void;
export function getDhparamInfo(dh: string, callback: Callback<{ size: any, prime: any }>): void;
/**
* Exports private key and certificate to a PKCS12 keystore
@ -236,8 +236,8 @@ declare function getDhparamInfo(dh: string, callback: Callback<{ size: any, prim
* @param {Pkcs12CreationOptions} [options] object of cipher and optional client key password {cipher:'aes128', clientKeyPassword: 'xxx'}
* @param {Callback<{ pkcs12: any }>} callback Callback function with an error object and {pkcs12}
*/
declare function createPkcs12(key: string, certificate: string, password: string, options: Pkcs12CreationOptions, callback: Callback<{ pkcs12: any }>): void;
declare function createPkcs12(key: string, certificate: string, password: string, callback: Callback<{ pkcs12: any }>): void;
export function createPkcs12(key: string, certificate: string, password: string, options: Pkcs12CreationOptions, callback: Callback<{ pkcs12: any }>): void;
export function createPkcs12(key: string, certificate: string, password: string, callback: Callback<{ pkcs12: any }>): void;
/**
* Reads private key and certificate from a PKCS12 keystore
@ -246,8 +246,8 @@ declare function createPkcs12(key: string, certificate: string, password: string
* @param {Function} callback Callback function with an error object and {pkcs12}
* @returns the result of the callback
*/
declare function readPkcs12(bufferOrPath: string, options: Pkcs12ReadOptions, callback: Callback<{ pkcs12: any }>): any;
declare function readPkcs12(bufferOrPath: string, callback: Callback<{ pkcs12: any }>): any;
export function readPkcs12(bufferOrPath: string, options: Pkcs12ReadOptions, callback: Callback<{ pkcs12: any }>): any;
export function readPkcs12(bufferOrPath: string, callback: Callback<{ pkcs12: any }>): any;
/**
* Verifies the signing chain of the passed certificate
@ -256,10 +256,10 @@ declare function readPkcs12(bufferOrPath: string, callback: Callback<{ pkcs12: a
* @param {string[]} ca List of CA certificates
* @param {Function} callback Callback function with an error object and a boolean valid
*/
declare function verifySigningChain(certificate: string, ca: string[], callback: Callback<boolean>): void;
export function verifySigningChain(certificate: string, ca: string[], callback: Callback<boolean>): void;
/**
* config the pem module
* @param {ModuleConfiguration} options
*/
declare function config(options: ModuleConfiguration): void;
export function config(options: ModuleConfiguration): void;

View File

@ -1,10 +1,9 @@
import * as pem from 'pem';
const tests = {
'Create default sized dhparam key': (test: any) => {
pem.createDhparam((error: any, data: any) => {
var dhparam = (data && data.dhparam || '').toString();
const dhparam = (data && data.dhparam || '').toString();
test.ifError(error);
test.ok(dhparam);
test.ok(dhparam.match(/^\n*\-\-\-\-\-BEGIN DH PARAMETERS\-\-\-\-\-\n/));
@ -17,7 +16,7 @@ const tests = {
'Create 2048bit dhparam key': (test: any) => {
pem.createDhparam(2048, (error: any, data: any) => {
var dhparam = (data && data.dhparam || '').toString();
const dhparam = (data && data.dhparam || '').toString();
test.ifError(error);
test.ok(dhparam);
test.ok(dhparam.match(/^\n*\-\-\-\-\-BEGIN DH PARAMETERS\-\-\-\-\-\n/));
@ -30,7 +29,7 @@ const tests = {
'Create default sized Private key': (test: any) => {
pem.createPrivateKey((error: any, data: any) => {
var key = (data && data.key || '').toString();
const key = (data && data.key || '').toString();
test.ifError(error);
test.ok(key);
test.ok(key.match(/^\n*\-\-\-\-\-BEGIN RSA PRIVATE KEY\-\-\-\-\-\n/));
@ -43,7 +42,7 @@ const tests = {
'Create 2048bit Private key': (test: any) => {
pem.createPrivateKey(2048, (error: any, data: any) => {
var key = (data && data.key || '').toString();
const key = (data && data.key || '').toString();
test.ifError(error);
test.ok(key);
test.ok(key.match(/^\n*\-\-\-\-\-BEGIN RSA PRIVATE KEY\-\-\-\-\-\n/));
@ -56,7 +55,7 @@ const tests = {
'Create 2048bit Private key with Password': (test: any) => {
pem.createPrivateKey(2048, {cipher: 'des', password: 'TestMe'}, (error: any, data: any) => {
var key = (data && data.key || '').toString();
const key = (data && data.key || '').toString();
test.ifError(error);
test.ok(key);
test.ok(key.match(/ENCRYPTED\n/));
@ -70,7 +69,7 @@ const tests = {
'Create default CSR': (test: any) => {
pem.createCSR((error: any, data: any) => {
var csr = (data && data.csr || '').toString();
const csr = (data && data.csr || '').toString();
test.ifError(error);
test.ok(csr);
test.ok(csr.match(/^\n*\-\-\-\-\-BEGIN CERTIFICATE REQUEST\-\-\-\-\-\n/));
@ -83,7 +82,7 @@ const tests = {
},
'Create CSR using config file': (test: any) => {
var certInfo = {
const certInfo = {
issuer : {},
country: 'EE',
state: 'Harjumaa',
@ -95,7 +94,7 @@ const tests = {
};
pem.createCSR({ csrConfigFile: './test/fixtures/test.cnf' }, (error: any, data: any) => {
var csr = (data && data.csr || '').toString();
const csr = (data && data.csr || '').toString();
test.ifError(error);
test.ok(csr);
test.ok(csr.match(/^\n*\-\-\-\-\-BEGIN CERTIFICATE REQUEST\-\-\-\-\-\n/));
@ -115,12 +114,12 @@ const tests = {
'Create CSR with own key': (test: any) => {
pem.createPrivateKey((error: any, data: any) => {
var key = (data && data.key || '').toString();
const key = (data && data.key || '').toString();
pem.createCSR({
clientKey: key
}, (error: any, data: any) => {
var csr = (data && data.csr || '').toString();
const csr = (data && data.csr || '').toString();
test.ifError(error);
test.ok(csr);
test.ok(csr.match(/^\n*\-\-\-\-\-BEGIN CERTIFICATE REQUEST\-\-\-\-\-\n/));
@ -136,15 +135,15 @@ const tests = {
},
'Create CSR with own encrypted key': (test: any) => {
var password = 'my:secure! "password\'s\nawesome';
const password = 'my:secure! "password\'s\nawesome';
pem.createPrivateKey(2048, { cipher: 'des3', password }, (error: any, data: any) => {
var key = (data && data.key || '').toString();
const key = (data && data.key || '').toString();
pem.createCSR({
clientKey: key,
clientKeyPassword: password
}, (error: any, data: any) => {
var csr = (data && data.csr || '').toString();
const csr = (data && data.csr || '').toString();
test.ifError(error);
test.ok(csr);
test.ok(csr.match(/^\n*\-\-\-\-\-BEGIN CERTIFICATE REQUEST\-\-\-\-\-\n/));
@ -161,7 +160,7 @@ const tests = {
'Create default certificate': (test: any) => {
pem.createCertificate((error: any, data: any) => {
var certificate = (data && data.certificate || '').toString();
const certificate = (data && data.certificate || '').toString();
test.ifError(error);
test.ok(certificate);
test.ok(certificate.match(/^\n*\-\-\-\-\-BEGIN CERTIFICATE\-\-\-\-\-\n/));
@ -181,7 +180,7 @@ const tests = {
pem.createCertificate({
selfSigned: true
}, (error: any, data: any) => {
var certificate = (data && data.certificate || '').toString();
const certificate = (data && data.certificate || '').toString();
test.ifError(error);
test.ok(certificate);
test.ok(certificate.match(/^\n*\-\-\-\-\-BEGIN CERTIFICATE\-\-\-\-\-\n/));
@ -199,7 +198,7 @@ const tests = {
'Read default cert data from CSR': (test: any) => {
pem.createCSR((error: any, data: any) => {
var csr = (data && data.csr || '').toString();
const csr = (data && data.csr || '').toString();
test.ifError(error);
// test.ok(fs.readdirSync('./tmp').length === 0);
@ -222,7 +221,7 @@ const tests = {
},
'Read edited cert data from CSR': (test: any) => {
var certInfo = {
const certInfo = {
issuer : {},
country: 'EE',
state: 'Harjumaa',
@ -233,7 +232,7 @@ const tests = {
emailAddress: 'andris@node.ee'
};
pem.createCSR(Object.create(certInfo), (error: any, data: any) => {
var csr = (data && data.csr || '').toString();
const csr = (data && data.csr || '').toString();
test.ifError(error);
// test.ok(fs.readdirSync('./tmp').length === 0);
@ -248,7 +247,7 @@ const tests = {
'Read default cert data from certificate': (test: any) => {
pem.createCertificate((error: any, data: any) => {
var certificate = (data && data.certificate || '').toString();
const certificate = (data && data.certificate || '').toString();
test.ifError(error);
// test.ok(fs.readdirSync('./tmp').length === 0);
@ -286,7 +285,7 @@ const tests = {
},
'Read edited cert data from certificate': (test: any) => {
var certInfo = {
const certInfo = {
issuer : {
country: 'EE',
state: 'Harjumaa',
@ -304,7 +303,7 @@ const tests = {
emailAddress: 'andris@node.ee'
};
pem.createCertificate(Object.create(certInfo), (error: any, data: any) => {
var certificate = (data && data.certificate || '').toString();
const certificate = (data && data.certificate || '').toString();
test.ifError(error);
// test.ok(fs.readdirSync('./tmp').length === 0);
@ -327,13 +326,13 @@ const tests = {
'Get public key from private key': (test: any) => {
pem.createPrivateKey((error: any, data: any) => {
var key = (data && data.key || '').toString();
const key = (data && data.key || '').toString();
test.ifError(error);
test.ok(key);
// test.ok(fs.readdirSync('./tmp').length === 0);
pem.getPublicKey(key, (error: any, data: any) => {
var pubkey = (data && data.publicKey || '').toString();
const pubkey = (data && data.publicKey || '').toString();
test.ifError(error);
test.ok(pubkey);
@ -348,13 +347,13 @@ const tests = {
'Get public key from CSR': (test: any) => {
pem.createCSR((error: any, data: any) => {
var key = (data && data.clientKey || '').toString();
const key = (data && data.clientKey || '').toString();
test.ifError(error);
test.ok(key);
// test.ok(fs.readdirSync('./tmp').length === 0);
pem.getPublicKey(key, (error: any, data: any) => {
var pubkey = (data && data.publicKey || '').toString();
const pubkey = (data && data.publicKey || '').toString();
test.ifError(error);
test.ok(pubkey);
@ -369,13 +368,13 @@ const tests = {
'Get public key from certificate': (test: any) => {
pem.createCertificate((error: any, data: any) => {
var key = (data && data.clientKey || '').toString();
const key = (data && data.clientKey || '').toString();
test.ifError(error);
test.ok(key);
// test.ok(fs.readdirSync('./tmp').length === 0);
pem.getPublicKey(key, (error: any, data: any) => {
var pubkey = (data && data.publicKey || '').toString();
const pubkey = (data && data.publicKey || '').toString();
test.ifError(error);
test.ok(pubkey);
@ -390,13 +389,13 @@ const tests = {
'Get fingerprint from certificate': (test: any) => {
pem.createCertificate((error: any, data: any) => {
var certificate = (data && data.certificate || '').toString();
const certificate = (data && data.certificate || '').toString();
test.ifError(error);
test.ok(certificate);
// test.ok(fs.readdirSync('./tmp').length === 0);
pem.getFingerprint(certificate, (error: any, data: any) => {
var fingerprint = (data && data.fingerprint || '').toString();
const fingerprint = (data && data.fingerprint || '').toString();
test.ifError(error);
test.ok(fingerprint);
test.ok(fingerprint.match(/^[0-9A-F]{2}(:[0-9A-F]{2}){19}$/));
@ -409,19 +408,19 @@ const tests = {
'Get modulus from certificate': (test: any) => {
pem.createCertificate((error: any, data: any) => {
var certificate = (data && data.certificate || '').toString();
const certificate = (data && data.certificate || '').toString();
test.ifError(error);
test.ok(certificate);
// test.ok(fs.readdirSync('./tmp').length === 0);
pem.getModulus(certificate, (error: any, data: any) => {
var certmodulus = (data && data.modulus || '').toString();
const certmodulus = (data && data.modulus || '').toString();
test.ifError(error);
test.ok(certmodulus);
test.ok(certmodulus.match(/^[0-9A-F]*$/));
// test.ok(fs.readdirSync('./tmp').length === 0);
pem.getModulus(certificate, (error: any, data: any) => {
var keymodulus = (data && data.modulus || '').toString();
const keymodulus = (data && data.modulus || '').toString();
test.ifError(error);
test.ok(keymodulus);
test.ok(keymodulus.match(/^[0-9A-F]*$/));
@ -434,17 +433,17 @@ const tests = {
},
'Get modulus from a protected key': (test: any) => {
var certificate = ''; // fs.readFileSync('./test/fixtures/test.crt').toString();
var key = ''; // fs.readFileSync('./test/fixtures/test.key').toString();
const certificate = ''; // fs.readFileSync('./test/fixtures/test.crt').toString();
const key = ''; // fs.readFileSync('./test/fixtures/test.key').toString();
pem.getModulus(certificate, (error: any, data: any) => {
var certmodulus = (data && data.modulus || '').toString();
const certmodulus = (data && data.modulus || '').toString();
test.ifError(error);
test.ok(certmodulus);
test.ok(certmodulus.match(/^[0-9A-F]*$/));
// test.ok(fs.readdirSync('./tmp').length === 0);
pem.getModulus(key, 'password', (error: any, data: any) => {
var keymodulus = (data && data.modulus || '').toString();
const keymodulus = (data && data.modulus || '').toString();
test.ifError(error);
test.ok(keymodulus);
test.ok(keymodulus.match(/^[0-9A-F]*$/));
@ -453,15 +452,14 @@ const tests = {
test.done();
});
});
},
'Get DH param info': (test: any) => {
var dh = ''; // fs.readFileSync('./test/fixtures/test.dh').toString();
const dh = ''; // fs.readFileSync('./test/fixtures/test.dh').toString();
pem.getDhparamInfo(dh, (error: any, data: any) => {
var size = data && data.size || 0;
var prime = (data && data.prime || '').toString();
const size = data && data.size || 0;
const prime = (data && data.prime || '').toString();
test.ifError(error);
test.equal(size, 1024);
test.ok(prime);
@ -473,11 +471,11 @@ const tests = {
},
'Create and verify wildcard certificate': (test: any) => {
var certInfo = {
const certInfo = {
commonName: '*.node.ee'
};
pem.createCertificate(Object.create(certInfo), (error: any, data: any) => {
var certificate = (data && data.certificate || '').toString();
const certificate = (data && data.certificate || '').toString();
test.ifError(error);
// test.ok(fs.readdirSync('./tmp').length === 0);
@ -507,13 +505,12 @@ const tests = {
},
'Create PKCS12 without key password': (test: any) => {
pem.createPrivateKey((error: any, data: any) => {
var key = (data && data.key || '').toString();
const key = (data && data.key || '').toString();
pem.createCertificate({
clientKey: key,
selfSigned: true
}, (error: any, csr: any) => {
pem.createPkcs12(csr.clientKey, csr.certificate, 'mypassword', (err: any, pkcs12: any) => {
test.ifError(err);
test.ok(pkcs12);
@ -526,13 +523,12 @@ const tests = {
},
'Create PKCS12 with key password': (test: any) => {
pem.createPrivateKey({cipher: 'aes128', password: 'xxx'}, (error: any, data: any) => {
var key = (data && data.key || '').toString();
const key = (data && data.key || '').toString();
pem.createCertificate({
clientKey: key,
selfSigned: true
}, (error: any, csr: any) => {
pem.createPkcs12(csr.clientKey, csr.certificate, 'mypassword', {cipher: 'aes256', clientKeyPassword: 'xxx'}, (err: any, pkcs12: any) => {
test.ifError(err);
test.ok(pkcs12);

View File

@ -3,20 +3,19 @@
// Definitions by: Brice Theurillat <https://github.com/BNedry/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace PlugAPI {
export interface PlugLogin {
interface PlugLogin {
email: string;
password: string;
}
export interface Notification {
interface Notification {
action: string;
id: number;
timestamp: string;
value: string;
}
export interface RawChatMessage {
interface RawChatMessage {
cid: string;
message: string;
sub: number;
@ -24,7 +23,7 @@ declare namespace PlugAPI {
un: string;
}
export interface Media {
interface Media {
author: string;
format: number;
image: string;
@ -34,7 +33,7 @@ declare namespace PlugAPI {
id: number;
}
export interface Score {
interface Score {
positive: number;
listeners: number;
grabs: number;
@ -42,23 +41,23 @@ declare namespace PlugAPI {
skipped: number;
}
export interface LastPlay {
interface LastPlay {
dj: User.DJ;
media: Media;
score: Score;
}
export interface FollowJoinData {
interface FollowJoinData {
r: number;
un: string;
id: string;
}
export interface LogObject {
log: () => void;
interface LogObject {
log(): void;
}
export namespace User {
namespace User {
interface Default {
username: string;
language: string;
@ -110,7 +109,7 @@ declare namespace PlugAPI {
}
}
export namespace Enum {
namespace Enum {
interface RoomRole {
NONE: number;
RESIDENTDJ: number;
@ -217,7 +216,7 @@ declare namespace PlugAPI {
}
}
export namespace Event {
namespace Event {
interface BoothCycle {
moderator: string;
cycle: boolean;
@ -339,21 +338,21 @@ declare namespace PlugAPI {
interface Command extends Event.Chat {
command: string;
args: string[];
respond: (...args: any[]) => any;
respondTimeout: (...args: any[]) => any;
havePermission: (...args: any[]) => boolean;
isFrom: (...args: any[]) => boolean;
respond(...args: any[]): any;
respondTimeout(...args: any[]): any;
havePermission(...args: any[]): boolean;
isFrom(...args: any[]): boolean;
}
}
export var ROOM_ROLE: Enum.RoomRole;
export var GLOBAL_ROLES: Enum.GlobalRole;
export var STATUS: Enum.Status;
export var BAN: Enum.Ban;
export var BAN_REASON: Enum.BanReason;
export var MUTE: Enum.Mute;
export var MUTE_REASON: Enum.MuteReason;
export var events: Enum.Events;
const ROOM_ROLE: Enum.RoomRole;
const GLOBAL_ROLES: Enum.GlobalRole;
const STATUS: Enum.Status;
const BAN: Enum.Ban;
const BAN_REASON: Enum.BanReason;
const MUTE: Enum.Mute;
const MUTE_REASON: Enum.MuteReason;
const events: Enum.Events;
}
declare class PlugAPI {
@ -412,4 +411,5 @@ declare class PlugAPI {
on(event: "command", callback: (data: PlugAPI.Event.Command) => void): void;
on(event: string, callback: (data: any) => void): void;
}
export = PlugAPI;

View File

@ -7,7 +7,7 @@ ps.run('my_script.py', err => {
console.log('finished');
});
var options = {
const options = {
mode: 'text',
pythonPath: 'path/to/python',
pythonOptions: ['-u'],
@ -21,7 +21,7 @@ ps.run('my_script.py', options, (err, results) => {
console.log('results: %j', results);
});
var pyshell = new PythonShell('my_script.py');
const pyshell = new PythonShell('my_script.py');
// sends a message to the Python script via stdin
pyshell.send('hello');
@ -35,4 +35,4 @@ pyshell.on('message', message => {
pyshell.end(err => {
if (err) throw err;
console.log('finished');
});
});

View File

@ -654,12 +654,12 @@ declare namespace BackendAPI {
interface INxPatch {
/**
* Operation to perform.
* One of:
* # Add
* # Remove
* # Replace
*/
* Operation to perform.
* One of:
* # Add
* # Remove
* # Replace
*/
qOp: PatchType;
/**
@ -1182,7 +1182,7 @@ declare namespace AppAPI {
field(field?: string, state?: string): FieldAPI.IQField;
/**
* Step forward in list of selections.
* Step forward in list of selections.
* @return {Promise} - A promise of a Qlik engine reply.
*/
forward(): ng.IPromise<any>;
@ -2178,7 +2178,7 @@ declare namespace VisualizationAPI {
* # treemap
* # extension
* @param {array} [cols] - Optional. Column definitions, dimensions and measures.
Each entry can be of the following structures:
* Each entry can be of the following structures:
* # String
* # NxDimension
* # NxMeasure
@ -2481,14 +2481,14 @@ interface IQVAngular {
filter(object: { [name: string]: ng.Injectable<Function> }): void;
/**
* Register a service constructor, which will be invoked with new to create
* the service instance. This is short for registering a service where its
* provider's $get property is a factory function that returns an instance
* instantiated by the injector from the service constructor function.
* @param name The name of the instance.
* @param serviceConstructor An injectable class (constructor function) that will be instantiated.
* @return Returns the constructed singleton of the service class/function.
*/
* Register a service constructor, which will be invoked with new to create
* the service instance. This is short for registering a service where its
* provider's $get property is a factory function that returns an instance
* instantiated by the injector from the service constructor function.
* @param name The name of the instance.
* @param serviceConstructor An injectable class (constructor function) that will be instantiated.
* @return Returns the constructed singleton of the service class/function.
*/
service<T>(name: string, serviceConstructor: ng.Injectable<Function>): T;
service<T>(object: { [name: string]: ng.Injectable<Function> }): T;

View File

@ -19,9 +19,9 @@ declare module "rrule" {
declare namespace RRule {
/**
* see <http://labix.org/python-dateutil/#head-cf004ee9a75592797e076752b2a889c10f445418>
* The only required option is `freq`, one of RRule.YEARLY, RRule.MONTHLY, ...
*/
* see <http://labix.org/python-dateutil/#head-cf004ee9a75592797e076752b2a889c10f445418>
* The only required option is `freq`, one of RRule.YEARLY, RRule.MONTHLY, ...
*/
interface Options {
freq: RRule.Frequency;
dtstart?: Date;
@ -55,10 +55,10 @@ declare namespace RRule {
declare class RRule {
/**
* @param {Object?} options - see <http://labix.org/python-dateutil/#head-cf004ee9a75592797e076752b2a889c10f445418>
* The only required option is `freq`, one of RRule.YEARLY, RRule.MONTHLY, ...
* @constructor
*/
* @param {Object?} options - see <http://labix.org/python-dateutil/#head-cf004ee9a75592797e076752b2a889c10f445418>
* The only required option is `freq`, one of RRule.YEARLY, RRule.MONTHLY, ...
* @constructor
*/
constructor(options: RRule.Options, noCache?: boolean);
options: RRule.Options;
@ -66,55 +66,55 @@ declare class RRule {
origOptions: RRule.Options;
/**
* Returns the first recurrence after the given datetime instance.
* The inc keyword defines what happens if dt is an occurrence.
* With inc == True, if dt itself is an occurrence, it will be returned.
* @return Date or null
*/
* Returns the first recurrence after the given datetime instance.
* The inc keyword defines what happens if dt is an occurrence.
* With inc == True, if dt itself is an occurrence, it will be returned.
* @return Date or null
*/
after(dt: Date, inc?: boolean): Date;
/**
* @param {Function} iterator - optional function that will be called
* on each date that is added. It can return false
* to stop the iteration.
* @return Array containing all recurrences.
*/
* @param {Function} iterator - optional function that will be called
* on each date that is added. It can return false
* to stop the iteration.
* @return Array containing all recurrences.
*/
all(iterator?: (date: Date, index?: number) => void): Date[];
/**
* Returns all the occurrences of the rrule between after and before.
* The inc keyword defines what happens if after and/or before are
* themselves occurrences. With inc == True, they will be included in the
* list, if they are found in the recurrence set.
* @return Array
*/
* Returns all the occurrences of the rrule between after and before.
* The inc keyword defines what happens if after and/or before are
* themselves occurrences. With inc == True, they will be included in the
* list, if they are found in the recurrence set.
* @return Array
*/
between(a: Date, b: Date, inc?: boolean, iterator?: (date: Date, index: number) => void): Date[];
/**
* Returns the last recurrence before the given datetime instance.
* The inc keyword defines what happens if dt is an occurrence.
* With inc == True, if dt itself is an occurrence, it will be returned.
* @return Date or null
*/
* Returns the last recurrence before the given datetime instance.
* The inc keyword defines what happens if dt is an occurrence.
* With inc == True, if dt itself is an occurrence, it will be returned.
* @return Date or null
*/
before(dt: Date, inc?: boolean): Date;
/**
* Returns the number of recurrences in this set. It will have go trough
* the whole recurrence, if this hasn't been done before.
*/
* Returns the number of recurrences in this set. It will have go trough
* the whole recurrence, if this hasn't been done before.
*/
count(): number;
/**
* Converts the rrule into its string representation
* @see <http://www.ietf.org/rfc/rfc2445.txt>
* @return String
*/
* Converts the rrule into its string representation
* @see <http://www.ietf.org/rfc/rfc2445.txt>
* @return String
*/
toString(): string;
/**
* Will convert all rules described in nlp:ToText
* to text.
*/
* Will convert all rules described in nlp:ToText
* to text.
*/
toText(gettext?: (str: string) => string, language?: any): string;
isFullyConvertibleToText(): boolean;
@ -165,11 +165,10 @@ declare namespace RRule {
class RRuleSet extends RRule {
/**
*
* @param {Boolean?} noCache
* The same stratagy as RRule on cache, default to false
* @constructor
*/
* @param {Boolean?} noCache
* The same stratagy as RRule on cache, default to false
* @constructor
*/
constructor(noCache?: boolean);
rrule(rrule: RRule): void;
rdate(date: Date): void;
@ -177,13 +176,13 @@ declare namespace RRule {
exdate(date: Date): void;
valueOf(): string[];
/**
* to generate recurrence field sush as:
* ["RRULE:FREQ=YEARLY;COUNT=2;BYDAY=TU;DTSTART=19970902T010000Z","RRULE:FREQ=YEARLY;COUNT=1;BYDAY=TH;DTSTART=19970902T010000Z"]
*/
* to generate recurrence field sush as:
* ["RRULE:FREQ=YEARLY;COUNT=2;BYDAY=TU;DTSTART=19970902T010000Z","RRULE:FREQ=YEARLY;COUNT=1;BYDAY=TH;DTSTART=19970902T010000Z"]
*/
toString(): string;
/**
* Create a new RRuleSet Object completely base on current instance
*/
* Create a new RRuleSet Object completely base on current instance
*/
clone(): RRuleSet;
}
}

View File

@ -1549,7 +1549,7 @@ declare namespace SPAnimation {
class State {
SetAttribute(attributeId: Attribute, value: number): void;
GetAttribute(attributeId: Attribute): number;
GetDataIndex(attributeId: Attribute): number
GetDataIndex(attributeId: Attribute): number;
}
class Object {
@ -5134,7 +5134,8 @@ declare namespace Microsoft.SharePoint.Client.Search {
get_uiLanguage: () => number;
set_uiLanguage: (value: number) => void;
getQuerySuggestionsWithResults: (iNumberOfQuerySuggestions: number,
getQuerySuggestionsWithResults: (
iNumberOfQuerySuggestions: number,
iNumberOfResultSuggestions: number,
fPreQuerySuggestions: boolean,
fHitHighlighting: boolean,
@ -5493,7 +5494,8 @@ declare namespace Microsoft.SharePoint.Client.Search {
namespace Administration {
class DocumentCrawlLog extends SP.ClientObject {
constructor(context: SP.ClientContext, site: SP.Site);
getCrawledUrls: (getCountOnly: boolean,
getCrawledUrls: (
getCountOnly: boolean,
maxRows: { High: number; Low: number; },
queryString: string,
isLike: boolean,
@ -9299,7 +9301,7 @@ declare class SPClientPeoplePicker {
WebApplicationID: SP.Guid; // '{00000000-0000-0000-0000-000000000000}',
GetAllUserInfo(): ISPClientPeoplePickerEntity[];
SetInitialValue(entities: ISPClientPeoplePickerEntity[], initialErrorMsg?: string): void
SetInitialValue(entities: ISPClientPeoplePickerEntity[], initialErrorMsg?: string): void;
AddUserKeys(userKeys: string, bSearch: boolean): void;
BatchAddUserKeysOperation(allKeys: string[], numProcessed: number): void;
ResolveAllUsers(fnContinuation: () => void): void;
@ -9331,7 +9333,7 @@ declare class SPClientPeoplePicker {
IterateEachProcessedUser(fnCallback: (index: number, user: SPClientPeoplePickerProcessedUser) => void): void;
HasResolvedUsers(): boolean;
Validate(): void;
ValidateCurrentState(): void
ValidateCurrentState(): void;
GetUnresolvedEntityErrorMessage(): string;
ShowErrorMessage(msg: string): void;
ClearServerError(): void;
@ -11652,7 +11654,7 @@ declare namespace Srch {
/** Same as $addHandler with safety checks */
static addHandler(element: Element, eventName: string, handler: (instance: any, eventArgs: any) => void): void;
/** Same as $removeHandler with safety checks */
static removeHandler(element: Element, eventName: string, handler: (instance: any, eventArgs: any) => void): void
static removeHandler(element: Element, eventName: string, handler: (instance: any, eventArgs: any) => void): void;
/** Returns true if the specified element is a descendant of the container element */
static isDescendant(element: Element, container: Element): boolean;
@ -11670,7 +11672,7 @@ declare namespace Srch {
static findResultObjectFromDOM(e: Element, type: string): any;
/** Appends specified parameter key and value string to the specified URL */
static appendUrlParameter(url: string, keyAndValue: string): string
static appendUrlParameter(url: string, keyAndValue: string): string;
/** Ensures that the given URL protocol value is allowed. Returns the specified URL value if the protocol is allowed; empty string otherwise. */
static ensureAllowedProtocol(value: string): string;

View File

@ -1728,7 +1728,7 @@ namespace spdevlab {
});
});
}
};
}
}
}
@ -2156,7 +2156,7 @@ namespace _ {
$('#report').children().remove();
$('#report').append("Failed to get session. Error: " + args.get_message());
}
};
}
// publishing.ts
// Variables used in various callbacks
@ -2349,7 +2349,6 @@ namespace App {
.then(l => this.lists = l)
.catch((e: string) => this.$n.show(e, true))
.finally(() => this.$n.remove(loading));
;
}
}

View File

@ -1,6 +1,7 @@
{
"extends": "../tslint.json",
"rules": {
"jsdoc-format": false,
"max-line-length": false
}
}

View File

@ -5,7 +5,7 @@
interface Options {
duration?: number;
easing?: (currentTime: number, beginningTime: number, changeInValue: number, duration: number) => number;
easing?(currentTime: number, beginningTime: number, changeInValue: number, duration: number): number;
start: number;
end: number;
}

View File

@ -6,7 +6,7 @@ const tweezer = new Tweezer({
});
tweezer
.on('tick', (foo) => {foo.toFixed()})
.on('tick', (foo) => { foo.toFixed(); })
.on('done', () => {})
.begin()
.stop();

View File

@ -93,8 +93,8 @@ declare module 'angular' {
}
/**
* Sticky state
*/
* Sticky state
*/
interface IStickyState extends angular.ui.IState {
/*
* When marking a state sticky, the state must target its own unique named ui-view.

View File

@ -25,17 +25,17 @@ interface SrcOptions extends globStream.Options {
cwd?: string;
/**
* Specifies the folder relative to the cwd
* This is used to determine the file names when saving in .dest()
* Default: where the glob begins
*/
* Specifies the folder relative to the cwd
* This is used to determine the file names when saving in .dest()
* Default: where the glob begins
*/
base?: string;
/**
* Setting this to false will make file.contents a paused stream
* If true it will buffer the file contents
* Default: true
*/
* Setting this to false will make file.contents a paused stream
* If true it will buffer the file contents
* Default: true
*/
buffer?: boolean;
/**
@ -59,10 +59,10 @@ interface SrcOptions extends globStream.Options {
followSymlinks?: boolean;
/**
* Setting this to false will ignore the contents of the file and disable
* writing to disk to speed up operations
* Default: true
*/
* Setting this to false will ignore the contents of the file and disable
* writing to disk to speed up operations
* Default: true
*/
read?: boolean;
/**
@ -95,30 +95,30 @@ interface SrcOptions extends globStream.Options {
}
/**
* Gets files that match the glob and converts them into the vinyl format
* @param globs Takes a glob string or an array of glob strings as the first argument
* Globs are executed in order, so negations should follow positive globs
* fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js'])
* @param opt Options Vinyl source options, changes the way the files are read, found, or stored in the vinyl stream
*/
* Gets files that match the glob and converts them into the vinyl format
* @param globs Takes a glob string or an array of glob strings as the first argument
* Globs are executed in order, so negations should follow positive globs
* fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js'])
* @param opt Options Vinyl source options, changes the way the files are read, found, or stored in the vinyl stream
*/
export function src(globs: string|string[], opt?: SrcOptions): NodeJS.ReadWriteStream;
/**
* This is just a glob-watcher
*
* @param globs Takes a glob string or an array of glob strings as the first argument
* Globs are executed in order, so negations should follow positive globs
* fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js'])
*/
* This is just a glob-watcher
*
* @param globs Takes a glob string or an array of glob strings as the first argument
* Globs are executed in order, so negations should follow positive globs
* fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js'])
*/
export function watch(globs: string|string[], cb?: (outEvt: { type: any; path: any; old: any; }) => void): _events.EventEmitter;
/**
* This is just a glob-watcher
*
* @param globs Takes a glob string or an array of glob strings as the first argument
* Globs are executed in order, so negations should follow positive globs
* fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js'])
*/
* This is just a glob-watcher
*
* @param globs Takes a glob string or an array of glob strings as the first argument
* Globs are executed in order, so negations should follow positive globs
* fs.src(['!b*.js', '*.js']) would not exclude any files, but this would: fs.src(['*.js', '!b*.js'])
*/
export function watch(
globs: string|string[],
opt?: {
@ -130,24 +130,24 @@ export function watch(
cb?: (outEvt: { type: any; path: any; old: any; }) => void): _events.EventEmitter;
/**
* On write the stream will save the vinyl File to disk at the folder/cwd specified.
* After writing the file to disk, it will be emitted from the stream so you can keep piping these around.
* The file will be modified after being written to this stream:
* cwd, base, and path will be overwritten to match the folder
* stat.mode will be overwritten if you used a mode parameter
* contents will have it's position reset to the beginning if it is a stream
* @param folder destination folder
*/
* On write the stream will save the vinyl File to disk at the folder/cwd specified.
* After writing the file to disk, it will be emitted from the stream so you can keep piping these around.
* The file will be modified after being written to this stream:
* cwd, base, and path will be overwritten to match the folder
* stat.mode will be overwritten if you used a mode parameter
* contents will have it's position reset to the beginning if it is a stream
* @param folder destination folder
*/
export function dest(folder: string, opt?: {
/** Specify the working directory the folder is relative to
* Default is process.cwd()
*/
* Default is process.cwd()
*/
cwd?: string;
/** Specify the mode the files should be created with
* Default is the mode of the input file (file.stat.mode)
* or the process mode if the input file has no mode property
*/
* Default is the mode of the input file (file.stat.mode)
* or the process mode if the input file has no mode property
*/
mode?: number|string;
/** Specify the mode the directory should be created with. Default is the process mode */
@ -158,56 +158,56 @@ export function dest(folder: string, opt?: {
}): NodeJS.ReadWriteStream;
/**
* On write the stream will save the vinyl File to disk at the folder/cwd specified.
* After writing the file to disk, it will be emitted from the stream so you can keep piping these around.
* The file will be modified after being written to this stream:
* cwd, base, and path will be overwritten to match the folder
* stat.mode will be overwritten if you used a mode parameter
* contents will have it's position reset to the beginning if it is a stream
* @param getFolderPath function that takes in a file and returns a folder path
*/
* On write the stream will save the vinyl File to disk at the folder/cwd specified.
* After writing the file to disk, it will be emitted from the stream so you can keep piping these around.
* The file will be modified after being written to this stream:
* cwd, base, and path will be overwritten to match the folder
* stat.mode will be overwritten if you used a mode parameter
* contents will have it's position reset to the beginning if it is a stream
* @param getFolderPath function that takes in a file and returns a folder path
*/
export function dest(getFolderPath: (file: File) => string): NodeJS.ReadWriteStream;
/**
* On write the stream will create a symbolic link (i.e. symlink) on disk at the folder/cwd specified.
* After creating the symbolic link, it will be emitted from the stream so you can keep piping these around.
* The file will be modified after being written to this stream:
* cwd, base, and path will be overwritten to match the folder
*/
* On write the stream will create a symbolic link (i.e. symlink) on disk at the folder/cwd specified.
* After creating the symbolic link, it will be emitted from the stream so you can keep piping these around.
* The file will be modified after being written to this stream:
* cwd, base, and path will be overwritten to match the folder
*/
export function symlink(folder: string, opts?: {
/**
* Specify the working directory the folder is relative to
* Default is process.cwd()
*/
* Specify the working directory the folder is relative to
* Default is process.cwd()
*/
cwd?: string;
/** Specify the mode the directory should be created with. Default is the process mode */
mode?: number|string;
/**
* Specify the mode the directory should be created with
* Default is the process mode
*/
* Specify the mode the directory should be created with
* Default is the process mode
*/
dirMode?: number
}): NodeJS.ReadWriteStream;
/**
* On write the stream will create a symbolic link (i.e. symlink) on disk at the folder/cwd generated from getFolderPath.
* After creating the symbolic link, it will be emitted from the stream so you can keep piping these around.
* The file will be modified after being written to this stream:
* cwd, base, and path will be overwritten to match the folder
*/
* On write the stream will create a symbolic link (i.e. symlink) on disk at the folder/cwd generated from getFolderPath.
* After creating the symbolic link, it will be emitted from the stream so you can keep piping these around.
* The file will be modified after being written to this stream:
* cwd, base, and path will be overwritten to match the folder
*/
export function symlink(getFolderPath: (File: File) => string, opts?:
{
/**
* Specify the working directory the folder is relative to
* Default is process.cwd()
*/
* Specify the working directory the folder is relative to
* Default is process.cwd()
*/
cwd?: string;
/**
* Specify the mode the directory should be created with
* Default is the process mode
*/
* Specify the mode the directory should be created with
* Default is the process mode
*/
dirMode?: number
}): NodeJS.ReadWriteStream;

View File

@ -1,4 +1,3 @@
const tracks: string[] = ['chapter1.mp3', 'chapter2.mp3', 'chapter3.mp3'];
let trackId = 0;

View File

@ -1,6 +1,9 @@
// adapted from `cat wu.js/test/* |sed '/= require/d'> wu-tests.ts`
declare var describe: any, it: any, mocha: any, assert: {
declare const describe: any;
declare const it: any;
declare const mocha: any;
declare const assert: {
iterable: any;
eqSet<T>(expected: Set<T>, actual: Iterable<T>): any;
ok: any;

View File

@ -7,13 +7,12 @@ interface Tester {
same(a: any, b: any): void;
plan(id: number): void;
ok(a: any): void;
};
}
function test(c: string, f: (t: Tester) => void) {
return;
}
test('no elements', t => {
t.is(xml(), '');
t.is(xml([]), '');
@ -162,4 +161,4 @@ test('xml declaration options', t => {
t.is(xml([{a: 'test'}], {declaration: false}), '<a>test</a>');
t.is(xml([{a: 'test'}], {declaration: true, indent: '\n'}), '<?xml version="1.0" encoding="UTF-8"?>\n<a>test</a>');
t.is(xml([{a: 'test'}], {}), '<a>test</a>');
});
});

View File

@ -1,15 +1,15 @@
import * as parser from 'xml2json';
var xml = "<foo attr=\"value\">bar</foo>";
let xml = "<foo attr=\"value\">bar</foo>";
// xml to json
var jsonString: string = parser.toJson(xml);
const jsonString: string = parser.toJson(xml);
// json to xml
var xml: string = parser.toXml(jsonString);
xml = parser.toXml(jsonString);
// xml to json in object mode and JsonOptions
var jsonObject: {} = parser.toJson(xml, {
const jsonObject: {} = parser.toJson(xml, {
object: true,
reversible: false,
coerce: false,
@ -19,6 +19,6 @@ var jsonObject: {} = parser.toJson(xml, {
});
// json to xml with XmlOptions
var xml: string = parser.toXml(jsonObject, {
xml = parser.toXml(jsonObject, {
sanitize: true
});

View File

@ -10,14 +10,14 @@
// Remove the `declare module` wrapper.
// tslint:disable-next-line no-single-declare-module
declare module "@xmpp/jid" {
export function createJID(local: string, domain: string, resource: string): JID;
export function equal(a: JID, b: JID): boolean;
export function is(a: any): boolean;
function createJID(local: string, domain: string, resource: string): JID;
function equal(a: JID, b: JID): boolean;
function is(a: any): boolean;
/**
* Created by marcneumann on 17.02.17.
*/
export class JID {
class JID {
local: string;
domain: string;
resource: string;
@ -30,17 +30,17 @@ declare module "@xmpp/jid" {
/**
* Convenience method to distinguish users
**/
*/
bare(): JID;
/**
* Comparison function
**/
*/
equals(other: JID): boolean;
/**
* http://xmpp.org/rfcs/rfc6122.html#addressing-localpart
**/
*/
setLocal(local: string, escape?: any): void;
getLocal(unescape?: any): string;

View File

@ -9,4 +9,4 @@ export function validateXML(xml: string|NodeJS.ReadableStream|{file: string}, pa
valid: boolean;
messages: string[];
result: string;
}) => void): void;
}) => void): void;

View File

@ -1,7 +1,6 @@
import fs = require("fs");
import validator = require("xsd-schema-validator");
validator.validateXML("<foo:bar />", 'resources/foo.xsd', (err, result) => {
if (err) {
throw err;
@ -12,4 +11,4 @@ validator.validateXML(fs.createReadStream('some.xml'), "schema.xsd", (err) => {
});
validator.validateXML({ file: "some.xml" }, "schema.xsd", (err) => {
if (err) throw err;
});
});