mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-12 04:50:18 +00:00
Merge branch 'master' of github.com:borisyankov/DefinitelyTyped
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
*.map
|
||||
*.swp
|
||||
.DS_Store
|
||||
npm-debug.log
|
||||
|
||||
_Resharper.DefinitelyTyped
|
||||
bin
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "iojs-v2"
|
||||
- 4
|
||||
|
||||
sudo: false
|
||||
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
/// <reference path="adm-zip.d.ts" />
|
||||
import AdmZip = require("adm-zip");
|
||||
|
||||
|
||||
// reading archives
|
||||
var zip = new AdmZip("./my_file.zip");
|
||||
var zipEntries = zip.getEntries(); // an array of ZipEntry records
|
||||
var zipEntries: AdmZip.IZipEntry[] = zip.getEntries(); // an array of ZipEntry records
|
||||
|
||||
zipEntries.forEach(function (zipEntry) {
|
||||
console.log(zipEntry.toString()); // outputs zip entries information
|
||||
@@ -31,3 +30,32 @@ zip.addLocalFile("/home/me/some_picture.png");
|
||||
var willSendthis = zip.toBuffer();
|
||||
// or write everything to disk
|
||||
zip.writeZip(/*target file name*/"/home/me/files.zip");
|
||||
|
||||
function processZipEntry(zipEntry: AdmZip.IZipEntry) {
|
||||
console.log('comment', zipEntry.comment);
|
||||
}
|
||||
|
||||
//tests taken from examples at https://github.com/cthackers/adm-zip/wiki/ADM-ZIP
|
||||
import Zip = require("adm-zip");
|
||||
// loads and parses existing zip file local_file.zip
|
||||
var zip = new Zip("local_file.zip");
|
||||
// creates new in memory zip
|
||||
zip = new Zip();
|
||||
// loads and parses existing zip file local_file.zip
|
||||
zip = new Zip("local_file.zip");
|
||||
// get all entries and iterate them
|
||||
zip.getEntries().forEach((entry) => {
|
||||
var entryName = entry.entryName;
|
||||
var decompressedData = zip.readFile(entry); // decompressed buffer of the entry
|
||||
console.log(zip.readAsText(entry)); // outputs the decompressed content of the entry
|
||||
});
|
||||
|
||||
// will extract the file myfile.txt from the archive to /home/user/folder/subfolder/myfile.txt
|
||||
zip.extractEntryTo("folder/subfolder/myfile.txt", "/home/user/", true, true);
|
||||
|
||||
// will extract the file myfile.txt from the archive to /home/user/myfile.txt
|
||||
zip.extractEntryTo("folder/subfolder/myfile.txt", "/home/user/", false, true);
|
||||
|
||||
function isAdmZipEntry(obj: any): obj is AdmZip.IZipEntry {
|
||||
return obj !== null && typeof obj === "object" && typeof obj['entryName'] === 'string';
|
||||
}
|
||||
Vendored
+80
-81
@@ -5,8 +5,8 @@
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module AdmZip {
|
||||
class ZipFile {
|
||||
declare module "adm-zip" {
|
||||
class AdmZip {
|
||||
/**
|
||||
* Create a new, empty archive.
|
||||
*/
|
||||
@@ -28,7 +28,7 @@ declare module AdmZip {
|
||||
* @param entry ZipEntry object
|
||||
* @return Buffer or Null in case of error
|
||||
*/
|
||||
readFile(entry: IZipEntry): Buffer;
|
||||
readFile(entry: AdmZip.IZipEntry): Buffer;
|
||||
/**
|
||||
* Asynchronous readFile
|
||||
* @param entry String with the full path of the entry
|
||||
@@ -41,7 +41,7 @@ declare module AdmZip {
|
||||
* @param callback Called with a Buffer or Null in case of error
|
||||
* @return Buffer or Null in case of error
|
||||
*/
|
||||
readFileAsync(entry: IZipEntry, callback: (data: Buffer, err: string) => any): void;
|
||||
readFileAsync(entry: AdmZip.IZipEntry, callback: (data: Buffer, err: string) => any): void;
|
||||
/**
|
||||
* Extracts the given entry from the archive and returns the content as
|
||||
* plain text in the given encoding
|
||||
@@ -57,7 +57,7 @@ declare module AdmZip {
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
* @return String
|
||||
*/
|
||||
readAsText(fileName: IZipEntry, encoding?: string): string;
|
||||
readAsText(fileName: AdmZip.IZipEntry, encoding?: string): string;
|
||||
/**
|
||||
* Asynchronous readAsText
|
||||
* @param entry String with the full path of the entry
|
||||
@@ -71,7 +71,7 @@ declare module AdmZip {
|
||||
* @param callback Called with the resulting string.
|
||||
* @param encoding Optional. If no encoding is specified utf8 is used
|
||||
*/
|
||||
readAsTextAsync(fileName: IZipEntry, callback: (data: string) => any, encoding?: string): void;
|
||||
readAsTextAsync(fileName: AdmZip.IZipEntry, callback: (data: string) => any, encoding?: string): void;
|
||||
/**
|
||||
* Remove the entry from the file or the entry and all its nested directories
|
||||
* and files if the given entry is a directory
|
||||
@@ -83,7 +83,7 @@ declare module AdmZip {
|
||||
* and files if the given entry is a directory
|
||||
* @param entry A ZipEntry object.
|
||||
*/
|
||||
deleteFile(entry: IZipEntry): void;
|
||||
deleteFile(entry: AdmZip.IZipEntry): void;
|
||||
/**
|
||||
* Adds a comment to the zip. The zip must be rewritten after
|
||||
* adding the comment.
|
||||
@@ -110,7 +110,7 @@ declare module AdmZip {
|
||||
* @param entry ZipEntry object.
|
||||
* @param comment The comment to add to the entry.
|
||||
*/
|
||||
addZipEntryComment(entry: IZipEntry, comment: string): void;
|
||||
addZipEntryComment(entry: AdmZip.IZipEntry, comment: string): void;
|
||||
/**
|
||||
* Returns the comment of the specified entry.
|
||||
* @param entry String with the full path of the entry.
|
||||
@@ -122,7 +122,7 @@ declare module AdmZip {
|
||||
* @param entry ZipEntry object.
|
||||
* @return String The comment of the specified entry.
|
||||
*/
|
||||
getZipEntryComment(entry: IZipEntry): string;
|
||||
getZipEntryComment(entry: AdmZip.IZipEntry): string;
|
||||
/**
|
||||
* Updates the content of an existing entry inside the archive. The zip
|
||||
* must be rewritten after updating the content
|
||||
@@ -136,7 +136,7 @@ declare module AdmZip {
|
||||
* @param entry ZipEntry object.
|
||||
* @param content The entry's new contents.
|
||||
*/
|
||||
updateFile(entry: IZipEntry, content: Buffer): void;
|
||||
updateFile(entry: AdmZip.IZipEntry, content: Buffer): void;
|
||||
/**
|
||||
* Adds a file from the disk to the archive.
|
||||
* @param localPath Path to a file on disk.
|
||||
@@ -167,14 +167,14 @@ declare module AdmZip {
|
||||
* Returns an array of ZipEntry objects representing the files and folders
|
||||
* inside the archive
|
||||
*/
|
||||
getEntries(): IZipEntry[];
|
||||
getEntries(): AdmZip.IZipEntry[];
|
||||
/**
|
||||
* Returns a ZipEntry object representing the file or folder specified by
|
||||
* ``name``.
|
||||
* @param name Name of the file or folder to retrieve.
|
||||
* @return ZipEntry The entry corresponding to the name.
|
||||
*/
|
||||
getEntry(name: string): IZipEntry;
|
||||
getEntry(name: string): AdmZip.IZipEntry;
|
||||
/**
|
||||
* Extracts the given entry to the given targetPath.
|
||||
* If the entry is a directory inside the archive, the entire directory and
|
||||
@@ -203,7 +203,7 @@ declare module AdmZip {
|
||||
* will be overwriten if this is true. Default is FALSE
|
||||
* @return Boolean
|
||||
*/
|
||||
extractEntryTo(entryPath: IZipEntry, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean;
|
||||
extractEntryTo(entryPath: AdmZip.IZipEntry, targetPath: string, maintainEntryPath?: boolean, overwrite?: boolean): boolean;
|
||||
/**
|
||||
* Extracts the entire archive to the given location
|
||||
* @param targetPath Target location
|
||||
@@ -225,76 +225,75 @@ declare module AdmZip {
|
||||
toBuffer(): Buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* The ZipEntry is more than a structure representing the entry inside the
|
||||
* zip file. Beside the normal attributes and headers a entry can have, the
|
||||
* class contains a reference to the part of the file where the compressed
|
||||
* data resides and decompresses it when requested. It also compresses the
|
||||
* data and creates the headers required to write in the zip file.
|
||||
*/
|
||||
interface IZipEntry {
|
||||
module AdmZip {
|
||||
/**
|
||||
* Represents the full name and path of the file
|
||||
* The ZipEntry is more than a structure representing the entry inside the
|
||||
* zip file. Beside the normal attributes and headers a entry can have, the
|
||||
* class contains a reference to the part of the file where the compressed
|
||||
* data resides and decompresses it when requested. It also compresses the
|
||||
* data and creates the headers required to write in the zip file.
|
||||
*/
|
||||
entryName: string;
|
||||
rawEntryName: Buffer;
|
||||
/**
|
||||
* Extra data associated with this entry.
|
||||
*/
|
||||
extra: Buffer;
|
||||
/**
|
||||
* Entry comment.
|
||||
*/
|
||||
comment: string;
|
||||
name: string;
|
||||
/**
|
||||
* Read-Only property that indicates the type of the entry.
|
||||
*/
|
||||
isDirectory: boolean;
|
||||
/**
|
||||
* Get the header associated with this ZipEntry.
|
||||
*/
|
||||
header: Buffer;
|
||||
/**
|
||||
* Retrieve the compressed data for this entry. Note that this may trigger
|
||||
* compression if any properties were modified.
|
||||
*/
|
||||
getCompressedData(): Buffer;
|
||||
/**
|
||||
* Asynchronously retrieve the compressed data for this entry. Note that
|
||||
* this may trigger compression if any properties were modified.
|
||||
*/
|
||||
getCompressedDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: string): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: Buffer): void;
|
||||
/**
|
||||
* Get the decompressed data associated with this entry.
|
||||
*/
|
||||
getData(): Buffer;
|
||||
/**
|
||||
* Asynchronously get the decompressed data associated with this entry.
|
||||
*/
|
||||
getDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Returns the CEN Entry Header to be written to the output zip file, plus
|
||||
* the extra data and the entry comment.
|
||||
*/
|
||||
packHeader(): Buffer;
|
||||
/**
|
||||
* Returns a nicely formatted string with the most important properties of
|
||||
* the ZipEntry.
|
||||
*/
|
||||
toString(): string;
|
||||
interface IZipEntry {
|
||||
/**
|
||||
* Represents the full name and path of the file
|
||||
*/
|
||||
entryName: string;
|
||||
rawEntryName: Buffer;
|
||||
/**
|
||||
* Extra data associated with this entry.
|
||||
*/
|
||||
extra: Buffer;
|
||||
/**
|
||||
* Entry comment.
|
||||
*/
|
||||
comment: string;
|
||||
name: string;
|
||||
/**
|
||||
* Read-Only property that indicates the type of the entry.
|
||||
*/
|
||||
isDirectory: boolean;
|
||||
/**
|
||||
* Get the header associated with this ZipEntry.
|
||||
*/
|
||||
header: Buffer;
|
||||
/**
|
||||
* Retrieve the compressed data for this entry. Note that this may trigger
|
||||
* compression if any properties were modified.
|
||||
*/
|
||||
getCompressedData(): Buffer;
|
||||
/**
|
||||
* Asynchronously retrieve the compressed data for this entry. Note that
|
||||
* this may trigger compression if any properties were modified.
|
||||
*/
|
||||
getCompressedDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: string): void;
|
||||
/**
|
||||
* Set the (uncompressed) data to be associated with this entry.
|
||||
*/
|
||||
setData(value: Buffer): void;
|
||||
/**
|
||||
* Get the decompressed data associated with this entry.
|
||||
*/
|
||||
getData(): Buffer;
|
||||
/**
|
||||
* Asynchronously get the decompressed data associated with this entry.
|
||||
*/
|
||||
getDataAsync(callback: (data: Buffer) => void): void;
|
||||
/**
|
||||
* Returns the CEN Entry Header to be written to the output zip file, plus
|
||||
* the extra data and the entry comment.
|
||||
*/
|
||||
packHeader(): Buffer;
|
||||
/**
|
||||
* Returns a nicely formatted string with the most important properties of
|
||||
* the ZipEntry.
|
||||
*/
|
||||
toString(): string;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "adm-zip" {
|
||||
import zipFile = AdmZip.ZipFile;
|
||||
export = zipFile;
|
||||
export = AdmZip;
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -25,6 +25,6 @@ declare module angular.jwt {
|
||||
}
|
||||
|
||||
interface IJwtInterceptor {
|
||||
tokenGetter(): string;
|
||||
tokenGetter(...params : any[]): string;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,5 +96,5 @@ myApp.controller('SidenavController', ($scope: ng.IScope, $mdSidenav: ng.materia
|
||||
});
|
||||
|
||||
myApp.controller('ToastController', ($scope: ng.IScope, $mdToast: ng.material.IToastService) => {
|
||||
$scope['openToast'] = () => $mdToast.show($mdToast.simple().content('Hello!'));
|
||||
});
|
||||
$scope['openToast'] = () => $mdToast.show($mdToast.simple().textContent('Hello!'));
|
||||
});
|
||||
|
||||
+2
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for Angular Material 0.10.1-rc1+ (angular.material module)
|
||||
// Type definitions for Angular Material 1.0.0-rc5+ (angular.material module)
|
||||
// Project: https://github.com/angular/material
|
||||
// Definitions by: Matt Traynham <https://github.com/mtraynham>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -116,7 +116,7 @@ declare module angular.material {
|
||||
}
|
||||
|
||||
interface IToastPreset<T> {
|
||||
content(content: string): T;
|
||||
textContent(content: string): T;
|
||||
action(action: string): T;
|
||||
highlightAction(highlightAction: boolean): T;
|
||||
capsule(capsule: boolean): T;
|
||||
|
||||
Vendored
+6
@@ -165,6 +165,12 @@ declare module angular {
|
||||
dot: number;
|
||||
codeName: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* If window.name contains prefix NG_DEFER_BOOTSTRAP! when angular.bootstrap is called, the bootstrap process will be paused until angular.resumeBootstrap() is called.
|
||||
* @param extraModules An optional array of modules that should be added to the original list of modules that the app was about to be bootstrapped with.
|
||||
*/
|
||||
resumeBootstrap?(extraModules?: string[]): ng.auto.IInjectorService;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -2,11 +2,51 @@
|
||||
|
||||
import browserify = require("browserify");
|
||||
import fs = require("fs");
|
||||
import stream = require('stream');
|
||||
|
||||
var b: BrowserifyObject = browserify();
|
||||
var bNoArg = browserify();
|
||||
|
||||
var b = browserify({
|
||||
baseDir: 'somewhere'
|
||||
});
|
||||
b.add('./browser/main.js');
|
||||
b.transform('deamdify');
|
||||
b.bundle().pipe(fs.createWriteStream('bundle.js'));
|
||||
b.transform('deamdify')
|
||||
.transform(function (file) {
|
||||
return new stream.Transform();
|
||||
}).plugin((b, opts) => { return opts.l; }, {l: 3})
|
||||
.require('foo', { expose: 'bar' })
|
||||
.exclude('baz')
|
||||
.ignore('bat')
|
||||
.reset({ basedir: 'elsewhere' });
|
||||
|
||||
var customBrowsify: Browserify = require("browserify");
|
||||
b.on('file', (file) => {
|
||||
file += "";
|
||||
});
|
||||
|
||||
b.external(bNoArg);
|
||||
|
||||
var b2 = new browserify(['/some/File', {file: '/some/file' }, fs.createReadStream('/somewhere')], { builtins: ['buffer']})
|
||||
.reset({
|
||||
builtins: {
|
||||
'buffer': './customBuffer'
|
||||
}
|
||||
});
|
||||
|
||||
var customBrowsify = require("browserify");
|
||||
customBrowsify({entries: []});
|
||||
|
||||
var b = browserify('./browser/main.js', {
|
||||
noParse: ['jquery'],
|
||||
debug: true,
|
||||
foo: 'bar'
|
||||
});
|
||||
b.add('./browser/other.js');
|
||||
b.transform(function(file: string): NodeJS.ReadWriteStream {
|
||||
return new stream.PassThrough();
|
||||
});
|
||||
|
||||
var record_pipeline = b.pipeline.get('record');
|
||||
|
||||
b.bundle().pipe(process.stdout);
|
||||
|
||||
|
||||
|
||||
Vendored
+169
-28
@@ -1,41 +1,182 @@
|
||||
// Type definitions for Browserify
|
||||
// Type definitions for Browserify v12.0.1
|
||||
// Project: http://browserify.org/
|
||||
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar/>
|
||||
// Definitions by: Andrew Gaspar <https://github.com/AndrewGaspar/>, John Vilk <https://github.com/jvilk>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
interface BrowserifyObject extends NodeJS.EventEmitter {
|
||||
add(file:string, opts?:any): BrowserifyObject;
|
||||
require(file:string, opts?:{
|
||||
expose: string;
|
||||
}): BrowserifyObject;
|
||||
bundle(opts?:{
|
||||
insertGlobals?: boolean;
|
||||
detectGlobals?: boolean;
|
||||
debug?: boolean;
|
||||
standalone?: string;
|
||||
insertGlobalVars?: any;
|
||||
}, cb?:(err:any, src:any) => void): NodeJS.ReadableStream;
|
||||
declare module Browserify {
|
||||
/**
|
||||
* Options pertaining to an individual file.
|
||||
*/
|
||||
interface FileOptions {
|
||||
// If true, this is considered an entry point to your app.
|
||||
entry?: boolean;
|
||||
// Expose this file under a custom dependency name.
|
||||
// require('./vendor/angular/angular.js', {expose: 'angular'}) enables require('angular')
|
||||
expose?: string;
|
||||
// Basedir to use to resolve this file's path.
|
||||
basedir?: string;
|
||||
// The name/path to the file.
|
||||
file?: string;
|
||||
// Forward file to external() to be externalized.
|
||||
external?: boolean;
|
||||
// Disable transforms on file if set to false.
|
||||
transform?: boolean;
|
||||
// The ID to use for require() statements.
|
||||
id?: string;
|
||||
}
|
||||
|
||||
external(file:string, opts?:any): BrowserifyObject;
|
||||
ignore(file:string, opts?:any): BrowserifyObject;
|
||||
transform(tr:string, opts?:any): BrowserifyObject;
|
||||
transform(tr:Function, opts?:any): BrowserifyObject;
|
||||
plugin(plugin:string, opts?:any): BrowserifyObject;
|
||||
plugin(plugin:Function, opts?:any): BrowserifyObject;
|
||||
}
|
||||
|
||||
interface Browserify {
|
||||
(): BrowserifyObject;
|
||||
(files:string[]): BrowserifyObject;
|
||||
(opts:{
|
||||
entries?: string[];
|
||||
// Browserify accepts a filename, an input stream for file inputs, or a FileOptions configuration
|
||||
// for each file in a bundle.
|
||||
type InputFile = string | NodeJS.ReadableStream | FileOptions;
|
||||
|
||||
/**
|
||||
* Options pertaining to a Browserify instance.
|
||||
*/
|
||||
interface Options {
|
||||
// Custom properties can be defined on Options.
|
||||
// These options are forwarded along to module-deps and browser-pack directly.
|
||||
[propName: string]: any;
|
||||
// String, file object, or array of those types (they may be mixed) specifying entry file(s).
|
||||
entries?: InputFile | InputFile[];
|
||||
// an array which will skip all require() and global parsing for each file in the array.
|
||||
// Use this for giant libs like jquery or threejs that don't have any requires or node-style globals but take forever to parse.
|
||||
noParse?: string[];
|
||||
}): BrowserifyObject;
|
||||
// an array of optional extra extensions for the module lookup machinery to use when the extension has not been specified.
|
||||
// By default Browserify considers only .js and .json files in such cases.
|
||||
extensions?: string[];
|
||||
// the directory that Browserify starts bundling from for filenames that start with ..
|
||||
basedir?: string;
|
||||
// an array of directories that Browserify searches when looking for modules which are not referenced using relative path.
|
||||
// Can be absolute or relative to basedir. Equivalent of setting NODE_PATH environmental variable when calling Browserify command.
|
||||
paths?: string[];
|
||||
// sets the algorithm used to parse out the common paths. Use false to turn this off, otherwise it uses the commondir module.
|
||||
commondir?: boolean;
|
||||
// disables converting module ids into numerical indexes. This is useful for preserving the original paths that a bundle was generated with.
|
||||
fullPaths?: boolean;
|
||||
// sets the list of built-ins to use, which by default is set in lib/builtins.js in this distribution.
|
||||
builtins?: string[] | {[builtinName: string]: string} | boolean;
|
||||
// set if external modules should be bundled. Defaults to true.
|
||||
bundleExternal?: boolean;
|
||||
// When true, always insert process, global, __filename, and __dirname without analyzing the AST for faster builds but larger output bundles. Default false.
|
||||
insertGlobals?: boolean;
|
||||
// When true, scan all files for process, global, __filename, and __dirname, defining as necessary.
|
||||
// With this option npm modules are more likely to work but bundling takes longer. Default true.
|
||||
detectGlobals?: boolean;
|
||||
// When true, add a source map inline to the end of the bundle. This makes debugging easier because you can see all the original files if you are in a modern enough browser.
|
||||
debug?: boolean;
|
||||
// When a non-empty string, a standalone module is created with that name and a umd wrapper.
|
||||
// You can use namespaces in the standalone global export using a . in the string name as a separator, for example 'A.B.C'.
|
||||
// The global export will be sanitized and camel cased.
|
||||
standalone?: string;
|
||||
// will be passed to insert-module-globals as the opts.vars parameter.
|
||||
insertGlobalVars?: {[globalName: string]: (file: string, basedir: string) => any};
|
||||
// defaults to 'require' in expose mode but you can use another name.
|
||||
externalRequireName?: string;
|
||||
}
|
||||
|
||||
interface BrowserifyConstructor {
|
||||
(files: InputFile[], opts?: Options): BrowserifyObject;
|
||||
(file: InputFile, opts?: Options): BrowserifyObject;
|
||||
(opts: Options): BrowserifyObject;
|
||||
(): BrowserifyObject
|
||||
new(files: InputFile[], opts?: Options): BrowserifyObject;
|
||||
new(file: InputFile, opts?: Options): BrowserifyObject;
|
||||
new(opts: Options): BrowserifyObject;
|
||||
new(): BrowserifyObject
|
||||
}
|
||||
|
||||
interface BrowserifyObject extends NodeJS.EventEmitter {
|
||||
/**
|
||||
* Add an entry file from file that will be executed when the bundle loads.
|
||||
* If file is an array, each item in file will be added as an entry file.
|
||||
*/
|
||||
add(file: InputFile[], opts?: FileOptions): BrowserifyObject;
|
||||
add(file: InputFile, opts?: FileOptions): BrowserifyObject;
|
||||
/**
|
||||
* Make file available from outside the bundle with require(file).
|
||||
* The file param is anything that can be resolved by require.resolve().
|
||||
* file can also be a stream, but you should also use opts.basedir so that relative requires will be resolvable.
|
||||
* If file is an array, each item in file will be required. In file array form, you can use a string or object for each item. Object items should have a file property and the rest of the parameters will be used for the opts.
|
||||
* Use the expose property of opts to specify a custom dependency name. require('./vendor/angular/angular.js', {expose: 'angular'}) enables require('angular')
|
||||
*/
|
||||
require(file: InputFile, opts?: FileOptions): BrowserifyObject;
|
||||
/**
|
||||
* Bundle the files and their dependencies into a single javascript file.
|
||||
* Return a readable stream with the javascript file contents or optionally specify a cb(err, buf) to get the buffered results.
|
||||
*/
|
||||
bundle(cb?: (err: any, src: Buffer) => any): NodeJS.ReadableStream;
|
||||
/**
|
||||
* Prevent file from being loaded into the current bundle, instead referencing from another bundle.
|
||||
* If file is an array, each item in file will be externalized.
|
||||
* If file is another bundle, that bundle's contents will be read and excluded from the current bundle as the bundle in file gets bundled.
|
||||
*/
|
||||
external(file: string[], opts?: { basedir?: string }): BrowserifyObject;
|
||||
external(file: string, opts?: { basedir?: string }): BrowserifyObject;
|
||||
external(file: BrowserifyObject): BrowserifyObject;
|
||||
/**
|
||||
* Prevent the module name or file at file from showing up in the output bundle.
|
||||
* Instead you will get a file with module.exports = {}.
|
||||
*/
|
||||
ignore(file: string, opts?: { basedir?: string }): BrowserifyObject;
|
||||
/**
|
||||
* Prevent the module name or file at file from showing up in the output bundle.
|
||||
* If your code tries to require() that file it will throw unless you've provided another mechanism for loading it.
|
||||
*/
|
||||
exclude(file: string, opts?: { basedir?: string }): BrowserifyObject;
|
||||
/**
|
||||
* Transform source code before parsing it for require() calls with the transform function or module name tr.
|
||||
* If tr is a function, it will be called with tr(file) and it should return a through-stream that takes the raw file contents and produces the transformed source.
|
||||
* If tr is a string, it should be a module name or file path of a transform module
|
||||
*/
|
||||
transform<T extends { basedir?: string }>(tr: string, opts?: T): BrowserifyObject;
|
||||
transform<T extends { basedir?: string }>(tr: (file: string, opts: T) => NodeJS.ReadWriteStream, opts?: T): BrowserifyObject;
|
||||
/**
|
||||
* Register a plugin with opts. Plugins can be a string module name or a function the same as transforms.
|
||||
* plugin(b, opts) is called with the Browserify instance b.
|
||||
*/
|
||||
plugin<T extends { basedir?: string }>(plugin: string, opts?: T): BrowserifyObject;
|
||||
plugin<T extends { basedir?: string }>(plugin: (b: BrowserifyObject, opts: T) => any, opts?: T): BrowserifyObject;
|
||||
/**
|
||||
* Reset the pipeline back to a normal state. This function is called automatically when bundle() is called multiple times.
|
||||
* This function triggers a 'reset' event.
|
||||
*/
|
||||
reset(opts?: Options): void;
|
||||
|
||||
/**
|
||||
* When a file is resolved for the bundle, the bundle emits a 'file' event with the full file path, the id string passed to require(), and the parent object used by browser-resolve.
|
||||
* You could use the file event to implement a file watcher to regenerate bundles when files change.
|
||||
*/
|
||||
on(event: 'file', listener: (file: string, id: string, parent: any) => any): BrowserifyObject;
|
||||
/**
|
||||
* When a package.json file is read, this event fires with the contents.
|
||||
* The package directory is available at pkg.__dirname.
|
||||
*/
|
||||
on(event: 'package', listener: (pkg: any) => any): BrowserifyObject;
|
||||
/**
|
||||
* When .bundle() is called, this event fires with the bundle output stream.
|
||||
*/
|
||||
on(event: 'bundle', listener: (bundle: NodeJS.ReadableStream) => any): BrowserifyObject;
|
||||
/**
|
||||
* When the .reset() method is called or implicitly called by another call to .bundle(), this event fires.
|
||||
*/
|
||||
on(event: 'reset', listener: () => any): BrowserifyObject;
|
||||
/**
|
||||
* When a transform is applied to a file, the 'transform' event fires on the bundle stream with the transform stream tr and the file that the transform is being applied to.
|
||||
*/
|
||||
on(event: 'transform', listener: (tr: NodeJS.ReadWriteStream, file: string) => any): BrowserifyObject;
|
||||
on(event: string, listener: Function): BrowserifyObject;
|
||||
|
||||
/**
|
||||
* Set to any until substack/labeled-stream-splicer is defined
|
||||
*/
|
||||
pipeline: any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module "browserify" {
|
||||
var browserify: Browserify;
|
||||
var browserify: Browserify.BrowserifyConstructor;
|
||||
export = browserify;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
/// <reference path="./buffer-compare.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import compare = require('buffer-compare');
|
||||
|
||||
let result: number;
|
||||
|
||||
result = compare(new Buffer(''), new Buffer(''));
|
||||
result = compare([], []);
|
||||
result = compare('', '');
|
||||
result = compare(new Buffer(''), []);
|
||||
result = compare([], '');
|
||||
result = compare('', new Buffer(''));
|
||||
|
||||
result = compare<Buffer>(new Buffer(''), new Buffer(''));
|
||||
result = compare<any[]>([], []);
|
||||
result = compare<string>('', '');
|
||||
result = compare<Buffer|any[]>(new Buffer(''), []);
|
||||
result = compare<any[]|string>([], '');
|
||||
result = compare<string|Buffer>('', new Buffer(''));
|
||||
|
||||
result = compare<Buffer, Buffer>(new Buffer(''), new Buffer(''));
|
||||
result = compare<any[], any[]>([], []);
|
||||
result = compare<string, string>('', '');
|
||||
result = compare<Buffer, any[]>(new Buffer(''), []);
|
||||
result = compare<any[], string>([], '');
|
||||
result = compare<string, Buffer>('', new Buffer(''));
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// Type definitions for buffer-compare
|
||||
// Project: https://github.com/soldair/node-buffer-compare
|
||||
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "buffer-compare" {
|
||||
interface List {
|
||||
[index: number]: any;
|
||||
length: number
|
||||
}
|
||||
|
||||
function compare(cmp: List, to: List): number;
|
||||
function compare<T>(cmp: T, to: T): number;
|
||||
function compare<C, T>(cmp: C, to: T): number;
|
||||
|
||||
export = compare;
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/// <reference path="bytebuffer.d.ts" />
|
||||
|
||||
import ByteBuffer = require("bytebuffer");
|
||||
|
||||
var bb = new ByteBuffer()
|
||||
.writeIString("Hello world!")
|
||||
.flip();
|
||||
console.log(bb.readIString()+" from bytebuffer.js");
|
||||
Vendored
+615
@@ -0,0 +1,615 @@
|
||||
// Type definitions for bytebuffer.js 5.0.0
|
||||
// Project: https://github.com/dcodeIO/bytebuffer.js
|
||||
// Definitions by: Denis Cappellin <http://github.com/cappellin>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// Definitions by: SINTEF-9012 <http://github.com/SINTEF-9012>
|
||||
|
||||
/// <reference path="../long/long.d.ts" />
|
||||
|
||||
declare class ByteBuffer
|
||||
{
|
||||
/**
|
||||
* Constructs a new ByteBuffer.
|
||||
*/
|
||||
constructor( capacity?: number, littleEndian?: boolean, noAssert?: boolean );
|
||||
|
||||
/**
|
||||
* Big endian constant that can be used instead of its boolean value. Evaluates to false.
|
||||
*/
|
||||
static BIG_ENDIAN: boolean;
|
||||
|
||||
/**
|
||||
* Default initial capacity of 16.
|
||||
*/
|
||||
static DEFAULT_CAPACITY: number;
|
||||
|
||||
/**
|
||||
* Default no assertions flag of false.
|
||||
*/
|
||||
static DEFAULT_NOASSERT: boolean;
|
||||
|
||||
/**
|
||||
* Little endian constant that can be used instead of its boolean value. Evaluates to true.
|
||||
*/
|
||||
static LITTLE_ENDIAN: boolean;
|
||||
|
||||
/**
|
||||
* Maximum number of bytes required to store a 32bit base 128 variable-length integer.
|
||||
*/
|
||||
static MAX_VARINT32_BYTES: number;
|
||||
|
||||
/**
|
||||
* Maximum number of bytes required to store a 64bit base 128 variable-length integer.
|
||||
*/
|
||||
static MAX_VARINT64_BYTES: number;
|
||||
|
||||
/**
|
||||
* Metrics representing number of bytes.Evaluates to 2.
|
||||
*/
|
||||
static METRICS_BYTES: number;
|
||||
|
||||
/**
|
||||
* Metrics representing number of UTF8 characters.Evaluates to 1.
|
||||
*/
|
||||
static METRICS_CHARS: number;
|
||||
|
||||
/**
|
||||
* ByteBuffer version.
|
||||
*/
|
||||
static VERSION: string;
|
||||
|
||||
/**
|
||||
* Backing buffer.
|
||||
*/
|
||||
buffer: ArrayBuffer;
|
||||
|
||||
/**
|
||||
* Absolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
|
||||
*/
|
||||
limit: number;
|
||||
|
||||
/**
|
||||
* Whether to use little endian byte order, defaults to false for big endian.
|
||||
*/
|
||||
littleEndian: boolean;
|
||||
|
||||
/**
|
||||
* Marked offset.
|
||||
*/
|
||||
markedOffset: number;
|
||||
|
||||
/**
|
||||
* Whether to skip assertions of offsets and values, defaults to false.
|
||||
*/
|
||||
noAssert: boolean;
|
||||
|
||||
/**
|
||||
* Absolute read/write offset.
|
||||
*/
|
||||
offset: number;
|
||||
|
||||
/**
|
||||
* Data view to manipulate the backing buffer. Becomes null if the backing buffer has a capacity of 0.
|
||||
*/
|
||||
view: DataView;
|
||||
|
||||
/**
|
||||
* Allocates a new ByteBuffer backed by a buffer of the specified capacity.
|
||||
*/
|
||||
static allocate( capacity?: number, littleEndian?: number, noAssert?: boolean ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Decodes a base64 encoded string to binary like window.atob does.
|
||||
*/
|
||||
static atob( b64: string ): string;
|
||||
|
||||
/**
|
||||
* Encodes a binary string to base64 like window.btoa does.
|
||||
*/
|
||||
static btoa( str: string ): string;
|
||||
|
||||
/**
|
||||
* Calculates the number of UTF8 bytes of a string.
|
||||
*/
|
||||
static calculateUTF8Byte( str: string ): number;
|
||||
|
||||
/**
|
||||
* Calculates the number of UTF8 characters of a string.JavaScript itself uses UTF- 16, so that a string's length property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF.
|
||||
*/
|
||||
static calculateUTF8Char( str: string ): number;
|
||||
|
||||
/**
|
||||
* Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer.
|
||||
*/
|
||||
static calculateVariant32( value: number ): number;
|
||||
|
||||
/**
|
||||
* Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer.
|
||||
*/
|
||||
static calculateVariant64( value: number | Long ): number;
|
||||
|
||||
/**
|
||||
* Concatenates multiple ByteBuffers into one.
|
||||
*/
|
||||
static concat( buffers: Array<ByteBuffer | ArrayBuffer | Uint8Array | string>, encoding?: string | boolean, litteEndian?: boolean, noAssert?: boolean ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Decodes a base64 encoded string to a ByteBuffer.
|
||||
*/
|
||||
static fromBase64( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteBuffer.
|
||||
*/
|
||||
static fromBinary( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Decodes a hex encoded string with marked offsets to a ByteBuffer.
|
||||
*/
|
||||
static fromDebug( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Decodes a hex encoded string to a ByteBuffer.
|
||||
*/
|
||||
static fromHex( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Decodes an UTF8 encoded string to a ByteBuffer.
|
||||
*/
|
||||
static fromUTF8( str: string, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Gets the backing buffer type.
|
||||
*/
|
||||
static isByteBuffer( bb: any ): boolean;
|
||||
|
||||
/**
|
||||
* Wraps a buffer or a string. Sets the allocated ByteBuffer's ByteBuffer#offset to 0 and its ByteBuffer#limit to the length of the wrapped data.
|
||||
* @param buffer Anything that can be wrapped
|
||||
* @param encoding String encoding if buffer is a string ("base64", "hex", "binary", defaults to "utf8")
|
||||
* @param littleEndian Whether to use little or big endian byte order. Defaults to ByteBuffer.DEFAULT_ENDIAN.
|
||||
* @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteBuffer.DEFAULT_NOASSERT.
|
||||
*/
|
||||
static wrap( buffer: ByteBuffer | ArrayBuffer | Uint8Array | string, enc?: string | boolean, littleEndian?: boolean, noAssert?: boolean ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Decodes a zigzag encoded signed 32bit integer.
|
||||
*/
|
||||
static zigZagDecode32( n: number ): number;
|
||||
|
||||
/**
|
||||
* Decodes a zigzag encoded signed 64bit integer.
|
||||
*/
|
||||
static zigZagDecode64( n: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding.
|
||||
*/
|
||||
static zigZagEncode32( n: number ): number;
|
||||
|
||||
/**
|
||||
* Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding.
|
||||
*/
|
||||
static zigZagEncode64( n: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Switches (to) big endian byte order.
|
||||
*/
|
||||
BE( bigEndian?: boolean ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Switches (to) little endian byte order.
|
||||
*/
|
||||
LE( bigEndian?: boolean ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Appends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended data's length.
|
||||
*/
|
||||
append( source: ByteBuffer | ArrayBuffer | Uint8Array | string, encoding?: string | number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Appends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents behind the specified offset up to the length of this ByteBuffer's data.
|
||||
*/
|
||||
appendTo( target: ByteBuffer, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Enables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to disable them if your code already makes sure that everything is valid.
|
||||
*/
|
||||
assert( assert: boolean ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Gets the capacity of this ByteBuffer's backing buffer.
|
||||
*/
|
||||
capacity(): number;
|
||||
|
||||
/**
|
||||
* Clears this ByteBuffer's offsets by setting ByteBuffer#offset to 0 and
|
||||
* ByteBuffer#limit to the backing buffer's capacity. Discards ByteBuffer#markedOffset.
|
||||
*/
|
||||
clear(): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Creates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for ByteBuffer#offset, ByteBuffer#markedOffset and ByteBuffer#limit.
|
||||
*/
|
||||
clone( copy?: boolean ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Compacts this ByteBuffer to be backed by a ByteBuffer#buffer of its contents' length. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. Will set offset = 0 and limit = capacity and adapt ByteBuffer#markedOffset to the same relative position if set.
|
||||
*/
|
||||
compact( begin?: number, end?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Creates a copy of this ByteBuffer's contents. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit.
|
||||
*/
|
||||
copy( begin?: number, end?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Copies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit.
|
||||
*/
|
||||
copyTo( target: ByteBuffer, targetOffset?: number, sourceOffset?: number, sourceLimit?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Makes sure that this ByteBuffer is backed by a ByteBuffer#buffer of at least the specified capacity. If the current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity, the required capacity will be used instead.
|
||||
*/
|
||||
ensureCapacity( capacity: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Overwrites this ByteBuffer's contents with the specified value. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit.
|
||||
*/
|
||||
fill( value: number | string, begin?: number, end?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Makes this ByteBuffer ready for a new sequence of write or relative read operations. Sets limit = offset and offset = 0. Make sure always to flip a ByteBuffer when all relative read or write operations are complete.
|
||||
*/
|
||||
flip(): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Marks an offset on this ByteBuffer to be used later.
|
||||
*/
|
||||
mark( offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Sets the byte order.
|
||||
*/
|
||||
order( littleEndian: boolean ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Prepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the prepended data's length. If there is not enough space available before the specified offset, the backing buffer will be resized and its contents moved accordingly.
|
||||
*/
|
||||
prepend( source: ByteBuffer | string | ArrayBuffer, encoding?: string | number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Prepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the prepended data's length. If there is not enough space available before the specified offset, the backing buffer will be resized and its contents moved accordingly.
|
||||
*/
|
||||
prependTo( target: ByteBuffer, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Prints debug information about this ByteBuffer's contents.
|
||||
*/
|
||||
printDebug( out?: ( text: string ) => void ): void;
|
||||
|
||||
/**
|
||||
* Reads an 8bit signed integer. This is an alias of ByteBuffer#readInt8.
|
||||
*/
|
||||
readByte( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a NULL-terminated UTF8 encoded string. For this to work the string read must not contain any NULL characters itself.
|
||||
*/
|
||||
readCString( offset?: number ): string;
|
||||
|
||||
/**
|
||||
* Reads a 64bit float. This is an alias of ByteBuffer#readFloat64.
|
||||
*/
|
||||
readDouble( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a 32bit float. This is an alias of ByteBuffer#readFloat32.
|
||||
*/
|
||||
readFloat( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a 32bit float.
|
||||
*/
|
||||
readFloat32( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a 64bit float.
|
||||
*/
|
||||
readFloat64( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a length as uint32 prefixed UTF8 encoded string.
|
||||
*/
|
||||
readIString( offset?: number ): string;
|
||||
|
||||
/**
|
||||
* Reads a 32bit signed integer.This is an alias of ByteBuffer#readInt32.
|
||||
*/
|
||||
readInt( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a 16bit signed integer.
|
||||
*/
|
||||
readInt16( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a 32bit signed integer.
|
||||
*/
|
||||
readInt32( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a 64bit signed integer.
|
||||
*/
|
||||
readInt64( offset?: number ): Long;
|
||||
|
||||
/**
|
||||
* Reads an 8bit signed integer.
|
||||
*/
|
||||
readInt8( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a 64bit signed integer. This is an alias of ByteBuffer#readInt64.
|
||||
*/
|
||||
readLong( offset?: number ): Long;
|
||||
|
||||
/**
|
||||
* Reads a 16bit signed integer. This is an alias of ByteBuffer#readInt16.
|
||||
*/
|
||||
readShort( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads an UTF8 encoded string. This is an alias of ByteBuffer#readUTF8String.
|
||||
*/
|
||||
readString( length: number, metrics?: number, offset?: number ): string;
|
||||
|
||||
/**
|
||||
* Reads an UTF8 encoded string.
|
||||
*/
|
||||
readUTF8String( chars: number, offset?: number ): string;
|
||||
|
||||
/**
|
||||
* Reads a 16bit unsigned integer.
|
||||
*/
|
||||
readUint16( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a 32bit unsigned integer.
|
||||
*/
|
||||
readUint32( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a 64bit unsigned integer.
|
||||
*/
|
||||
readUint64( offset?: number ): Long;
|
||||
/**
|
||||
* Reads an 8bit unsigned integer.
|
||||
*/
|
||||
readUint8( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a length as varint32 prefixed UTF8 encoded string.
|
||||
*/
|
||||
readVString( offset?: number ): string;
|
||||
|
||||
/**
|
||||
* Reads a 32bit base 128 variable-length integer.
|
||||
*/
|
||||
readVarint32( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a zig-zag encoded 32bit base 128 variable-length integer.
|
||||
*/
|
||||
readVarint32ZiZag( offset?: number ): number;
|
||||
|
||||
/**
|
||||
* Reads a 64bit base 128 variable-length integer. Requires Long.js.
|
||||
*/
|
||||
readVarint64( offset?: number ): Long;
|
||||
|
||||
/**
|
||||
* Reads a zig-zag encoded 64bit base 128 variable-length integer. Requires Long.js.
|
||||
*/
|
||||
readVarint64ZigZag( offset?: number ): Long;
|
||||
|
||||
/**
|
||||
* Gets the number of remaining readable bytes. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit, so this returns limit - offset.
|
||||
*/
|
||||
remaining(): number;
|
||||
|
||||
/**
|
||||
* Resets this ByteBuffer's ByteBuffer#offset. If an offset has been marked through ByteBuffer#mark before, offset will be set to ByteBuffer#markedOffset, which will then be discarded. If no offset has been marked, sets offset = 0.
|
||||
*/
|
||||
reset(): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Resizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that large or larger.
|
||||
*/
|
||||
resize( capacity: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Reverses this ByteBuffer's contents
|
||||
*/
|
||||
reverse( begin?: number, end?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Skips the next length bytes. This will just advance
|
||||
*/
|
||||
skip( length: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Slices this ByteBuffer by creating a cloned instance with offset = begin and limit = end.
|
||||
*/
|
||||
slice( begin?: number, end?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. Will transparently ByteBuffer#flip this ByteBuffer if offset > limit but the actual offsets remain untouched. This is an alias of ByteBuffer#toBuffer.
|
||||
*/
|
||||
toArrayBuffer( forceCopy?: boolean ): ArrayBuffer;
|
||||
|
||||
/**
|
||||
* Encodes this ByteBuffer's contents to a base64 encoded string.
|
||||
*/
|
||||
toBase64( begin?: number, end?: number ): string;
|
||||
|
||||
/**
|
||||
* Encodes this ByteBuffer to a binary encoded string, that is using only characters 0x00-0xFF as bytes.
|
||||
*/
|
||||
toBinary( begin?: number, end?: number ): string;
|
||||
|
||||
/**
|
||||
* Returns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. Will transparently ByteBuffer#flip this ByteBuffer if offset > limit but the actual offsets remain untouched.
|
||||
*/
|
||||
toBuffer( forceCopy?: boolean ): ArrayBuffer;
|
||||
|
||||
/**
|
||||
*Encodes this ByteBuffer to a hex encoded string with marked offsets. Offset symbols are:
|
||||
* < : offset,
|
||||
* ' : markedOffset,
|
||||
* > : limit,
|
||||
* | : offset and limit,
|
||||
* [ : offset and markedOffset,
|
||||
* ] : markedOffset and limit,
|
||||
* ! : offset, markedOffset and limit
|
||||
*/
|
||||
toDebug( columns?: boolean ): string | Array<string>
|
||||
|
||||
/**
|
||||
* Encodes this ByteBuffer's contents to a hex encoded string.
|
||||
*/
|
||||
toHex( begin?: number, end?: number ): string;
|
||||
|
||||
/**
|
||||
* Converts the ByteBuffer's contents to a string.
|
||||
*/
|
||||
toString( encoding?: string ): string;
|
||||
|
||||
/**
|
||||
* Encodes this ByteBuffer's contents between ByteBuffer#offset and ByteBuffer#limit to an UTF8 encoded string.
|
||||
*/
|
||||
toUTF8(): string;
|
||||
|
||||
/**
|
||||
* Writes an 8bit signed integer. This is an alias of ByteBuffer#writeInt8.
|
||||
*/
|
||||
writeByte( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a NULL-terminated UTF8 encoded string. For this to work the specified string must not contain any NULL characters itself.
|
||||
*/
|
||||
writeCString( str: string, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a 64bit float. This is an alias of ByteBuffer#writeFloat64.
|
||||
*/
|
||||
writeDouble( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a 32bit float. This is an alias of ByteBuffer#writeFloat32.
|
||||
*/
|
||||
writeFloat( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a 32bit float.
|
||||
*/
|
||||
writeFloat32( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a 64bit float.
|
||||
*/
|
||||
writeFloat64( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a length as uint32 prefixed UTF8 encoded string.
|
||||
*/
|
||||
writeIString( str: string, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a 32bit signed integer. This is an alias of ByteBuffer#writeInt32.
|
||||
*/
|
||||
writeInt( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a 16bit signed integer.
|
||||
*/
|
||||
writeInt16( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a 32bit signed integer.
|
||||
*/
|
||||
writeInt32( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a 64bit signed integer.
|
||||
*/
|
||||
writeInt64( value: number | Long, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes an 8bit signed integer.
|
||||
*/
|
||||
writeInt8( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a 16bit signed integer. This is an alias of ByteBuffer#writeInt16.
|
||||
*/
|
||||
writeShort( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes an UTF8 encoded string.This is an alias of ByteBuffer#writeUTF8String.
|
||||
*/
|
||||
WriteString( str: string, offset?: number ): ByteBuffer | number;
|
||||
|
||||
/**
|
||||
* Writes an UTF8 encoded string.
|
||||
*/
|
||||
writeUTF8String( str: string, offset?: number ): ByteBuffer | number;
|
||||
|
||||
/**
|
||||
* Writes a 16bit unsigned integer.
|
||||
*/
|
||||
writeUint16( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a 32bit unsigned integer.
|
||||
*/
|
||||
writeUint32( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a 64bit unsigned integer.
|
||||
*/
|
||||
writeUint64( value: number | Long, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes an 8bit unsigned integer.
|
||||
*/
|
||||
writeUint8( value: number, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a length as varint32 prefixed UTF8 encoded string.
|
||||
*/
|
||||
writeVString( str: string, offset?: number ): ByteBuffer | number;
|
||||
|
||||
/**
|
||||
* Writes a 32bit base 128 variable-length integer.
|
||||
*/
|
||||
writeVarint32( value: number, offset?: number ): ByteBuffer | number;
|
||||
|
||||
/**
|
||||
* Writes a zig-zag encoded 32bit base 128 variable-length integer.
|
||||
*/
|
||||
writeVarint32ZigZag( value: number, offset?: number ): ByteBuffer | number;
|
||||
|
||||
/**
|
||||
* Writes a 64bit base 128 variable-length integer.
|
||||
*/
|
||||
writeVarint64( value: number | Long, offset?: number ): ByteBuffer;
|
||||
|
||||
/**
|
||||
* Writes a zig-zag encoded 64bit base 128 variable-length integer.
|
||||
*/
|
||||
writeVarint64ZigZag( value: number | Long, offset?: number ): ByteBuffer | number;
|
||||
}
|
||||
|
||||
declare module 'bytebuffer' {
|
||||
export = ByteBuffer;
|
||||
}
|
||||
+30
-1
@@ -325,7 +325,7 @@ var myDoughnutChart = new Chart(ctx).Doughnut(pieData, {
|
||||
animateRotate: true,
|
||||
animateScale: false,
|
||||
legendTemplate: "<ul class=\"<%=name.toLowerCase()%>-legend\"><% for (var i=0; i<segments.length; i++){%><li><span style=\"background-color:<%=segments[i].fillColor%>\"></span><%if(segments[i].label){%><%=segments[i].label%><%}%></li><%}%></ul>"
|
||||
});
|
||||
});
|
||||
|
||||
var myDoughnutChartLegend: string = myDoughnutChart.generateLegend();
|
||||
var myDoughnutChartImage: string = myDoughnutChart.toBase64Image();
|
||||
@@ -341,3 +341,32 @@ myDoughnutChart.resize();
|
||||
myDoughnutChart.update();
|
||||
myDoughnutChart.stop();
|
||||
myDoughnutChart.destroy();
|
||||
|
||||
// Test using charts with overrides of a subset of global options
|
||||
var partialOpts: ChartSettings = {
|
||||
showTooltips: true,
|
||||
tooltipEvents: ["mousemove", "touchstart", "touchmove"],
|
||||
tooltipFillColor: "rgba(0,0,0,0.8)",
|
||||
tooltipFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
|
||||
tooltipFontSize: 14,
|
||||
tooltipFontStyle: "normal",
|
||||
tooltipFontColor: "#fff",
|
||||
tooltipTitleFontFamily: "'Helvetica Neue', 'Helvetica', 'Arial', sans-serif",
|
||||
tooltipTitleFontSize: 14,
|
||||
tooltipTitleFontStyle: "bold",
|
||||
tooltipTitleFontColor: "#fff",
|
||||
tooltipYPadding: 6,
|
||||
tooltipXPadding: 6,
|
||||
tooltipCaretSize: 8,
|
||||
tooltipCornerRadius: 6,
|
||||
tooltipXOffset: 10,
|
||||
tooltipTemplate: "<%if (label){%><%=label%>: <%}%><%= value %>"
|
||||
};
|
||||
|
||||
var my2ndLineChart = new Chart(ctx).Line(lineData, partialOpts);
|
||||
var my2ndBarChart = new Chart(ctx).Bar(barData, partialOpts);
|
||||
var my2ndRadarChart = new Chart(ctx).Radar(radarData, partialOpts);
|
||||
var my2ndPolarAreaChart = new Chart(ctx).PolarArea(polarAreaData, partialOpts);
|
||||
var my2ndPieChart = new Chart(ctx).Pie(pieData, partialOpts);
|
||||
var my2ndDoughnutChart = new Chart(ctx).Doughnut(pieData, partialOpts);
|
||||
|
||||
|
||||
Vendored
+44
-44
@@ -33,49 +33,49 @@ interface CircularChartData {
|
||||
}
|
||||
|
||||
interface ChartSettings {
|
||||
animation: boolean;
|
||||
animationSteps: number;
|
||||
animationEasing: string;
|
||||
showScale: boolean;
|
||||
scaleOverride: boolean;
|
||||
scaleSteps: number;
|
||||
scaleStepWidth: number;
|
||||
scaleStartValue: number;
|
||||
scaleLineColor: string;
|
||||
scaleLineWidth: number;
|
||||
scaleShowLabels: boolean;
|
||||
scaleLabel: string;
|
||||
scaleIntegersOnly: boolean;
|
||||
scaleBeginAtZero: boolean;
|
||||
scaleFontFamily: string;
|
||||
scaleFontSize: number;
|
||||
scaleFontStyle: string;
|
||||
scaleFontColor: string;
|
||||
responsive: boolean;
|
||||
maintainAspectRatio: boolean;
|
||||
showTooltips: boolean;
|
||||
tooltipEvents: string[];
|
||||
tooltipFillColor: string;
|
||||
tooltipFontFamily: string;
|
||||
tooltipFontSize: number;
|
||||
tooltipFontStyle: string;
|
||||
tooltipFontColor: string;
|
||||
tooltipTitleFontFamily: string;
|
||||
tooltipTitleFontSize: number;
|
||||
tooltipTitleFontStyle: string;
|
||||
tooltipTitleFontColor: string;
|
||||
tooltipYPadding: number;
|
||||
tooltipXPadding: number;
|
||||
tooltipCaretSize: number;
|
||||
tooltipCornerRadius: number;
|
||||
tooltipXOffset: number;
|
||||
tooltipTemplate: string;
|
||||
multiTooltipTemplate: string;
|
||||
onAnimationProgress: () => any;
|
||||
onAnimationComplete: () => any;
|
||||
animation?: boolean;
|
||||
animationSteps?: number;
|
||||
animationEasing?: string;
|
||||
showScale?: boolean;
|
||||
scaleOverride?: boolean;
|
||||
scaleSteps?: number;
|
||||
scaleStepWidth?: number;
|
||||
scaleStartValue?: number;
|
||||
scaleLineColor?: string;
|
||||
scaleLineWidth?: number;
|
||||
scaleShowLabels?: boolean;
|
||||
scaleLabel?: string;
|
||||
scaleIntegersOnly?: boolean;
|
||||
scaleBeginAtZero?: boolean;
|
||||
scaleFontFamily?: string;
|
||||
scaleFontSize?: number;
|
||||
scaleFontStyle?: string;
|
||||
scaleFontColor?: string;
|
||||
responsive?: boolean;
|
||||
maintainAspectRatio?: boolean;
|
||||
showTooltips?: boolean;
|
||||
tooltipEvents?: string[];
|
||||
tooltipFillColor?: string;
|
||||
tooltipFontFamily?: string;
|
||||
tooltipFontSize?: number;
|
||||
tooltipFontStyle?: string;
|
||||
tooltipFontColor?: string;
|
||||
tooltipTitleFontFamily?: string;
|
||||
tooltipTitleFontSize?: number;
|
||||
tooltipTitleFontStyle?: string;
|
||||
tooltipTitleFontColor?: string;
|
||||
tooltipYPadding?: number;
|
||||
tooltipXPadding?: number;
|
||||
tooltipCaretSize?: number;
|
||||
tooltipCornerRadius?: number;
|
||||
tooltipXOffset?: number;
|
||||
tooltipTemplate?: string;
|
||||
multiTooltipTemplate?: string;
|
||||
onAnimationProgress?: () => any;
|
||||
onAnimationComplete?: () => any;
|
||||
}
|
||||
|
||||
interface ChartOptions {
|
||||
interface ChartOptions extends ChartSettings {
|
||||
scaleShowGridLines?: boolean;
|
||||
scaleGridLineColor?: string;
|
||||
scaleGridLineWidth?: number;
|
||||
@@ -138,7 +138,7 @@ interface BarChartOptions extends ChartOptions {
|
||||
barDatasetSpacing?: number;
|
||||
}
|
||||
|
||||
interface RadarChartOptions {
|
||||
interface RadarChartOptions extends ChartSettings {
|
||||
scaleShowLine?: boolean;
|
||||
angleShowLineOut?: boolean;
|
||||
scaleShowLabels?: boolean;
|
||||
@@ -159,7 +159,7 @@ interface RadarChartOptions {
|
||||
legendTemplate?: string;
|
||||
}
|
||||
|
||||
interface PolarAreaChartOptions {
|
||||
interface PolarAreaChartOptions extends ChartSettings {
|
||||
scaleShowLabelBackdrop?: boolean;
|
||||
scaleBackdropColor?: string;
|
||||
scaleBeginAtZero?: boolean;
|
||||
@@ -176,7 +176,7 @@ interface PolarAreaChartOptions {
|
||||
legendTemplate?: string;
|
||||
}
|
||||
|
||||
interface PieChartOptions {
|
||||
interface PieChartOptions extends ChartSettings {
|
||||
segmentShowStroke?: boolean;
|
||||
segmentStrokeColor?: string;
|
||||
segmentStrokeWidth?: number;
|
||||
|
||||
Vendored
+9
-1
@@ -1139,4 +1139,12 @@ declare module CKEDITOR {
|
||||
function isTabEnabled(editor: editor, dialogName: string, tabName: string): boolean;
|
||||
function okButton(): void;
|
||||
}
|
||||
}
|
||||
|
||||
module lang {
|
||||
var languages: any;
|
||||
var rtl: any;
|
||||
|
||||
function load(languageCode: string, defaultLanguage: string, callback: Function): void;
|
||||
function detect(defaultLanguage: string, probeLanguage: string): string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
/// <reference path="compose-function.d.ts" />
|
||||
|
||||
const numberToNumber = (a: number): number => a + 2;
|
||||
const numberToString = (a: number): string => "foo";
|
||||
const stringToNumber = (a: string): number => 5;
|
||||
|
||||
import composeFunction = require("compose-function");
|
||||
const t1: number = composeFunction(numberToNumber, numberToNumber)(5);
|
||||
const t2: string = composeFunction(numberToString, numberToNumber)(5);
|
||||
const t3: string = composeFunction(numberToString, stringToNumber)("f");
|
||||
const t4: (a: string) => number = composeFunction(
|
||||
(f: (a: string) => number) => ((p: string) => 5),
|
||||
(f: (a: number) => string) => ((p: string) => 4)
|
||||
)(numberToString);
|
||||
|
||||
|
||||
const t5: number = composeFunction(stringToNumber, numberToString, numberToNumber)(5);
|
||||
const t6: string = composeFunction(numberToString, stringToNumber, numberToString, numberToNumber)(5);
|
||||
|
||||
const t7: string = composeFunction<string>(
|
||||
numberToString, numberToNumber, stringToNumber, numberToString, stringToNumber)("fo");
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
// Type definitions for compose-function
|
||||
// Project: https://github.com/stoeffel/compose-function
|
||||
// Definitions by: Denis Sokolov <https://github.com/denis-sokolov>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "compose-function" {
|
||||
// Hardcoded signatures for 2-4 parameters
|
||||
function f<A, B, C>(
|
||||
f1: (b: B) => C,
|
||||
f2: (a: A) => B
|
||||
): (a: A) => C
|
||||
function f<A, B, C, D>(
|
||||
f1: (b: C) => D,
|
||||
f2: (a: B) => C,
|
||||
f3: (a: A) => B
|
||||
): (a: A) => D
|
||||
function f<A, B, C, D, E>(
|
||||
f1: (b: D) => E,
|
||||
f2: (a: C) => D,
|
||||
f3: (a: B) => C,
|
||||
f4: (a: A) => B
|
||||
): (a: A) => E
|
||||
|
||||
// Minimal typing for more than 4 parameters
|
||||
function f<Result>(
|
||||
f1: (a: any) => Result,
|
||||
...functions: Function[]
|
||||
): (a: any) => Result
|
||||
|
||||
export = f;
|
||||
}
|
||||
Vendored
+4
-1
@@ -26,6 +26,9 @@ interface Device {
|
||||
version: string;
|
||||
/** Get the device's manufacturer. */
|
||||
manufacturer: string;
|
||||
}
|
||||
/** Whether the device is running on a simulator. */
|
||||
isVirtual: boolean;
|
||||
/** Get the device hardware serial number. */
|
||||
serial: string;}
|
||||
|
||||
declare var device: Device;
|
||||
Vendored
+2
-2
@@ -38,7 +38,7 @@ declare class Dexie {
|
||||
|
||||
static deepClone(obj: Object): Object;
|
||||
|
||||
version(versionNumber: number): Dexie.Version
|
||||
version(versionNumber: number): Dexie.Version;
|
||||
|
||||
on: {
|
||||
(eventName: string, subscriber: () => any): void;
|
||||
@@ -48,7 +48,7 @@ declare class Dexie {
|
||||
populate: Dexie.DexieEvent;
|
||||
blocked: Dexie.DexieEvent;
|
||||
versionchange: Dexie.DexieVersionChangeEvent;
|
||||
}
|
||||
};
|
||||
|
||||
open(): Dexie.Promise<void>;
|
||||
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path="email-validator.d.ts" />
|
||||
|
||||
import emailValidator = require('email-validator');
|
||||
import { validate } from 'email-validator';
|
||||
|
||||
var result: boolean;
|
||||
|
||||
// Trivial code requires trivial tests
|
||||
result = validate('some email');
|
||||
result = validate(null);
|
||||
|
||||
result = emailValidator.validate('some email');
|
||||
result = emailValidator.validate(null);
|
||||
Vendored
+8
@@ -0,0 +1,8 @@
|
||||
// Type definitions for email-validator 1.0.3
|
||||
// Project: https://github.com/Sembiance/email-validator
|
||||
// Definitions by: Paul Lessing <https://github.com/paullessing>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare module "email-validator" {
|
||||
export function validate(email: String): boolean;
|
||||
}
|
||||
Vendored
+4
-2
@@ -3,12 +3,14 @@
|
||||
// Definitions by: Qubo <https://github.com/tkQubo>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "envify" {
|
||||
var envify: Function;
|
||||
var envify: (file: string, environment: { [name: string]: any }) => NodeJS.ReadWriteStream;
|
||||
export = envify;
|
||||
}
|
||||
|
||||
declare module "envify/custom" {
|
||||
function envify(environment: { [name: string]: any }): Function;
|
||||
function envify(environment: { [name: string]: any }): (file: string, environment: { [name: string]: any }) => NodeJS.ReadWriteStream;
|
||||
export = envify;
|
||||
}
|
||||
|
||||
+49
-1
@@ -1,6 +1,12 @@
|
||||
/// <reference path="flux.d.ts" />
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
|
||||
import flux = require('flux')
|
||||
import FluxUtils = require('flux/utils')
|
||||
import React = require('react')
|
||||
|
||||
var Component = React.Component
|
||||
var Container = FluxUtils.Container
|
||||
|
||||
//
|
||||
// Basic dispatcher usage
|
||||
@@ -78,4 +84,46 @@ class CustomDispatcher extends flux.Dispatcher<Action> {
|
||||
|
||||
var customDispatcher = new CustomDispatcher()
|
||||
|
||||
export = customDispatcher
|
||||
export = customDispatcher
|
||||
|
||||
|
||||
// Sample Reduce Store
|
||||
class CounterStore extends FluxUtils.ReduceStore<number> {
|
||||
getInitialState(): number {
|
||||
return 0;
|
||||
}
|
||||
|
||||
reduce(state: number, action: any): number {
|
||||
switch (action.type) {
|
||||
case 'increment':
|
||||
return state + 1;
|
||||
|
||||
case 'square':
|
||||
return state * state;
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const Store = new CounterStore(basicDispatcher);
|
||||
|
||||
// Sample Flux container with CounterStore
|
||||
class CounterContainer extends Component<any, any> {
|
||||
static getStores() {
|
||||
return [Store];
|
||||
}
|
||||
|
||||
static calculateState(prevState: any) {
|
||||
return {
|
||||
counter: Store.getState(),
|
||||
};
|
||||
}
|
||||
|
||||
render() {
|
||||
return this.state.counter;
|
||||
}
|
||||
}
|
||||
|
||||
const container = Container.create(CounterContainer);
|
||||
|
||||
Vendored
+127
-1
@@ -1,8 +1,10 @@
|
||||
// Type definitions for Flux
|
||||
// Project: http://facebook.github.io/flux/
|
||||
// Definitions by: Steve Baker <https://github.com/stkb/>
|
||||
// Definitions by: Steve Baker <https://github.com/stkb/>, Giedrius Grabauskas <https://github.com/QuatroDevOfficial/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../react/react-global.d.ts" />
|
||||
|
||||
declare module Flux {
|
||||
|
||||
/**
|
||||
@@ -65,3 +67,127 @@ declare module Flux {
|
||||
declare module "flux" {
|
||||
export = Flux;
|
||||
}
|
||||
|
||||
declare module FluxUtils {
|
||||
|
||||
export class Container {
|
||||
constructor();
|
||||
/**
|
||||
* Create is used to transform a react class into a container
|
||||
* that updates its state when relevant stores change.
|
||||
* The provided base class must have static methods getStores() and calculateState().
|
||||
*/
|
||||
static create(base: React.ComponentClass<any>, options?: any): React.ComponentClass<any>;
|
||||
}
|
||||
|
||||
/**
|
||||
* This class extends ReduceStore and defines the state as an immutable map.
|
||||
*/
|
||||
// TODO: Change <any> to <Immutable.Map<K, V>>
|
||||
export class MapStore<K extends string | number, V> extends ReduceStore<any> {
|
||||
/**
|
||||
* Access the value at the given key.
|
||||
* Throws an error if the key does not exist in the cache.
|
||||
*/
|
||||
at(key: K): V;
|
||||
|
||||
/**
|
||||
* Check if the cache has a particular key
|
||||
*/
|
||||
has(key: K): boolean;
|
||||
|
||||
/**
|
||||
* Get the value of a particular key.
|
||||
* Returns undefined if the key does not exist in the cache.
|
||||
*/
|
||||
get(key: K): V;
|
||||
|
||||
/**
|
||||
* Gets an array of keys and puts the values in a map if they exist,
|
||||
* it allows providing a previous result to update instead of generating a new map.
|
||||
* Providing a previous result allows the possibility of keeping the same reference if the keys did not change.
|
||||
*/
|
||||
// TODO: Update with Immutable interface.
|
||||
// getAll(keys: Immutable.IndexedIterable<K>, prev?: Immutable.Map<K, V>): Immutable.Map<K, V>;
|
||||
getAll(keys: any, prev?: any): any;
|
||||
}
|
||||
|
||||
export class ReduceStore<T> extends Store {
|
||||
/**
|
||||
* Getter that exposes the entire state of this store.
|
||||
* If your state is not immutable you should override this and not expose state directly.
|
||||
*/
|
||||
getState(): T;
|
||||
|
||||
/**
|
||||
* Constructs the initial state for this store.
|
||||
* This is called once during construction of the store.
|
||||
*/
|
||||
getInitialState(): T;
|
||||
|
||||
/**
|
||||
* Reduces the current state, and an action to the new state of this store.
|
||||
* All subclasses must implement this method.
|
||||
* This method should be pure and have no side-effects.
|
||||
*/
|
||||
reduce(state: T, action: any): T;
|
||||
|
||||
/**
|
||||
* Checks if two versions of state are the same.
|
||||
* You do not need to override this if your state is immutable.
|
||||
*/
|
||||
areEqual(one: T, two: T): boolean;
|
||||
|
||||
}
|
||||
|
||||
export class Store {
|
||||
|
||||
/**
|
||||
* Constructs and registers an instance of this store with the given dispatcher.
|
||||
*/
|
||||
constructor(dispatcher: Flux.Dispatcher<any>);
|
||||
|
||||
/**
|
||||
* Adds a listener to the store, when the store changes the given callback will be called.
|
||||
* A token is returned that can be used to remove the listener.
|
||||
* Calling the remove() function on the returned token will remove the listener.
|
||||
*/
|
||||
addListener(callback: Function): { remove: Function };
|
||||
|
||||
/**
|
||||
* Returns the dispatcher this store is registered with.
|
||||
*/
|
||||
getDispatcher(): Flux.Dispatcher<any>;
|
||||
|
||||
/**
|
||||
* Returns the dispatch token that the dispatcher recognizes this store by.
|
||||
* Can be used to waitFor() this store.
|
||||
*/
|
||||
getDispatchToken(): string;
|
||||
|
||||
/**
|
||||
* Ask if a store has changed during the current dispatch.
|
||||
* Can only be invoked while dispatching.
|
||||
* This can be used for constructing derived stores that depend on data from other stores.
|
||||
*/
|
||||
hasChanged(): boolean;
|
||||
|
||||
/**
|
||||
*Emit an event notifying all listeners that this store has changed.
|
||||
* This can only be invoked when dispatching.
|
||||
* Changes are de-duplicated and resolved at the end of this store's __onDispatch function.
|
||||
*/
|
||||
__emitChange(): void;
|
||||
|
||||
/**
|
||||
* Subclasses must override this method.
|
||||
* This is how the store receives actions from the dispatcher.
|
||||
* All state mutation logic must be done during this method.
|
||||
*/
|
||||
__onDispatch(payload: any): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'flux/utils' {
|
||||
export = FluxUtils;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ var openOpts: fs.OpenOptions;
|
||||
var watcher: fs.FSWatcher;
|
||||
var readStreeam: stream.Readable;
|
||||
var writeStream: stream.Writable;
|
||||
var outputStream: stream.Writable;
|
||||
|
||||
fs.copy(src, dest, errorCallback);
|
||||
fs.copy(src, dest, (src: string) => {
|
||||
@@ -150,7 +151,7 @@ strArr = fs.readdirSync(path);
|
||||
fs.close(fd, errorCallback);
|
||||
fs.closeSync(fd);
|
||||
fs.open(path, flags, modeStr, (err: Error, fd: number) => {
|
||||
|
||||
|
||||
});
|
||||
num = fs.openSync(path, flags, modeStr);
|
||||
fs.utimes(path, atime, mtime, errorCallback);
|
||||
@@ -217,6 +218,17 @@ fs.exists(path, (exists: boolean) => {
|
||||
});
|
||||
bool = fs.existsSync(path);
|
||||
|
||||
fs.ensureDir(path, errorCallback);
|
||||
fs.ensureDirSync(path);
|
||||
fs.ensureFile(path, errorCallback);
|
||||
fs.ensureFileSync(path);
|
||||
fs.ensureLink(path, errorCallback);
|
||||
fs.ensureLinkSync(path);
|
||||
fs.ensureSymlink(path, errorCallback);
|
||||
fs.ensureSymlinkSync(path);
|
||||
fs.emptyDir(path, errorCallback);
|
||||
fs.emptyDirSync(path);
|
||||
|
||||
readStreeam = fs.createReadStream(path);
|
||||
readStreeam = fs.createReadStream(path, {
|
||||
flags: str,
|
||||
@@ -231,3 +243,9 @@ writeStream = fs.createWriteStream(path, {
|
||||
encoding: str,
|
||||
string: str
|
||||
});
|
||||
outputStream = fs.createOutputStream(path);
|
||||
outputStream = fs.createOutputStream(path, {
|
||||
flags: str,
|
||||
encoding: str,
|
||||
string: str
|
||||
});
|
||||
|
||||
Vendored
+10
@@ -167,6 +167,15 @@ declare module "fs-extra" {
|
||||
export function exists(path: string, callback?: (exists: boolean) => void ): void;
|
||||
export function existsSync(path: string): boolean;
|
||||
export function ensureDir(path: string, cb: (err: Error) => void): void;
|
||||
export function ensureDirSync(path: string): void;
|
||||
export function ensureFile(path: string, cb: (err: Error) => void): void;
|
||||
export function ensureFileSync(path: string): void;
|
||||
export function ensureLink(path: string, cb: (err: Error) => void): void;
|
||||
export function ensureLinkSync(path: string): void;
|
||||
export function ensureSymlink(path: string, cb: (err: Error) => void): void;
|
||||
export function ensureSymlinkSync(path: string): void;
|
||||
export function emptyDir(path: string, callback?: (err: Error) => void): void;
|
||||
export function emptyDirSync(path: string): boolean;
|
||||
|
||||
export interface OpenOptions {
|
||||
encoding?: string;
|
||||
@@ -192,4 +201,5 @@ declare module "fs-extra" {
|
||||
}
|
||||
export function createReadStream(path: string, options?: ReadStreamOptions): ReadStream;
|
||||
export function createWriteStream(path: string, options?: WriteStreamOptions): WriteStream;
|
||||
export function createOutputStream(path: string, options?: WriteStreamOptions): WriteStream;
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -849,7 +849,7 @@ declare module google.maps {
|
||||
formatted_address: string;
|
||||
geometry: GeocoderGeometry;
|
||||
partial_match: boolean;
|
||||
postcode_localities: string[]
|
||||
postcode_localities: string[];
|
||||
types: string[];
|
||||
}
|
||||
|
||||
@@ -1822,7 +1822,7 @@ declare module google.maps {
|
||||
matched_substrings: PredictionSubstring[];
|
||||
place_id: string;
|
||||
terms: PredictionTerm[];
|
||||
types: string[]
|
||||
types: string[];
|
||||
}
|
||||
|
||||
export interface PredictionTerm {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="./gulp-babel.d.ts" />
|
||||
|
||||
import babel from 'gulp-babel';
|
||||
import babel = require('gulp-babel');
|
||||
|
||||
var x: NodeJS.ReadWriteStream = babel();
|
||||
var x: NodeJS.ReadWriteStream = babel({});
|
||||
|
||||
Vendored
+3
-1
@@ -6,7 +6,7 @@
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module 'gulp-babel' {
|
||||
export default function(options?: {
|
||||
function babel(options?: {
|
||||
filename?: string,
|
||||
filenameRelative?: string,
|
||||
presets?: string[],
|
||||
@@ -35,4 +35,6 @@ declare module 'gulp-babel' {
|
||||
env?: any,
|
||||
retainLines?: boolean
|
||||
}): NodeJS.ReadWriteStream;
|
||||
|
||||
export = babel;
|
||||
}
|
||||
|
||||
Vendored
+2
-2
@@ -170,6 +170,6 @@ declare module "gulp-uglify" {
|
||||
*/
|
||||
comments_before: string[];
|
||||
}
|
||||
|
||||
namespace GulpUglify {}
|
||||
export = GulpUglify;
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+30
-13
@@ -7,10 +7,6 @@
|
||||
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
|
||||
|
||||
|
||||
|
||||
declare module "hapi" {
|
||||
import http = require("http");
|
||||
@@ -21,6 +17,17 @@ declare module "hapi" {
|
||||
[key: string]: T;
|
||||
}
|
||||
|
||||
interface IThenable<R> {
|
||||
then<U>(onFulfilled?: (value: R) => U | IThenable<U>, onRejected?: (error: any) => U | IThenable<U>): IThenable<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U | IThenable<U>, onRejected?: (error: any) => void): IThenable<U>;
|
||||
}
|
||||
|
||||
interface IPromise<R> extends IThenable<R> {
|
||||
then<U>(onFulfilled?: (value: R) => U | IThenable<U>, onRejected?: (error: any) => U | IThenable<U>): IPromise<U>;
|
||||
then<U>(onFulfilled?: (value: R) => U | IThenable<U>, onRejected?: (error: any) => void): IPromise<U>;
|
||||
catch<U>(onRejected?: (error: any) => U | IThenable<U>): IPromise<U>;
|
||||
}
|
||||
|
||||
/** Boom Module for errors. https://github.com/hapijs/boom
|
||||
* boom provides a set of utilities for returning HTTP errors. Each utility returns a Boom error response object (instance of Error) which includes the following properties: */
|
||||
export interface IBoom extends Error {
|
||||
@@ -234,12 +241,12 @@ declare module "hapi" {
|
||||
When calling reply(), the framework waits until process.nextTick() to continue processing the request and transmit the response. This enables making changes to the returned response object before the response is sent. This means the framework will resume as soon as the handler method exits. To suspend this behavior, the returned response object supports the following methods: hold(), send() */
|
||||
export interface IReply {
|
||||
<T>(err: Error,
|
||||
result?: string|number|boolean|Buffer|stream.Stream | Promise<T> | T,
|
||||
result?: string|number|boolean|Buffer|stream.Stream | IPromise<T> | T,
|
||||
/** Note that when used to return both an error and credentials in the authentication methods, reply() must be called with three arguments function(err, null, data) where data is the additional authentication information. */
|
||||
credentialData?: any
|
||||
): IBoom;
|
||||
/** Note that if result is a Stream with a statusCode property, that status code will be used as the default response code. */
|
||||
<T>(result: string|number|boolean|Buffer|stream.Stream | Promise<T> | T): Response;
|
||||
<T>(result: string|number|boolean|Buffer|stream.Stream | IPromise<T> | T): Response;
|
||||
|
||||
/** Returns control back to the framework without setting a response. If called in the handler, the response defaults to an empty payload with status code 200.
|
||||
* The data argument is only used for passing back authentication data and is ignored elsewhere. */
|
||||
@@ -897,22 +904,32 @@ declare module "hapi" {
|
||||
|
||||
|
||||
export interface IServerInject {
|
||||
(options: {
|
||||
(options: string | {
|
||||
/** the request HTTP method (e.g. 'POST'). Defaults to 'GET'.*/
|
||||
method: string;
|
||||
/** the request URL. If the URI includes an authority (e.g. 'example.com:8080'), it is used to automatically set an HTTP 'Host' header, unless one was specified in headers.*/
|
||||
url: string;
|
||||
/** an object with optional request headers where each key is the header name and the value is the header content. Defaults to no additions to the default Shot headers.*/
|
||||
headers: IDictionary<string>;
|
||||
/**- an optional string or buffer containing the request payload (object must be manually converted to a string first). Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/
|
||||
payload: string|Buffer;
|
||||
/**an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/
|
||||
credentials: any;
|
||||
headers?: IDictionary<string>;
|
||||
/** n optional string, buffer or object containing the request payload. In case of an object it will be converted to a string for you. Defaults to no payload. Note that payload processing defaults to 'application/json' if no 'Content-Type' header provided.*/
|
||||
payload?: string|{}|Buffer;
|
||||
/** an optional credentials object containing authentication information. The credentials are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Defaults to no credentials.*/
|
||||
credentials?: any;
|
||||
/** an optional artifacts object containing authentication artifact information. The artifacts are used to bypass the default authentication strategies, and are validated directly as if they were received via an authentication scheme. Ignored if set without credentials. Defaults to no artifacts.*/
|
||||
artifacts?: any;
|
||||
/** sets the initial value of request.app*/
|
||||
app?: any;
|
||||
/** sets the initial value of request.plugins*/
|
||||
plugins?: any;
|
||||
/** allows access to routes with config.isInternal set to true. Defaults to false.*/
|
||||
allowInternals?: boolean;
|
||||
/** sets the remote address for the incoming connection.*/
|
||||
remoteAddress?: boolean;
|
||||
/**object with options used to simulate client request stream conditions for testing:
|
||||
error - if true, emits an 'error' event after payload transmission (if any). Defaults to false.
|
||||
close - if true, emits a 'close' event after payload transmission (if any). Defaults to false.
|
||||
end - if false, does not end the stream. Defaults to true.*/
|
||||
simulate: {
|
||||
simulate?: {
|
||||
error: boolean;
|
||||
close: boolean;
|
||||
end: boolean;
|
||||
|
||||
Vendored
+1
-1
@@ -1304,7 +1304,7 @@ interface HighchartsChartOptions3dFrame {
|
||||
* @default 'transparent'
|
||||
* @since 4.0
|
||||
*/
|
||||
color?: string | HighchartsGradient,
|
||||
color?: string | HighchartsGradient;
|
||||
/**
|
||||
* Thickness of the panel.
|
||||
* @default 1
|
||||
|
||||
@@ -9,11 +9,11 @@ intro.setOptions({
|
||||
intro: "Hello world!"
|
||||
},
|
||||
{
|
||||
element: document.querySelector('#step1'),
|
||||
element: document.querySelector('#step1') as HTMLElement,
|
||||
intro : "This is a tooltip."
|
||||
},
|
||||
{
|
||||
element : document.querySelectorAll('#step2')[0],
|
||||
element : document.querySelectorAll('#step2')[0] as HTMLElement,
|
||||
intro : "Ok, wasn't that fun?",
|
||||
position: 'right'
|
||||
},
|
||||
|
||||
Vendored
+1
-1
@@ -14,7 +14,7 @@ declare module IntroJs {
|
||||
interface Step {
|
||||
intro: string;
|
||||
element?: string|HTMLElement;
|
||||
position?: Positions;
|
||||
position?: string|Positions;
|
||||
}
|
||||
|
||||
interface Options {
|
||||
|
||||
+10
-4
@@ -84,13 +84,19 @@ class IonicTestController {
|
||||
|
||||
private testActionSheet(): void {
|
||||
var closeActionSheetFn: ()=>void = this.$ionicActionSheet.show({
|
||||
buttons: [],
|
||||
buttons: [{ text: 'A button' }],
|
||||
titleText: "titleText",
|
||||
cancelText: "cancelText",
|
||||
destructiveText: "destructiveText",
|
||||
cancel: ()=>{ console.log("cancel"); },
|
||||
buttonClicked: ()=>{ console.log("buttonClicked"); },
|
||||
destructiveButtonClicked: ()=>{ console.log("destructiveButtonClicked"); },
|
||||
buttonClicked: (index)=>{
|
||||
console.log("buttonClicked");
|
||||
return index === 0;
|
||||
},
|
||||
destructiveButtonClicked: ()=>{
|
||||
console.log("destructiveButtonClicked");
|
||||
return false;
|
||||
},
|
||||
cancelOnStateChange: true,
|
||||
cssClass: "cssClass"
|
||||
});
|
||||
@@ -249,7 +255,7 @@ class IonicTestController {
|
||||
okType: "okType",
|
||||
cancelText: "Cancel",
|
||||
cancelType: "cancelType"
|
||||
}).then(() => console.log("popover shown"))
|
||||
}).then((result) => console.log(result === true ? "confirmed": "cancelled"))
|
||||
this.$ionicPopup.confirm({
|
||||
title: "title",
|
||||
subTitle: "subTitle",
|
||||
|
||||
Vendored
+10
-4
@@ -102,14 +102,17 @@ declare module ionic {
|
||||
interface IonicActionSheetService {
|
||||
show(options: IonicActionSheetOptions): ()=>void;
|
||||
}
|
||||
interface IonicActionSheetButton {
|
||||
text: string;
|
||||
}
|
||||
interface IonicActionSheetOptions {
|
||||
buttons?: Array<any>;
|
||||
buttons?: Array<IonicActionSheetButton>;
|
||||
titleText?: string;
|
||||
cancelText?: string;
|
||||
destructiveText?: string;
|
||||
cancel?: ()=>any;
|
||||
buttonClicked?: (index: any)=>any;
|
||||
destructiveButtonClicked?: ()=>any;
|
||||
buttonClicked?: (index: number)=>boolean;
|
||||
destructiveButtonClicked?: ()=>boolean;
|
||||
cancelOnStateChange?: boolean;
|
||||
cssClass?: string;
|
||||
}
|
||||
@@ -246,10 +249,13 @@ declare module ionic {
|
||||
interface IonicPopupService {
|
||||
show(options: IonicPopupFullOptions): IonicPopupPromise;
|
||||
alert(options: IonicPopupAlertOptions): IonicPopupPromise;
|
||||
confirm(options: IonicPopupConfirmOptions): IonicPopupPromise;
|
||||
confirm(options: IonicPopupConfirmOptions): IonicPopupConfirmPromise;
|
||||
prompt(options: IonicPopupPromptOptions): IonicPopupPromise;
|
||||
}
|
||||
|
||||
interface IonicPopupConfirmPromise extends ng.IPromise<boolean> {
|
||||
close(value?: boolean): void;
|
||||
}
|
||||
interface IonicPopupPromise extends ng.IPromise<any> {
|
||||
close(value?: any): any;
|
||||
}
|
||||
|
||||
Vendored
+15
@@ -40,6 +40,16 @@ declare function fail(...err:any[]): void;
|
||||
*/
|
||||
declare function file(name:string, prereqs?:string[], action?:()=>void, opts?:jake.FileTaskOptions): jake.FileTask;
|
||||
|
||||
/**
|
||||
* Creates Jake FileTask from regex patterns
|
||||
* @name name/pattern of the Task
|
||||
* @param source calculated from the name pattern
|
||||
* @param prereqs Prerequisites to be run before this task
|
||||
* @param action The action to perform for this task
|
||||
* @param opts Perform this task asynchronously. If you flag a task with this option, you must call the global `complete` method inside the task's action, for execution to proceed to the next task.
|
||||
*/
|
||||
declare function rule(pattern: RegExp, source: string | { (name: string): string; }, prereqs?: string[], action?: () => void, opts?: jake.TaskOptions): void;
|
||||
|
||||
/**
|
||||
* Creates a namespace which allows logical grouping of tasks, and prevents name-collisions with task-names. Namespaces can be nested inside of other namespaces.
|
||||
* @param name The name of the namespace
|
||||
@@ -185,6 +195,11 @@ declare module jake{
|
||||
* @default false
|
||||
*/
|
||||
async?: boolean;
|
||||
|
||||
/**
|
||||
* number of parllel async tasks
|
||||
*/
|
||||
parallelLimit?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,8 +27,8 @@ describe('toBeArray', function () {
|
||||
});
|
||||
it('should pass for [1,"",{}]', function () {
|
||||
expect([
|
||||
1,
|
||||
"",
|
||||
1,
|
||||
"",
|
||||
{
|
||||
}
|
||||
]).toBeArray();
|
||||
@@ -115,13 +115,13 @@ describe('toBeOneOf', function () {
|
||||
describe('matches', function () {
|
||||
it('should find "a" in ["a", "b"]', function () {
|
||||
expect('a').toBeOneOf([
|
||||
'a',
|
||||
'a',
|
||||
'b'
|
||||
]);
|
||||
});
|
||||
it('should find "uxebu" in ["company", "uxebu"]', function () {
|
||||
expect('uxebu').toBeOneOf([
|
||||
'company',
|
||||
'company',
|
||||
'uxebu'
|
||||
]);
|
||||
});
|
||||
@@ -129,30 +129,30 @@ describe('toBeOneOf', function () {
|
||||
describe('non-matches', function () {
|
||||
it('should not find "" in [" ", "0"]', function () {
|
||||
expect('').not.toBeOneOf([
|
||||
' ',
|
||||
' ',
|
||||
'0'
|
||||
]);
|
||||
});
|
||||
it('should not find "a" in ["b", "c"]', function () {
|
||||
expect('a').not.toBeOneOf([
|
||||
'b',
|
||||
'b',
|
||||
'c'
|
||||
]);
|
||||
});
|
||||
});
|
||||
});
|
||||
describe('toBeCloseToOneOf', function () {
|
||||
function oneDigitOff(actual, expected) {
|
||||
function oneDigitOff(actual: any, expected: any) {
|
||||
var actualInt = parseInt(actual, 10);
|
||||
return actualInt - 1 <= expected && actualInt + 1 >= expected;
|
||||
}
|
||||
function tenPercentOff(actual, expected) {
|
||||
function tenPercentOff(actual: any, expected: any) {
|
||||
return expected * 0.9 <= actual && expected * 1.1 >= actual;
|
||||
}
|
||||
function oneDigitOrTenPercentOff(actual, expected) {
|
||||
function oneDigitOrTenPercentOff(actual: any, expected: any) {
|
||||
return oneDigitOff(actual, expected) || tenPercentOff(actual, expected);
|
||||
}
|
||||
function twoDecimalsOff(actual, expected) {
|
||||
function twoDecimalsOff(actual: any, expected: any) {
|
||||
var lower = ((expected * 100) - 2) / 100;
|
||||
var upper = ((expected * 100) + 2) / 100;
|
||||
return lower <= actual && upper >= actual;
|
||||
@@ -160,25 +160,25 @@ describe('toBeCloseToOneOf', function () {
|
||||
describe('matches', function () {
|
||||
it('should say 7 is close to one of [8, 9]', function () {
|
||||
expect(7).toBeCloseToOneOf([
|
||||
8,
|
||||
8,
|
||||
9
|
||||
], oneDigitOff);
|
||||
});
|
||||
it('should say 2 is 10% off of one of [2.2, 1.0]', function () {
|
||||
expect(2).toBeCloseToOneOf([
|
||||
2.2,
|
||||
2.2,
|
||||
1.0
|
||||
], tenPercentOff);
|
||||
});
|
||||
it('should say 7 is close to one of [8, 9]', function () {
|
||||
expect(7).toBeCloseToOneOf([
|
||||
8,
|
||||
8,
|
||||
9
|
||||
], oneDigitOrTenPercentOff);
|
||||
});
|
||||
it('should say 1.345 two decimals off of [1.325, 1.365]', function () {
|
||||
expect(1.345).toBeCloseToOneOf([
|
||||
1.325,
|
||||
1.325,
|
||||
1.365
|
||||
], twoDecimalsOff);
|
||||
});
|
||||
@@ -186,26 +186,26 @@ describe('toBeCloseToOneOf', function () {
|
||||
describe('non-matches', function () {
|
||||
it('should say 7 is NOT one off of [9, 10, 11]', function () {
|
||||
expect(7).not.toBeCloseToOneOf([
|
||||
9,
|
||||
10,
|
||||
9,
|
||||
10,
|
||||
11
|
||||
], oneDigitOff);
|
||||
});
|
||||
it('should say 1 is close to one of [8, 9]', function () {
|
||||
expect(1).not.toBeCloseToOneOf([
|
||||
8,
|
||||
8,
|
||||
9
|
||||
], oneDigitOrTenPercentOff);
|
||||
});
|
||||
it('should say 1.9 is NOT 10% off of one of [2.2, 1.0]', function () {
|
||||
expect(1.9).not.toBeCloseToOneOf([
|
||||
2.2,
|
||||
2.2,
|
||||
1.0
|
||||
], tenPercentOff);
|
||||
});
|
||||
it('should say 1.345 two decimals off of [1.325, 1.365]', function () {
|
||||
expect(1.304).not.toBeCloseToOneOf([
|
||||
1.325,
|
||||
1.325,
|
||||
1.365
|
||||
], twoDecimalsOff);
|
||||
});
|
||||
@@ -216,7 +216,7 @@ describe('toContainOnce', function () {
|
||||
describe('matches', function () {
|
||||
it('should work for arrays', function () {
|
||||
expect([
|
||||
1,
|
||||
1,
|
||||
2
|
||||
]).toContainOnce(1);
|
||||
});
|
||||
@@ -227,7 +227,7 @@ describe('toContainOnce', function () {
|
||||
describe('non-matches', function () {
|
||||
it('should work for arrays', function () {
|
||||
expect([
|
||||
1,
|
||||
1,
|
||||
2
|
||||
]).not.toContainOnce(3);
|
||||
});
|
||||
@@ -257,7 +257,7 @@ describe('toHaveLength', function () {
|
||||
describe('toHaveProperties', function () {
|
||||
describe('matches', function () {
|
||||
it('should work for `{x:0, y:undefined}`', function () {
|
||||
var obj = {
|
||||
var obj: any = {
|
||||
x: 0,
|
||||
y: undefined
|
||||
};
|
||||
@@ -268,7 +268,7 @@ describe('toHaveProperties', function () {
|
||||
describe('toHavePropertiesWithValues', function () {
|
||||
describe('matches', function () {
|
||||
it('should work with a reference object', function () {
|
||||
function C() {
|
||||
var C: any = function C() {
|
||||
this.x = 0;
|
||||
}
|
||||
C.prototype.y = 'arbitrary';
|
||||
@@ -283,7 +283,7 @@ describe('toHavePropertiesWithValues', function () {
|
||||
describe('toHaveOwnProperties', function () {
|
||||
describe('matches', function () {
|
||||
it('should work for `{x:0, y:undefined}`', function () {
|
||||
var obj = {
|
||||
var obj: any = {
|
||||
x: 0,
|
||||
y: undefined
|
||||
};
|
||||
@@ -322,14 +322,14 @@ describe('toHaveBeenCalledXTimes', function () {
|
||||
describe('toExactlyHaveProperties', function () {
|
||||
describe('matches', function () {
|
||||
it('should work for `{x:0, y:undefined}`', function () {
|
||||
var obj = {
|
||||
var obj: any = {
|
||||
x: 0,
|
||||
y: undefined
|
||||
};
|
||||
expect(obj).toExactlyHaveProperties('x', 'y');
|
||||
});
|
||||
it('should work in any order', function () {
|
||||
var obj = {
|
||||
var obj: any = {
|
||||
x: 0,
|
||||
y: undefined
|
||||
};
|
||||
@@ -338,14 +338,14 @@ describe('toExactlyHaveProperties', function () {
|
||||
});
|
||||
describe('non-matches', function () {
|
||||
it('should work for too many properties', function () {
|
||||
var obj = {
|
||||
var obj: any = {
|
||||
x: 0,
|
||||
y: undefined
|
||||
};
|
||||
expect(obj).not.toExactlyHaveProperties('x');
|
||||
});
|
||||
it('should work for missing properties', function () {
|
||||
var obj = {
|
||||
var obj: any = {
|
||||
x: 0,
|
||||
y: undefined
|
||||
};
|
||||
@@ -375,17 +375,17 @@ describe('toEndWith', function () {
|
||||
describe('matches', function () {
|
||||
it('should work for string', function () {
|
||||
expect([
|
||||
'1',
|
||||
'1',
|
||||
'2'
|
||||
]).toEndWith('2');
|
||||
});
|
||||
it('should work for array', function () {
|
||||
expect([
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]).toEndWith([
|
||||
4,
|
||||
4,
|
||||
5
|
||||
]);
|
||||
});
|
||||
@@ -393,17 +393,17 @@ describe('toEndWith', function () {
|
||||
describe('non-matches', function () {
|
||||
it('should work for string', function () {
|
||||
expect([
|
||||
'1',
|
||||
'1',
|
||||
'2'
|
||||
]).not.toEndWith('3');
|
||||
});
|
||||
it('should work for array', function () {
|
||||
expect([
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]).not.toEndWith([
|
||||
3,
|
||||
3,
|
||||
4
|
||||
]);
|
||||
});
|
||||
@@ -419,8 +419,8 @@ describe('toEachEndWith', function () {
|
||||
});
|
||||
it('should work for array with multiple elements', function () {
|
||||
expect([
|
||||
'one',
|
||||
'zwee',
|
||||
'one',
|
||||
'zwee',
|
||||
'three'
|
||||
]).toEachEndWith('e');
|
||||
});
|
||||
@@ -433,8 +433,8 @@ describe('toEachEndWith', function () {
|
||||
});
|
||||
it('should work for array with multiple elements', function () {
|
||||
expect([
|
||||
'one',
|
||||
'zwei',
|
||||
'one',
|
||||
'zwei',
|
||||
'three'
|
||||
]).not.toEachEndWith('e');
|
||||
});
|
||||
@@ -449,8 +449,8 @@ describe('toSomeEndWith', function () {
|
||||
});
|
||||
it('should work for array with multiple elements', function () {
|
||||
expect([
|
||||
'one',
|
||||
'zwee',
|
||||
'one',
|
||||
'zwee',
|
||||
'three'
|
||||
]).toSomeEndWith('ee');
|
||||
});
|
||||
@@ -463,8 +463,8 @@ describe('toSomeEndWith', function () {
|
||||
});
|
||||
it('should work for array with multiple elements', function () {
|
||||
expect([
|
||||
'one',
|
||||
'zwei',
|
||||
'one',
|
||||
'zwei',
|
||||
'three'
|
||||
]).not.toSomeEndWith('a');
|
||||
});
|
||||
@@ -491,17 +491,17 @@ describe('toStartWith', function () {
|
||||
describe('matches', function () {
|
||||
it('should work for string', function () {
|
||||
expect([
|
||||
'1',
|
||||
'1',
|
||||
'2'
|
||||
]).toStartWith('1');
|
||||
});
|
||||
it('should work for array', function () {
|
||||
expect([
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]).toStartWith([
|
||||
3,
|
||||
3,
|
||||
4
|
||||
]);
|
||||
});
|
||||
@@ -509,17 +509,17 @@ describe('toStartWith', function () {
|
||||
describe('non-matches', function () {
|
||||
it('should work for string', function () {
|
||||
expect([
|
||||
'1',
|
||||
'1',
|
||||
'2'
|
||||
]).not.toStartWith('3');
|
||||
});
|
||||
it('should work for array', function () {
|
||||
expect([
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]).not.toStartWith([
|
||||
4,
|
||||
4,
|
||||
5
|
||||
]);
|
||||
});
|
||||
@@ -535,8 +535,8 @@ describe('toEachStartWith', function () {
|
||||
});
|
||||
it('should work for array with multiple elements', function () {
|
||||
expect([
|
||||
'one',
|
||||
'onetwo',
|
||||
'one',
|
||||
'onetwo',
|
||||
'onethree'
|
||||
]).toEachStartWith('o');
|
||||
});
|
||||
@@ -549,8 +549,8 @@ describe('toEachStartWith', function () {
|
||||
});
|
||||
it('should work for array with multiple elements', function () {
|
||||
expect([
|
||||
'one',
|
||||
'two',
|
||||
'one',
|
||||
'two',
|
||||
'onethree'
|
||||
]).not.toEachStartWith('o');
|
||||
});
|
||||
@@ -565,8 +565,8 @@ describe('toSomeStartWith', function () {
|
||||
});
|
||||
it('should work for array with multiple elements', function () {
|
||||
expect([
|
||||
'one',
|
||||
'onetwo',
|
||||
'one',
|
||||
'onetwo',
|
||||
'three'
|
||||
]).toSomeStartWith('one');
|
||||
});
|
||||
@@ -579,8 +579,8 @@ describe('toSomeStartWith', function () {
|
||||
});
|
||||
it('should work for array with multiple elements', function () {
|
||||
expect([
|
||||
'one',
|
||||
'two',
|
||||
'one',
|
||||
'two',
|
||||
'onethree'
|
||||
]).not.toSomeStartWith('a');
|
||||
});
|
||||
@@ -610,19 +610,19 @@ describe('toStartWithEither', function () {
|
||||
describe('matches', function () {
|
||||
it('should work for string', function () {
|
||||
expect([
|
||||
'1',
|
||||
'1',
|
||||
'2'
|
||||
]).toStartWithEither('1', '2');
|
||||
});
|
||||
it('should work for array', function () {
|
||||
expect([
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]).toStartWithEither([
|
||||
4
|
||||
], [
|
||||
3,
|
||||
3,
|
||||
4
|
||||
]);
|
||||
});
|
||||
@@ -630,20 +630,20 @@ describe('toStartWithEither', function () {
|
||||
describe('non-matches', function () {
|
||||
it('should work for string', function () {
|
||||
expect([
|
||||
'1',
|
||||
'1',
|
||||
'2'
|
||||
]).not.toStartWithEither('3');
|
||||
});
|
||||
it('should work for array', function () {
|
||||
expect([
|
||||
3,
|
||||
4,
|
||||
3,
|
||||
4,
|
||||
5
|
||||
]).not.toStartWithEither([
|
||||
5,
|
||||
5,
|
||||
6
|
||||
], [
|
||||
4,
|
||||
4,
|
||||
5
|
||||
]);
|
||||
});
|
||||
|
||||
@@ -0,0 +1,99 @@
|
||||
/// <reference path="./js-combinatorics-global.d.ts" />
|
||||
|
||||
const p:number = Combinatorics.P(1, 2);
|
||||
const c:number = Combinatorics.C(1, 2);
|
||||
const factorial:number = Combinatorics.factorial(5);
|
||||
const factoradic:number[] = Combinatorics.factoradic(5);
|
||||
|
||||
const power = Combinatorics.power(["a", "b", "c"]);
|
||||
const nextPower:string[] = power.next();
|
||||
power.forEach((i:string[]) => console.log(i));
|
||||
const powersLengths:number[] = power.map((i:string[]) => i.length);
|
||||
const filteredPowers:string[][] = power.filter((i:string[]) => i.length > 0);
|
||||
const allPowers:string[][] = power.toArray();
|
||||
const powersCount = power.length;
|
||||
const nthPower:string[] = power.nth(3);
|
||||
|
||||
const limitedCombination = Combinatorics.combination(["a", "b", "c"], 2);
|
||||
const combination = Combinatorics.combination(["a", "b", "c"]);
|
||||
const nextCombination:string[] = combination.next();
|
||||
combination.forEach((i:string[]) => console.log(i));
|
||||
const combinationsLengths:number[] = combination.map((i:string[]) => i.length);
|
||||
const filteredCombinations:string[][] = combination.filter((i:string[]) => i.length > 0);
|
||||
const allCombinations:string[][] = combination.toArray();
|
||||
const combinationsCount = combination.length;
|
||||
|
||||
const limitedPermutation = Combinatorics.permutation(["a", "b", "c"], 2);
|
||||
const permutation = Combinatorics.permutation(["a", "b", "c"]);
|
||||
const nextPermutation:string[] = permutation.next();
|
||||
permutation.forEach((i:string[]) => console.log(i));
|
||||
const permutationsLengths:number[] = permutation.map((i:string[]) => i.length);
|
||||
const filteredPermutations:string[][] = permutation.filter((i:string[]) => i.length > 0);
|
||||
const allPermutations:string[][] = permutation.toArray();
|
||||
const permutationsCount = permutation.length;
|
||||
|
||||
const permutationCombination = Combinatorics.permutationCombination(["a", "b", "c"]);
|
||||
const nextPermutationCombinations:string[] = permutationCombination.next();
|
||||
permutationCombination.forEach((i:string[]) => console.log(i));
|
||||
const permutationCombinationsLengths:number[] = permutationCombination.map((i:string[]) => i.length);
|
||||
const filteredPermutationCombinationss:string[][] = permutationCombination.filter((i:string[]) => i.length > 0);
|
||||
const allPermutationCombinationss:string[][] = permutationCombination.toArray();
|
||||
const permutationCombinationsCount = permutationCombination.length;
|
||||
|
||||
const limitedBaseN = Combinatorics.baseN(["a", "b", "c"], 2);
|
||||
const baseN = Combinatorics.baseN(["a", "b", "c"]);
|
||||
const nextbaseN:string[] = baseN.next();
|
||||
baseN.forEach((i:string[]) => console.log(i));
|
||||
const baseNsLengths:number[] = baseN.map((i:string[]) => i.length);
|
||||
const filteredbaseNs:string[][] = baseN.filter((i:string[]) => i.length > 0);
|
||||
const allbaseNs:string[][] = baseN.toArray();
|
||||
const baseNsCount = baseN.length;
|
||||
const nthbaseN:string[] = baseN.nth(3);
|
||||
|
||||
const cartesianProduct1 = Combinatorics.cartesianProduct(["a", "b", "c"]);
|
||||
const nextCartesianProduct1:[string] = cartesianProduct1.next();
|
||||
const nextCartesianProduct1Char = nextCartesianProduct1[0].substr(0, 1);
|
||||
cartesianProduct1.forEach((i:[string]) => console.log(i));
|
||||
const cartesianProduct1sLengths:number[] = cartesianProduct1.map((i:[string]) => i.length);
|
||||
const filteredCartesianProduct1s:[string][] = cartesianProduct1.filter((i:[string]) => i.length > 0);
|
||||
const allCartesianProduct1s:[string][] = cartesianProduct1.toArray();
|
||||
const cartesianProduct1sCount = cartesianProduct1.length;
|
||||
const nthCartesianProduct1:[string] = cartesianProduct1.nth(3);
|
||||
const cartesianProduct1ByCoords:[string] = cartesianProduct1.get(1);
|
||||
|
||||
const cartesianProduct2 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3]);
|
||||
const nextCartesianProduct2:[string, number] = cartesianProduct2.next();
|
||||
const nextCartesianProduct2Char = nextCartesianProduct2[0].substr(0, 1);
|
||||
const nextCartesianProduct2Num = nextCartesianProduct2[1].toFixed(2);
|
||||
cartesianProduct2.forEach((i:[string, number]) => console.log(i));
|
||||
const cartesianProduct2sLengths:number[] = cartesianProduct2.map((i:[string, number]) => i.length);
|
||||
const filteredCartesianProduct2s:[string, number][] = cartesianProduct2.filter((i:[string, number]) => i.length > 0);
|
||||
const allCartesianProduct2s:[string, number][] = cartesianProduct2.toArray();
|
||||
const cartesianProduct2sCount = cartesianProduct2.length;
|
||||
const nthCartesianProduct2:[string, number] = cartesianProduct2.nth(3);
|
||||
const cartesianProduct2ByCoords:[string, number] = cartesianProduct2.get(1, 1);
|
||||
|
||||
const cartesianProduct3 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3], [true, false]);
|
||||
const nextCartesianProduct3:[string, number, boolean] = cartesianProduct3.next();
|
||||
const nextCartesianProduct3Char = nextCartesianProduct3[0].substr(0, 1);
|
||||
const nextCartesianProduct3Num = nextCartesianProduct3[1].toFixed(2);
|
||||
const nextCartesianProduct4Cond = nextCartesianProduct3[2] === true;
|
||||
cartesianProduct3.forEach((i:[string, number, boolean]) => console.log(i));
|
||||
const cartesianProduct3sLengths:number[] = cartesianProduct3.map((i:[string, number, boolean]) => i.length);
|
||||
const filteredCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.filter((i:[string, number, boolean]) => i.length > 0);
|
||||
const allCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.toArray();
|
||||
const cartesianProduct3sCount = cartesianProduct3.length;
|
||||
const nthCartesianProduct3:[string, number, boolean] = cartesianProduct3.nth(3);
|
||||
const cartesianProduct3ByCoords:[string, number, boolean] = cartesianProduct3.get(1, 1);
|
||||
|
||||
const cartesianProductAny = Combinatorics.cartesianProduct(["a", 1, true], [false, 2, "b"]);
|
||||
const nextCartesianProductAny:any[] = cartesianProductAny.next();
|
||||
cartesianProductAny.forEach((i:any[]) => console.log(i));
|
||||
const cartesianProductAnysLengths:number[] = cartesianProductAny.map((i:any[]) => i.length);
|
||||
const filteredCartesianProductAnys:any[][] = cartesianProductAny.filter((i:any[]) => i.length > 0);
|
||||
const allCartesianProductAnys:any[][] = cartesianProductAny.toArray();
|
||||
const cartesianProductAnysCount = cartesianProductAny.length;
|
||||
const nthCartesianProductAny:any[] = cartesianProductAny.nth(3);
|
||||
const cartesianProductAnyByCoords:any[] = cartesianProductAny.get(1, 1);
|
||||
|
||||
const version:string = Combinatorics.VERSION;
|
||||
@@ -0,0 +1,8 @@
|
||||
// Type definitions for js-combinatorics v0.5.0 (global)
|
||||
// Project: https://github.com/dankogai/js-combinatorics
|
||||
// Definitions by: Vasya Aksyonov <https://github.com/outring>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="./js-combinatorics.d.ts" />
|
||||
|
||||
import Combinatorics = __Combinatorics;
|
||||
@@ -0,0 +1,95 @@
|
||||
/// <reference path="./js-combinatorics.d.ts" />
|
||||
|
||||
import * as Combinatorics from "js-combinatorics";
|
||||
|
||||
const p:number = Combinatorics.P(1, 2);
|
||||
const c:number = Combinatorics.C(1, 2);
|
||||
const factorial:number = Combinatorics.factorial(5);
|
||||
const factoradic:number[] = Combinatorics.factoradic(5);
|
||||
|
||||
const power = Combinatorics.power(["a", "b", "c"]);
|
||||
const nextPower:string[] = power.next();
|
||||
power.forEach((i:string[]) => console.log(i));
|
||||
const powersLengths:number[] = power.map((i:string[]) => i.length);
|
||||
const filteredPowers:string[][] = power.filter((i:string[]) => i.length > 0);
|
||||
const allPowers:string[][] = power.toArray();
|
||||
const powersCount = power.length;
|
||||
const nthPower:string[] = power.nth(3);
|
||||
|
||||
const limitedCombination = Combinatorics.combination(["a", "b", "c"], 2);
|
||||
const combination = Combinatorics.combination(["a", "b", "c"]);
|
||||
const nextCombination:string[] = combination.next();
|
||||
combination.forEach((i:string[]) => console.log(i));
|
||||
const combinationsLengths:number[] = combination.map((i:string[]) => i.length);
|
||||
const filteredCombinations:string[][] = combination.filter((i:string[]) => i.length > 0);
|
||||
const allCombinations:string[][] = combination.toArray();
|
||||
const combinationsCount = combination.length;
|
||||
|
||||
const limitedPermutation = Combinatorics.permutation(["a", "b", "c"], 2);
|
||||
const permutation = Combinatorics.permutation(["a", "b", "c"]);
|
||||
const nextPermutation:string[] = permutation.next();
|
||||
permutation.forEach((i:string[]) => console.log(i));
|
||||
const permutationsLengths:number[] = permutation.map((i:string[]) => i.length);
|
||||
const filteredPermutations:string[][] = permutation.filter((i:string[]) => i.length > 0);
|
||||
const allPermutations:string[][] = permutation.toArray();
|
||||
const permutationsCount = permutation.length;
|
||||
|
||||
const permutationCombination = Combinatorics.permutationCombination(["a", "b", "c"]);
|
||||
const nextPermutationCombinations:string[] = permutationCombination.next();
|
||||
permutationCombination.forEach((i:string[]) => console.log(i));
|
||||
const permutationCombinationsLengths:number[] = permutationCombination.map((i:string[]) => i.length);
|
||||
const filteredPermutationCombinationss:string[][] = permutationCombination.filter((i:string[]) => i.length > 0);
|
||||
const allPermutationCombinationss:string[][] = permutationCombination.toArray();
|
||||
const permutationCombinationsCount = permutationCombination.length;
|
||||
|
||||
const limitedBaseN = Combinatorics.baseN(["a", "b", "c"], 2);
|
||||
const baseN = Combinatorics.baseN(["a", "b", "c"]);
|
||||
const nextbaseN:string[] = baseN.next();
|
||||
baseN.forEach((i:string[]) => console.log(i));
|
||||
const baseNsLengths:number[] = baseN.map((i:string[]) => i.length);
|
||||
const filteredbaseNs:string[][] = baseN.filter((i:string[]) => i.length > 0);
|
||||
const allbaseNs:string[][] = baseN.toArray();
|
||||
const baseNsCount = baseN.length;
|
||||
const nthbaseN:string[] = baseN.nth(3);
|
||||
|
||||
const cartesianProduct1 = Combinatorics.cartesianProduct(["a", "b", "c"]);
|
||||
const nextCartesianProduct1:[string] = cartesianProduct1.next();
|
||||
cartesianProduct1.forEach((i:[string]) => console.log(i));
|
||||
const cartesianProduct1sLengths:number[] = cartesianProduct1.map((i:[string]) => i.length);
|
||||
const filteredCartesianProduct1s:[string][] = cartesianProduct1.filter((i:[string]) => i.length > 0);
|
||||
const allCartesianProduct1s:[string][] = cartesianProduct1.toArray();
|
||||
const cartesianProduct1sCount = cartesianProduct1.length;
|
||||
const nthCartesianProduct1:[string] = cartesianProduct1.nth(3);
|
||||
const cartesianProduct1ByCoords:[string] = cartesianProduct1.get(1);
|
||||
|
||||
const cartesianProduct2 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3]);
|
||||
const nextCartesianProduct2:[string, number] = cartesianProduct2.next();
|
||||
cartesianProduct2.forEach((i:[string, number]) => console.log(i));
|
||||
const cartesianProduct2sLengths:number[] = cartesianProduct2.map((i:[string, number]) => i.length);
|
||||
const filteredCartesianProduct2s:[string, number][] = cartesianProduct2.filter((i:[string, number]) => i.length > 0);
|
||||
const allCartesianProduct2s:[string, number][] = cartesianProduct2.toArray();
|
||||
const cartesianProduct2sCount = cartesianProduct2.length;
|
||||
const nthCartesianProduct2:[string, number] = cartesianProduct2.nth(3);
|
||||
const cartesianProduct2ByCoords:[string, number] = cartesianProduct2.get(1, 1);
|
||||
|
||||
const cartesianProduct3 = Combinatorics.cartesianProduct(["a", "b", "c"], [1, 2, 3], [true, false]);
|
||||
const nextCartesianProduct3:[string, number, boolean] = cartesianProduct3.next();
|
||||
cartesianProduct3.forEach((i:[string, number, boolean]) => console.log(i));
|
||||
const cartesianProduct3sLengths:number[] = cartesianProduct3.map((i:[string, number, boolean]) => i.length);
|
||||
const filteredCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.filter((i:[string, number, boolean]) => i.length > 0);
|
||||
const allCartesianProduct3s:[string, number, boolean][] = cartesianProduct3.toArray();
|
||||
const cartesianProduct3sCount = cartesianProduct3.length;
|
||||
const nthCartesianProduct3:[string, number, boolean] = cartesianProduct3.nth(3);
|
||||
const cartesianProduct3ByCoords:[string, number, boolean] = cartesianProduct3.get(1, 1);
|
||||
|
||||
const cartesianProductAny = Combinatorics.cartesianProduct(["a", 1, true], [false, 2, "b"]);
|
||||
const nextCartesianProductAny:any[] = cartesianProductAny.next();
|
||||
cartesianProductAny.forEach((i:any[]) => console.log(i));
|
||||
const cartesianProductAnysLengths:number[] = cartesianProductAny.map((i:any[]) => i.length);
|
||||
const filteredCartesianProductAnys:any[][] = cartesianProductAny.filter((i:any[]) => i.length > 0);
|
||||
const allCartesianProductAnys:any[][] = cartesianProductAny.toArray();
|
||||
const cartesianProductAnysCount = cartesianProductAny.length;
|
||||
const nthCartesianProductAny:any[] = cartesianProductAny.nth(3);
|
||||
const cartesianProductAnyByCoords:any[] = cartesianProductAny.get(1, 1);
|
||||
|
||||
const version:string = Combinatorics.VERSION;
|
||||
+135
@@ -0,0 +1,135 @@
|
||||
// Type definitions for js-combinatorics v0.5.0
|
||||
// Project: https://github.com/dankogai/js-combinatorics
|
||||
// Definitions by: Vasya Aksyonov <https://github.com/outring>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare namespace __Combinatorics {
|
||||
|
||||
interface IGenerator<T> {
|
||||
|
||||
/**
|
||||
* Returns the element or undefined if no more element is available.
|
||||
*/
|
||||
next():T;
|
||||
|
||||
/**
|
||||
* Applies the callback function for each element.
|
||||
*/
|
||||
forEach(f:(item:T) => void):void;
|
||||
|
||||
/**
|
||||
* All elements at once with function applied to each element.
|
||||
*/
|
||||
map<TResult>(f:(item:T) => TResult):TResult[];
|
||||
|
||||
/**
|
||||
* Returns an array with elements that passes the filter function.
|
||||
*/
|
||||
filter(predicate:(item:T) => boolean):T[];
|
||||
|
||||
/**
|
||||
* All elements at once.
|
||||
*/
|
||||
toArray():T[];
|
||||
|
||||
/**
|
||||
* Returns the number of elements to be generated which equals to generator.toArray().length
|
||||
* but it is precalculated without actually generating elements.
|
||||
* Handy when you prepare for large iteration.
|
||||
*/
|
||||
length:number;
|
||||
|
||||
}
|
||||
|
||||
interface IPredictableGenerator<T> extends IGenerator<T> {
|
||||
|
||||
/**
|
||||
* Returns the nth element (starting 0).
|
||||
*/
|
||||
nth(n:number):T;
|
||||
|
||||
}
|
||||
|
||||
interface ICartesianProductGenerator<T> extends IPredictableGenerator<T> {
|
||||
|
||||
/**
|
||||
* Arguments are coordinates in integer.
|
||||
* Arguments can be out of bounds but it returns undefined in such cases.
|
||||
*/
|
||||
get(...coordinates:number[]):T;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculates m P n
|
||||
*/
|
||||
function P(m:number, n:number):number;
|
||||
|
||||
/**
|
||||
* Calculates m C n
|
||||
*/
|
||||
function C(m:number, n:number):number;
|
||||
|
||||
/**
|
||||
* Calculates n!
|
||||
*/
|
||||
function factorial(n:number):number;
|
||||
|
||||
/**
|
||||
* Returns the factoradic representation of n in array, in least significant order.
|
||||
* See http://en.wikipedia.org/wiki/Factorial_number_system
|
||||
*/
|
||||
function factoradic(n:number):number[];
|
||||
|
||||
/**
|
||||
* Generates the power set of array.
|
||||
*/
|
||||
function power<T>(a:T[]):IPredictableGenerator<T[]>;
|
||||
|
||||
/**
|
||||
* Generates the combination of array with n elements.
|
||||
* When n is ommited, the length of the array is used.
|
||||
*/
|
||||
function combination<T>(a:T[], n?:number):IGenerator<T[]>;
|
||||
|
||||
/**
|
||||
* Generates the permutation of array with n elements.
|
||||
* When n is ommited, the length of the array is used.
|
||||
*/
|
||||
function permutation<T>(a:T[], n?:number):IGenerator<T[]>;
|
||||
|
||||
/**
|
||||
* Generates the permutation of the combination of n.
|
||||
* Equivalent to permutation(combination(a)), but more efficient.
|
||||
*/
|
||||
function permutationCombination<T>(a:T[]):IGenerator<T[]>;
|
||||
|
||||
/**
|
||||
* Generates n-digit "numbers" where each digit is an element in array.
|
||||
* Note this "number" is in the least significant order.
|
||||
* When n is ommited, the length of the array is used.
|
||||
*/
|
||||
function baseN<T>(a:T[], n?:number):IPredictableGenerator<T[]>;
|
||||
|
||||
/**
|
||||
* Generates the cartesian product of the arrays. All arguments must be arrays with more than one element.
|
||||
*/
|
||||
function cartesianProduct<T1>(a1:T1[]):ICartesianProductGenerator<[T1]>;
|
||||
function cartesianProduct<T1, T2>(a1:T1[], a2:T2[]):ICartesianProductGenerator<[T1, T2]>;
|
||||
function cartesianProduct<T1, T2, T3>(a1:T1[], a2:T2[], a3:T3[]):ICartesianProductGenerator<[T1, T2, T3]>;
|
||||
function cartesianProduct<T1, T2, T3, T4>(a1:T1[], a2:T2[], a3:T3[], a4:T4[]):ICartesianProductGenerator<[T1, T2, T3, T4]>;
|
||||
function cartesianProduct<T1, T2, T3, T4, T5>(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5]>;
|
||||
function cartesianProduct<T1, T2, T3, T4, T5, T6>(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6]>;
|
||||
function cartesianProduct<T1, T2, T3, T4, T5, T6, T7>(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7]>;
|
||||
function cartesianProduct<T1, T2, T3, T4, T5, T6, T7, T8>(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[], a8:T8[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7, T8]>;
|
||||
function cartesianProduct<T1, T2, T3, T4, T5, T6, T7, T8, T9>(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[], a8:T8[], a9:T9[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
|
||||
function cartesianProduct<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(a1:T1[], a2:T2[], a3:T3[], a4:T4[], a5:T5[], a6:T6[], a7:T7[], a8:T8[], a9:T9[], a10:T10[]):ICartesianProductGenerator<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
|
||||
function cartesianProduct(...a:any[][]):ICartesianProductGenerator<any[]>;
|
||||
|
||||
const VERSION:string;
|
||||
|
||||
}
|
||||
|
||||
declare module "js-combinatorics" {
|
||||
export = __Combinatorics;
|
||||
}
|
||||
Vendored
+7
-1
@@ -22,8 +22,13 @@ declare module "jsonwebtoken" {
|
||||
* - none: No digital signature or MAC value included
|
||||
*/
|
||||
algorithm?: string;
|
||||
/** @member {number} - Lifetime for the token in minutes */
|
||||
/**
|
||||
*@deprecated - see expiresIn
|
||||
*@member {number} - Lifetime for the token in minutes
|
||||
*/
|
||||
expiresInMinutes?: number;
|
||||
/** @member {string} - Lifetime for the token expressed in a string describing a time span [rauchg/ms](https://github.com/rauchg/ms.js). Eg: `60`, `"2 days"`, `"10h"`, `"7d"` */
|
||||
expiresIn?: string;
|
||||
audience?: string;
|
||||
subject?: string;
|
||||
issuer?: string;
|
||||
@@ -33,6 +38,7 @@ declare module "jsonwebtoken" {
|
||||
export interface VerifyOptions {
|
||||
audience?: string;
|
||||
issuer?: string;
|
||||
maxAge?: string;
|
||||
}
|
||||
|
||||
export interface VerifyCallbak {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
/// <reference path="jwt-decode.d.ts" />
|
||||
import jwtDecode = require('jwt-decode');
|
||||
|
||||
let token = "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJmb28iOiJiYXIiLCJleHAiOjEzOTMyODY4OTMsImlhdCI6MTM5MzI2ODg5M30.4-iaDojEVl0pJQMjrbM1EzUIfAZgsbK_kgnVyVxFSVo";
|
||||
|
||||
interface TokenDto {
|
||||
foo: string;
|
||||
exp: number;
|
||||
iat: number;
|
||||
}
|
||||
|
||||
let decodedToken = jwtDecode(token) as TokenDto;
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
// Type definitions for jwt-decode v1.4.0
|
||||
// Project: https://github.com/auth0/jwt-decode
|
||||
// Definitions by: Giedrius Grabauskas <https://github.com/QuatroDevOfficial/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
|
||||
declare module JwtDecode {
|
||||
interface JwtDecodeStatic {
|
||||
(token: string): any;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'jwt-decode' {
|
||||
var jwtDecode: JwtDecode.JwtDecodeStatic;
|
||||
export = jwtDecode;
|
||||
}
|
||||
Vendored
+1
@@ -56,6 +56,7 @@ declare module L {
|
||||
className?: string;
|
||||
clickable?: boolean;
|
||||
direction?: string; // 'left' | 'right' | 'auto';
|
||||
pane?: string;
|
||||
noHide?: boolean;
|
||||
offset?: Point;
|
||||
opacity?: number;
|
||||
|
||||
+446
-64
@@ -453,13 +453,58 @@ module TestDropWhile {
|
||||
}
|
||||
|
||||
// _.fill
|
||||
var testFillArray = [1, 2, 3];
|
||||
var testFillList: _.List<number> = {0: 1, 1: 2, 2: 3, length: 3};
|
||||
module TestFill {
|
||||
let array: number[];
|
||||
let list: _.List<number>;
|
||||
|
||||
result = <string[]>_.fill<string>(testFillArray, 'a', 0, 3);
|
||||
result = <_.List<string>>_.fill<string>(testFillList, 'a', 0, 3);
|
||||
result = <number[]>_(testFillArray).fill<number>(0, 0, 3).value();
|
||||
result = <_.List<number>>_(testFillList).fill<number>(0, 0, 3).value();
|
||||
{
|
||||
let result: number[];
|
||||
|
||||
result = _.fill<number>(array, 42);
|
||||
result = _.fill<number>(array, 42, 0);
|
||||
result = _.fill<number>(array, 42, 0, 10);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.List<number>;
|
||||
|
||||
result = _.fill<number>(list, 42);
|
||||
result = _.fill<number>(list, 42, 0);
|
||||
result = _.fill<number>(list, 42, 0, 10);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitArrayWrapper<number>;
|
||||
|
||||
result = _(array).fill<number>(42);
|
||||
result = _(array).fill<number>(42, 0);
|
||||
result = _(array).fill<number>(42, 0, 10);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<_.List<number>>;
|
||||
|
||||
result = _(list).fill<number>(42);
|
||||
result = _(list).fill<number>(42, 0);
|
||||
result = _(list).fill<number>(42, 0, 10);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitArrayWrapper<number>;
|
||||
|
||||
result = _(array).chain().fill<number>(42);
|
||||
result = _(array).chain().fill<number>(42, 0);
|
||||
result = _(array).chain().fill<number>(42, 0, 10);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<_.List<number>>;
|
||||
|
||||
result = _(list).chain().fill<number>(42);
|
||||
result = _(list).chain().fill<number>(42, 0);
|
||||
result = _(list).chain().fill<number>(42, 0, 10);
|
||||
}
|
||||
}
|
||||
|
||||
// _.findIndex
|
||||
module TestFindIndex {
|
||||
@@ -615,18 +660,40 @@ module TestFlattenDeep {
|
||||
|
||||
result = _.flattenDeep<TResult>(recursiveArray);
|
||||
result = _.flattenDeep<TResult>(listOfMaybeRecursiveArraysOrValues);
|
||||
|
||||
result = _(recursiveArray).flattenDeep<TResult>().value();
|
||||
|
||||
result = _(listOfMaybeRecursiveArraysOrValues).flattenDeep<TResult>().value();
|
||||
}
|
||||
|
||||
{
|
||||
let result: any;
|
||||
let result: any[];
|
||||
|
||||
result = _.flattenDeep<TResult>(recursiveList);
|
||||
}
|
||||
|
||||
result = _(recursiveList).flattenDeep().value();
|
||||
{
|
||||
let result: _.LoDashImplicitArrayWrapper<TResult>;
|
||||
|
||||
result = _(recursiveArray).flattenDeep<TResult>();
|
||||
|
||||
result = _(listOfMaybeRecursiveArraysOrValues).flattenDeep<TResult>();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitArrayWrapper<any>;
|
||||
|
||||
result = _(recursiveList).flattenDeep();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitArrayWrapper<TResult>;
|
||||
|
||||
result = _(recursiveArray).chain().flattenDeep<TResult>();
|
||||
|
||||
result = _(listOfMaybeRecursiveArraysOrValues).chain().flattenDeep<TResult>();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitArrayWrapper<any>;
|
||||
|
||||
result = _(recursiveList).chain().flattenDeep();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1164,17 +1231,86 @@ module TestSlice {
|
||||
|
||||
// _.sortedIndex
|
||||
module TestSortedIndex {
|
||||
result = <number>_.sortedIndex([20, 30, 50], 40);
|
||||
result = <number>_.sortedIndex([{ 'x': 20 }, { 'x': 30 }, { 'x': 50 }], { 'x': 40 }, 'x');
|
||||
var sortedIndexDict: { wordToNumber: { [idx: string]: number } } = {
|
||||
'wordToNumber': { 'twenty': 20, 'thirty': 30, 'fourty': 40, 'fifty': 50 }
|
||||
};
|
||||
result = <number>_.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) {
|
||||
return sortedIndexDict.wordToNumber[word];
|
||||
});
|
||||
result = <number>_.sortedIndex(['twenty', 'thirty', 'fifty'], 'fourty', function (word: string) {
|
||||
return this.wordToNumber[word];
|
||||
}, sortedIndexDict);
|
||||
type SampleType = {a: number; b: string; c: boolean;};
|
||||
|
||||
let array: SampleType[];
|
||||
let list: _.List<SampleType>;
|
||||
|
||||
let value: SampleType;
|
||||
|
||||
let stringIterator: (x: string) => number;
|
||||
let arrayIterator: (x: SampleType) => number;
|
||||
let listIterator: (x: SampleType) => number;
|
||||
|
||||
{
|
||||
let result: number;
|
||||
|
||||
result = _.sortedIndex<string>('', '');
|
||||
result = _.sortedIndex<string>('', '', stringIterator);
|
||||
result = _.sortedIndex<string>('', '', stringIterator, any);
|
||||
result = _.sortedIndex<string, number>('', '', stringIterator);
|
||||
result = _.sortedIndex<string, number>('', '', stringIterator, any);
|
||||
|
||||
result = _.sortedIndex<SampleType>(array, value);
|
||||
result = _.sortedIndex<SampleType>(array, value, arrayIterator);
|
||||
result = _.sortedIndex<SampleType>(array, value, arrayIterator, any);
|
||||
result = _.sortedIndex<SampleType>(array, value, '');
|
||||
result = _.sortedIndex<SampleType>(array, value, {a: 42});
|
||||
result = _.sortedIndex<SampleType, number>(array, value, arrayIterator);
|
||||
result = _.sortedIndex<SampleType, number>(array, value, arrayIterator, any);
|
||||
result = _.sortedIndex<{a: number}, SampleType>(array, value, {a: 42});
|
||||
|
||||
result = _.sortedIndex<SampleType>(list, value);
|
||||
result = _.sortedIndex<SampleType>(list, value, listIterator);
|
||||
result = _.sortedIndex<SampleType>(list, value, listIterator, any);
|
||||
result = _.sortedIndex<SampleType>(list, value, '');
|
||||
result = _.sortedIndex<SampleType>(list, value, {a: 42});
|
||||
result = _.sortedIndex<SampleType, number>(list, value, listIterator);
|
||||
result = _.sortedIndex<SampleType, number>(list, value, listIterator, any);
|
||||
result = _.sortedIndex<{a: number}, SampleType>(list, value, {a: 42});
|
||||
|
||||
result = _('').sortedIndex('');
|
||||
result = _('').sortedIndex<number>('', stringIterator);
|
||||
result = _('').sortedIndex<number>('', stringIterator, any);
|
||||
|
||||
result = _(array).sortedIndex(value);
|
||||
result = _(array).sortedIndex<number>(value, arrayIterator);
|
||||
result = _(array).sortedIndex<number>(value, arrayIterator, any);
|
||||
result = _(array).sortedIndex(value, '');
|
||||
result = _(array).sortedIndex<{a: number}>(value, {a: 42});
|
||||
|
||||
result = _(list).sortedIndex<SampleType>(value);
|
||||
result = _(list).sortedIndex<SampleType>(value, listIterator);
|
||||
result = _(list).sortedIndex<SampleType>(value, listIterator, any);
|
||||
result = _(list).sortedIndex<SampleType>(value, '');
|
||||
result = _(list).sortedIndex<SampleType>(value, {a: 42});
|
||||
result = _(list).sortedIndex<SampleType, number>(value, listIterator);
|
||||
result = _(list).sortedIndex<SampleType, number>(value, listIterator, any);
|
||||
result = _(list).sortedIndex<{a: number}, SampleType>(value, {a: 42});
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<number>;
|
||||
|
||||
result = _('').chain().sortedIndex('');
|
||||
result = _('').chain().sortedIndex<number>('', stringIterator);
|
||||
result = _('').chain().sortedIndex<number>('', stringIterator, any);
|
||||
|
||||
result = _(array).chain().sortedIndex(value);
|
||||
result = _(array).chain().sortedIndex<number>(value, arrayIterator);
|
||||
result = _(array).chain().sortedIndex<number>(value, arrayIterator, any);
|
||||
result = _(array).chain().sortedIndex(value, '');
|
||||
result = _(array).chain().sortedIndex<{a: number}>(value, {a: 42});
|
||||
|
||||
result = _(list).chain().sortedIndex<SampleType>(value);
|
||||
result = _(list).chain().sortedIndex<SampleType>(value, listIterator);
|
||||
result = _(list).chain().sortedIndex<SampleType>(value, listIterator, any);
|
||||
result = _(list).chain().sortedIndex<SampleType>(value, '');
|
||||
result = _(list).chain().sortedIndex<SampleType>(value, {a: 42});
|
||||
result = _(list).chain().sortedIndex<SampleType, number>(value, listIterator);
|
||||
result = _(list).chain().sortedIndex<SampleType, number>(value, listIterator, any);
|
||||
result = _(list).chain().sortedIndex<{a: number}, SampleType>(value, {a: 42});
|
||||
}
|
||||
}
|
||||
|
||||
// _.sortedLastIndex
|
||||
@@ -3396,21 +3532,154 @@ module TestForEachRight {
|
||||
}
|
||||
}
|
||||
|
||||
result = <_.Dictionary<number[]>>_.groupBy([4.2, 6.1, 6.4], function (num) { return Math.floor(num); });
|
||||
result = <_.Dictionary<number[]>>_.groupBy([4.2, 6.1, 6.4], function (num) { return this.floor(num); }, Math);
|
||||
result = <_.Dictionary<string[]>>_.groupBy(['one', 'two', 'three'], 'length');
|
||||
// _.groupBy
|
||||
module TestGroupBy {
|
||||
type SampleType = {a: number; b: string; c: boolean;};
|
||||
|
||||
result = <_.Dictionary<number[]>>_.groupBy({ prop1: 4.2, prop2: 6.1, prop3: 6.4}, function (num) { return Math.floor(num); });
|
||||
result = <_.Dictionary<number[]>>_.groupBy({ prop1: 4.2, prop2: 6.1, prop3: 6.4}, function (num) { return this.floor(num); }, Math);
|
||||
result = <_.Dictionary<string[]>>_.groupBy({ prop1: 'one', prop2: 'two', prop3: 'three'}, 'length');
|
||||
let array: SampleType[];
|
||||
let list: _.List<SampleType>;
|
||||
let dictionary: _.Dictionary<SampleType>;
|
||||
|
||||
result = <_.Dictionary<number[]>>_([4.2, 6.1, 6.4]).groupBy(function (num) { return Math.floor(num); }).value();
|
||||
result = <_.Dictionary<number[]>>_([4.2, 6.1, 6.4]).groupBy(function (num) { return this.floor(num); }, Math).value();
|
||||
result = <_.Dictionary<string[]>>_(['one', 'two', 'three']).groupBy('length').value();
|
||||
let stringIterator: (char: string, index: number, string: string) => number;
|
||||
let listIterator: (value: SampleType, index: number, collection: _.List<SampleType>) => number;
|
||||
let dictionaryIterator: (value: SampleType, key: string, collection: _.Dictionary<SampleType>) => number;
|
||||
|
||||
result = <_.Dictionary<number[]>>_({ prop1: 4.2, prop2: 6.1, prop3: 6.4}).groupBy<number>(function (num) { return Math.floor(num); }).value();
|
||||
result = <_.Dictionary<number[]>>_({ prop1: 4.2, prop2: 6.1, prop3: 6.4}).groupBy<number>(function (num) { return this.floor(num); }, Math).value();
|
||||
result = <_.Dictionary<string[]>>_({ prop1: 'one', prop2: 'two', prop3: 'three'}).groupBy<string>('length').value();
|
||||
{
|
||||
let result: _.Dictionary<string[]>;
|
||||
|
||||
result = _.groupBy<string>('');
|
||||
result = _.groupBy<string>('', stringIterator);
|
||||
result = _.groupBy<string>('', stringIterator, any);
|
||||
result = _.groupBy<string, number>('', stringIterator);
|
||||
result = _.groupBy<string, number>('', stringIterator, any);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.Dictionary<SampleType[]>;
|
||||
|
||||
result = _.groupBy<SampleType>(array);
|
||||
result = _.groupBy<SampleType>(array, listIterator);
|
||||
result = _.groupBy<SampleType>(array, listIterator, any);
|
||||
result = _.groupBy<SampleType>(array, '');
|
||||
result = _.groupBy<SampleType>(array, '', any);
|
||||
result = _.groupBy<SampleType>(array, {a: 42});
|
||||
|
||||
result = _.groupBy<SampleType, number>(array, listIterator);
|
||||
result = _.groupBy<SampleType, number>(array, listIterator, any);
|
||||
result = _.groupBy<SampleType, boolean>(array, '', true);
|
||||
result = _.groupBy<{a: number}, SampleType>(array, {a: 42});
|
||||
|
||||
result = _.groupBy<SampleType>(list);
|
||||
result = _.groupBy<SampleType>(list, listIterator);
|
||||
result = _.groupBy<SampleType>(list, listIterator, any);
|
||||
result = _.groupBy<SampleType>(list, '');
|
||||
result = _.groupBy<SampleType>(list, '', any);
|
||||
result = _.groupBy<SampleType>(list, {a: 42});
|
||||
|
||||
result = _.groupBy<SampleType, number>(list, listIterator);
|
||||
result = _.groupBy<SampleType, number>(list, listIterator, any);
|
||||
result = _.groupBy<SampleType, boolean>(list, '', true);
|
||||
result = _.groupBy<{a: number}, SampleType>(list, {a: 42});
|
||||
|
||||
result = _.groupBy<SampleType>(dictionary);
|
||||
result = _.groupBy<SampleType>(dictionary, dictionaryIterator);
|
||||
result = _.groupBy<SampleType>(dictionary, dictionaryIterator, any);
|
||||
result = _.groupBy<SampleType>(dictionary, '');
|
||||
result = _.groupBy<SampleType>(dictionary, '', any);
|
||||
result = _.groupBy<SampleType>(dictionary, {a: 42});
|
||||
|
||||
result = _.groupBy<SampleType, number>(dictionary, dictionaryIterator);
|
||||
result = _.groupBy<SampleType, number>(dictionary, dictionaryIterator, any);
|
||||
result = _.groupBy<SampleType, boolean>(dictionary, '', true);
|
||||
result = _.groupBy<{a: number}, SampleType>(dictionary, {a: 42});
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<_.Dictionary<string[]>>;
|
||||
|
||||
result = _('').groupBy();
|
||||
result = _('').groupBy<number>(stringIterator);
|
||||
result = _('').groupBy<number>(stringIterator, any);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<_.Dictionary<SampleType[]>>;
|
||||
|
||||
result = _(array).groupBy();
|
||||
result = _(array).groupBy<number>(listIterator);
|
||||
result = _(array).groupBy<number>(listIterator, any);
|
||||
result = _(array).groupBy('');
|
||||
result = _(array).groupBy<boolean>('', true);
|
||||
result = _(array).groupBy<{a: number}>({a: 42});
|
||||
|
||||
result = _(list).groupBy<SampleType>();
|
||||
result = _(list).groupBy<SampleType>(listIterator);
|
||||
result = _(list).groupBy<SampleType>(listIterator, any);
|
||||
result = _(list).groupBy<SampleType>('');
|
||||
result = _(list).groupBy<SampleType>('', any);
|
||||
result = _(list).groupBy<SampleType>({a: 42});
|
||||
|
||||
result = _(list).groupBy<SampleType, number>(listIterator);
|
||||
result = _(list).groupBy<SampleType, number>(listIterator, any);
|
||||
result = _(list).groupBy<SampleType, boolean>('', true);
|
||||
result = _(list).groupBy<{a: number}, SampleType>({a: 42});
|
||||
|
||||
result = _(dictionary).groupBy<SampleType>();
|
||||
result = _(dictionary).groupBy<SampleType>(dictionaryIterator);
|
||||
result = _(dictionary).groupBy<SampleType>(dictionaryIterator, any);
|
||||
result = _(dictionary).groupBy<SampleType>('');
|
||||
result = _(dictionary).groupBy<SampleType>('', any);
|
||||
result = _(dictionary).groupBy<SampleType>({a: 42});
|
||||
|
||||
result = _(dictionary).groupBy<SampleType, number>(dictionaryIterator);
|
||||
result = _(dictionary).groupBy<SampleType, number>(dictionaryIterator, any);
|
||||
result = _(dictionary).groupBy<SampleType, boolean>('', true);
|
||||
result = _(dictionary).groupBy<{a: number}, SampleType>({a: 42});
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<_.Dictionary<string[]>>;
|
||||
|
||||
result = _('').chain().groupBy();
|
||||
result = _('').chain().groupBy<number>(stringIterator);
|
||||
result = _('').chain().groupBy<number>(stringIterator, any);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<_.Dictionary<SampleType[]>>;
|
||||
|
||||
result = _(array).chain().groupBy();
|
||||
result = _(array).chain().groupBy<number>(listIterator);
|
||||
result = _(array).chain().groupBy<number>(listIterator, any);
|
||||
result = _(array).chain().groupBy('');
|
||||
result = _(array).chain().groupBy<boolean>('', true);
|
||||
result = _(array).chain().groupBy<{a: number}>({a: 42});
|
||||
|
||||
result = _(list).chain().groupBy<SampleType>();
|
||||
result = _(list).chain().groupBy<SampleType>(listIterator);
|
||||
result = _(list).chain().groupBy<SampleType>(listIterator, any);
|
||||
result = _(list).chain().groupBy<SampleType>('');
|
||||
result = _(list).chain().groupBy<SampleType>('', any);
|
||||
result = _(list).chain().groupBy<SampleType>({a: 42});
|
||||
|
||||
result = _(list).chain().groupBy<SampleType, number>(listIterator);
|
||||
result = _(list).chain().groupBy<SampleType, number>(listIterator, any);
|
||||
result = _(list).chain().groupBy<SampleType, boolean>('', true);
|
||||
result = _(list).chain().groupBy<{a: number}, SampleType>({a: 42});
|
||||
|
||||
result = _(dictionary).chain().groupBy<SampleType>();
|
||||
result = _(dictionary).chain().groupBy<SampleType>(dictionaryIterator);
|
||||
result = _(dictionary).chain().groupBy<SampleType>(dictionaryIterator, any);
|
||||
result = _(dictionary).chain().groupBy<SampleType>('');
|
||||
result = _(dictionary).chain().groupBy<SampleType>('', any);
|
||||
result = _(dictionary).chain().groupBy<SampleType>({a: 42});
|
||||
|
||||
result = _(dictionary).chain().groupBy<SampleType, number>(dictionaryIterator);
|
||||
result = _(dictionary).chain().groupBy<SampleType, number>(dictionaryIterator, any);
|
||||
result = _(dictionary).chain().groupBy<SampleType, boolean>('', true);
|
||||
result = _(dictionary).chain().groupBy<{a: number}, SampleType>({a: 42});
|
||||
}
|
||||
}
|
||||
|
||||
// _.include
|
||||
module TestInclude {
|
||||
@@ -4487,11 +4756,39 @@ source.addEventListener('message', <_.LoDashImplicitObjectWrapper<Function>>_(fu
|
||||
'maxWait': 1000
|
||||
}), false);
|
||||
|
||||
var returnedDebounce = _.throttle(function (a: any) { return a * 5; }, 5);
|
||||
returnedThrottled(4);
|
||||
// _.defer
|
||||
module TestDefer {
|
||||
type SampleFunc = (a: number, b: string) => boolean;
|
||||
|
||||
result = <number>_.defer(function () { console.log('deferred'); });
|
||||
result = <_.LoDashImplicitWrapper<number>>_(function () { console.log('deferred'); }).defer();
|
||||
let func: SampleFunc;
|
||||
|
||||
{
|
||||
let result: number;
|
||||
|
||||
result = _.defer<SampleFunc>(func);
|
||||
result = _.defer<SampleFunc>(func, any);
|
||||
result = _.defer<SampleFunc>(func, any, any);
|
||||
result = _.defer<SampleFunc>(func, any, any, any);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitWrapper<number>;
|
||||
|
||||
result = _(func).defer();
|
||||
result = _(func).defer(any);
|
||||
result = _(func).defer(any, any);
|
||||
result = _(func).defer(any, any, any);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<number>;
|
||||
|
||||
result = _(func).chain().defer();
|
||||
result = _(func).chain().defer(any);
|
||||
result = _(func).chain().defer(any, any);
|
||||
result = _(func).chain().defer(any, any, any);
|
||||
}
|
||||
}
|
||||
|
||||
// _.delay
|
||||
module TestDelay {
|
||||
@@ -4573,9 +4870,6 @@ result = <TestMemoizedResultFn>_.memoize<TestMemoizedResultFn>(testMemoizeFn, te
|
||||
result = <TestMemoizedResultFn>(_(testMemoizeFn).memoize<TestMemoizedResultFn>().value());
|
||||
result = <TestMemoizedResultFn>(_(testMemoizeFn).memoize<TestMemoizedResultFn>(testMemoizeResolverFn).value());
|
||||
|
||||
var returnedMemoize = _.throttle(function (a: any) { return a * 5; }, 5);
|
||||
returnedMemoize(4);
|
||||
|
||||
// _.modArgs
|
||||
module TestModArgs {
|
||||
type Func1 = (a: boolean) => boolean;
|
||||
@@ -4670,9 +4964,6 @@ module TestOnce {
|
||||
}
|
||||
}
|
||||
|
||||
var returnedOnce = _.throttle(function (a: any) { return a * 5; }, 5);
|
||||
returnedOnce(4);
|
||||
|
||||
var greetPartial = function (greeting: string, name: string) { return greeting + ' ' + name; };
|
||||
var hi = _.partial(greetPartial, 'hi');
|
||||
hi('moe');
|
||||
@@ -4737,15 +5028,49 @@ interface TestSpreadResultFn {
|
||||
result = <string>(_.spread<TestSpreadResultFn>(testSpreadFn))(['fred', 'hello']);
|
||||
result = <string>(_(testSpreadFn).spread<TestSpreadResultFn>().value())(['fred', 'hello']);
|
||||
|
||||
var throttled = _.throttle(function () { }, 100);
|
||||
jQuery(window).on('scroll', throttled);
|
||||
// _.throttle
|
||||
module TestThrottle {
|
||||
interface SampleFunc {
|
||||
(n: number, s: string): boolean;
|
||||
}
|
||||
|
||||
jQuery('.interactive').on('click', _.throttle(function () { }, 300000, {
|
||||
'trailing': false
|
||||
}));
|
||||
interface Options {
|
||||
leading?: boolean;
|
||||
trailing?: boolean;
|
||||
}
|
||||
|
||||
var returnedThrottled = _.throttle(function (a: any) { return a * 5; }, 5);
|
||||
returnedThrottled(4);
|
||||
interface ResultFunc {
|
||||
(n: number, s: string): boolean;
|
||||
cancel(): void;
|
||||
}
|
||||
|
||||
let func: SampleFunc;
|
||||
let options: Options;
|
||||
|
||||
{
|
||||
let result: ResultFunc;
|
||||
|
||||
result = _.throttle<SampleFunc>(func);
|
||||
result = _.throttle<SampleFunc>(func, 42);
|
||||
result = _.throttle<SampleFunc>(func, 42, options);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<ResultFunc>;
|
||||
|
||||
result = _(func).throttle();
|
||||
result = _(func).throttle(42);
|
||||
result = _(func).throttle(42, options);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<ResultFunc>;
|
||||
|
||||
result = _(func).chain().throttle();
|
||||
result = _(func).chain().throttle(42);
|
||||
result = _(func).chain().throttle(42, options);
|
||||
}
|
||||
}
|
||||
|
||||
var helloWrap = function (name: string) { return 'hello ' + name; };
|
||||
var helloWrap2 = _.wrap(helloWrap, function (func) {
|
||||
@@ -5092,10 +5417,25 @@ result = <boolean>_(Array.prototype.push).isNative();
|
||||
}
|
||||
|
||||
// _.isNull
|
||||
result = <boolean>_.isNull(any);
|
||||
result = <boolean>_(1).isNull();
|
||||
result = <boolean>_<any>([]).isNull();
|
||||
result = <boolean>_({}).isNull();
|
||||
module TestIsNull {
|
||||
{
|
||||
let result: boolean;
|
||||
|
||||
result = _.isNull(any);
|
||||
|
||||
result = _(1).isNull();
|
||||
result = _<any>([]).isNull();
|
||||
result = _({}).isNull();
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitWrapper<boolean>;
|
||||
|
||||
result = _(1).chain().isNull();
|
||||
result = _<any>([]).chain().isNull();
|
||||
result = _({}).chain().isNull();
|
||||
}
|
||||
}
|
||||
|
||||
// _.isNumber
|
||||
result = <boolean>_.isNumber(any);
|
||||
@@ -6117,10 +6457,9 @@ module TestFindKey {
|
||||
|
||||
// _.findLastKey
|
||||
module TestFindLastKey {
|
||||
let result: string;
|
||||
|
||||
{
|
||||
let predicateFn: (value: any, key?: string, object?: {}) => boolean;
|
||||
let result: string;
|
||||
|
||||
result = _.findLastKey<{a: string;}>({a: ''});
|
||||
|
||||
@@ -6147,6 +6486,7 @@ module TestFindLastKey {
|
||||
|
||||
{
|
||||
let predicateFn: (value: string, key?: string, collection?: _.Dictionary<string>) => boolean;
|
||||
let result: string;
|
||||
|
||||
result = _.findLastKey<string, {a: string;}>({a: ''}, predicateFn);
|
||||
result = _.findLastKey<string, {a: string;}>({a: ''}, predicateFn, any);
|
||||
@@ -6154,6 +6494,30 @@ module TestFindLastKey {
|
||||
result = _<{a: string;}>({a: ''}).findLastKey<string>(predicateFn);
|
||||
result = _<{a: string;}>({a: ''}).findLastKey<string>(predicateFn, any);
|
||||
}
|
||||
|
||||
{
|
||||
let predicateFn: (value: any, key?: string, object?: {}) => boolean;
|
||||
let result: _.LoDashExplicitWrapper<string>;
|
||||
|
||||
result = _<{a: string;}>({a: ''}).chain().findLastKey();
|
||||
|
||||
result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn);
|
||||
result = _<{a: string;}>({a: ''}).chain().findLastKey(predicateFn, any);
|
||||
|
||||
|
||||
result = _<{a: string;}>({a: ''}).chain().findLastKey('');
|
||||
result = _<{a: string;}>({a: ''}).chain().findLastKey('', any);
|
||||
|
||||
result = _<{a: string;}>({a: ''}).chain().findLastKey<{a: number;}>({a: 42});
|
||||
}
|
||||
|
||||
{
|
||||
let predicateFn: (value: string, key?: string, collection?: _.Dictionary<string>) => boolean;
|
||||
let result: _.LoDashExplicitWrapper<string>;
|
||||
|
||||
result = _<{a: string;}>({a: ''}).chain().findLastKey<string>(predicateFn);
|
||||
result = _<{a: string;}>({a: ''}).chain().findLastKey<string>(predicateFn, any);
|
||||
}
|
||||
}
|
||||
|
||||
// _.forIn
|
||||
@@ -6399,12 +6763,30 @@ module TestHas {
|
||||
}
|
||||
|
||||
// _.invert
|
||||
{
|
||||
let result: TResult;
|
||||
result = _.invert<Object, TResult>({});
|
||||
result = _.invert<Object, TResult>({}, true);
|
||||
result = _({}).invert<TResult>().value();
|
||||
result = _({}).invert<TResult>(true).value();
|
||||
module TestInvert {
|
||||
{
|
||||
let result: TResult;
|
||||
|
||||
result = _.invert<Object, TResult>({});
|
||||
result = _.invert<Object, TResult>({}, true);
|
||||
|
||||
result = _.invert<TResult>({});
|
||||
result = _.invert<TResult>({}, true);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashImplicitObjectWrapper<TResult>;
|
||||
|
||||
result = _({}).invert<TResult>();
|
||||
result = _({}).invert<TResult>(true);
|
||||
}
|
||||
|
||||
{
|
||||
let result: _.LoDashExplicitObjectWrapper<TResult>;
|
||||
|
||||
result = _({}).chain().invert<TResult>();
|
||||
result = _({}).chain().invert<TResult>(true);
|
||||
}
|
||||
}
|
||||
|
||||
// _.keys
|
||||
|
||||
Vendored
+732
-281
File diff suppressed because it is too large
Load Diff
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
import Long = require("long");
|
||||
|
||||
var val: dcodeIO.Long;
|
||||
var val: Long;
|
||||
var n: number = 42;
|
||||
var b: boolean = true;
|
||||
var s: string = "1337";
|
||||
|
||||
Vendored
+340
-63
@@ -1,75 +1,352 @@
|
||||
// Type definitions for Long.js v2.2.5
|
||||
// Project: https://github.com/dcodeIO/Long.js
|
||||
// Type definitions for long.js 3.0.2
|
||||
// Project: https://github.com/dcodeIO/long.js
|
||||
// Definitions by: Peter Kooijmans <https://github.com/peterkooijmans/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
// Definitions by: Denis Cappellin <http://github.com/cappellin>
|
||||
|
||||
declare module dcodeIO {
|
||||
interface LongStatic {
|
||||
new (low: number, high?: number, unsigned?: boolean): Long;
|
||||
declare class Long
|
||||
{
|
||||
/**
|
||||
* Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as signed integers. See the from* functions below for more convenient ways of constructing Longs.
|
||||
*/
|
||||
constructor( low: number, high?: number, unsigned?: boolean );
|
||||
|
||||
MAX_UNSIGNED_VALUE: Long;
|
||||
MAX_VALUE: Long;
|
||||
MIN_VALUE: Long;
|
||||
NEG_ONE: Long;
|
||||
ONE: Long;
|
||||
UONE: Long;
|
||||
UZERO: Long;
|
||||
ZERO: Long;
|
||||
/**
|
||||
* Maximum unsigned value.
|
||||
*/
|
||||
static MAX_UNSIGNED_VALUE: Long;
|
||||
|
||||
fromBits(lowBits: number, highBits: number, unsigned?: boolean): Long;
|
||||
fromInt(value: number, unsigned?: boolean): Long;
|
||||
fromNumber(value: number, unsigned?: boolean): Long;
|
||||
fromString(str: string, unsigned?: boolean | number, radix?: number): Long;
|
||||
fromValue(val: Long | number | string): Long;
|
||||
isLong(obj: any): boolean;
|
||||
}
|
||||
/**
|
||||
* Maximum signed value.
|
||||
*/
|
||||
static MAX_VALUE: Long;
|
||||
|
||||
interface Long {
|
||||
high: number;
|
||||
low: number;
|
||||
unsigned: boolean;
|
||||
/**
|
||||
* Minimum signed value.
|
||||
*/
|
||||
static MIN_VALUE: Long;
|
||||
|
||||
add(other: Long | number | string): Long;
|
||||
and(other: Long | number | string): Long;
|
||||
compare(other: Long | number | string): number;
|
||||
div(divisor: Long | number | string): Long;
|
||||
equals(other: Long | number | string): boolean;
|
||||
getHighBits(): number;
|
||||
getHighBitsUnsigned(): number;
|
||||
getLowBits(): number;
|
||||
getLowBitsUnsigned(): number;
|
||||
getNumBitsAbs(): number;
|
||||
greaterThan(other: Long | number | string): boolean;
|
||||
greaterThanOrEqual(other: Long | number | string): boolean;
|
||||
isEven(): boolean;
|
||||
isNegative(): boolean;
|
||||
isOdd(): boolean;
|
||||
isPositive(): boolean;
|
||||
isZero(): boolean;
|
||||
lessThan(other: Long | number | string): boolean;
|
||||
lessThanOrEqual(other: Long | number | string): boolean;
|
||||
modulo(divisor: Long | number | string): Long;
|
||||
multiply(multiplier: Long | number | string): Long;
|
||||
negate(): Long;
|
||||
not(): Long;
|
||||
notEquals(other: Long | number | string): boolean;
|
||||
or(other: Long | number | string): Long;
|
||||
shiftLeft(numBits: number | Long): Long;
|
||||
shiftRight(numBits: number | Long): Long;
|
||||
shiftRightUnsigned(numBits: number | Long): Long;
|
||||
subtract(other: Long | number | string): Long;
|
||||
toInt(): number;
|
||||
toNumber(): number;
|
||||
toSigned(): Long;
|
||||
toString(radix?: number): string;
|
||||
toUnsigned(): Long;
|
||||
xor(other: Long | number | string): Long;
|
||||
}
|
||||
/**
|
||||
* Signed negative one.
|
||||
*/
|
||||
static NEG_ONE: Long;
|
||||
|
||||
export var Long: LongStatic;
|
||||
/**
|
||||
* Signed one.
|
||||
*/
|
||||
static ONE: Long;
|
||||
|
||||
/**
|
||||
* Unsigned one.
|
||||
*/
|
||||
static UONE: Long;
|
||||
|
||||
/**
|
||||
* Unsigned zero.
|
||||
*/
|
||||
static UZERO: Long;
|
||||
|
||||
/**
|
||||
* Signed zero
|
||||
*/
|
||||
static ZERO: Long;
|
||||
|
||||
/**
|
||||
* The high 32 bits as a signed value.
|
||||
*/
|
||||
high: number;
|
||||
|
||||
/**
|
||||
* The low 32 bits as a signed value.
|
||||
*/
|
||||
low: number;
|
||||
|
||||
/**
|
||||
* Whether unsigned or not.
|
||||
*/
|
||||
unsigned: boolean;
|
||||
|
||||
/**
|
||||
* Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is assumed to use 32 bits.
|
||||
*/
|
||||
static fromBits( lowBits:number, highBits:number, unsigned?:boolean ): Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given 32 bit integer value.
|
||||
*/
|
||||
static fromInt( value: number, unsigned?: boolean ): Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
|
||||
*/
|
||||
static fromNumber( value: number, unsigned?: boolean ): Long;
|
||||
|
||||
/**
|
||||
* Returns a Long representation of the given string, written using the specified radix.
|
||||
*/
|
||||
static fromString( str: string, unsigned?: boolean | number, radix?: number ): Long;
|
||||
|
||||
/**
|
||||
* Tests if the specified object is a Long.
|
||||
*/
|
||||
static isLong( obj: any ): boolean;
|
||||
|
||||
/**
|
||||
* Converts the specified value to a Long.
|
||||
*/
|
||||
static fromValue( val: Long | number | string | {low: number, high: number, unsigned: boolean} ): Long;
|
||||
|
||||
/**
|
||||
* Returns the sum of this and the specified Long.
|
||||
*/
|
||||
add( addend: number | Long | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns the bitwise AND of this Long and the specified.
|
||||
*/
|
||||
and( other: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Compares this Long's value with the specified's.
|
||||
*/
|
||||
compare( other: Long | number | string ): number;
|
||||
|
||||
/**
|
||||
* Compares this Long's value with the specified's.
|
||||
*/
|
||||
comp( other: Long | number | string ): number;
|
||||
|
||||
/**
|
||||
* Returns this Long divided by the specified.
|
||||
*/
|
||||
divide( divisor: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long divided by the specified.
|
||||
*/
|
||||
div( divisor: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals the specified's.
|
||||
*/
|
||||
equals( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals the specified's.
|
||||
*/
|
||||
eq( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Gets the high 32 bits as a signed integer.
|
||||
*/
|
||||
getHighBits(): number;
|
||||
|
||||
/**
|
||||
* Gets the high 32 bits as an unsigned integer.
|
||||
*/
|
||||
getHighBitsUnsigned(): number;
|
||||
|
||||
/**
|
||||
* Gets the low 32 bits as a signed integer.
|
||||
*/
|
||||
getLowBits(): number;
|
||||
|
||||
/**
|
||||
* Gets the low 32 bits as an unsigned integer.
|
||||
*/
|
||||
getLowBitsUnsigned(): number;
|
||||
|
||||
/**
|
||||
* Gets the number of bits needed to represent the absolute value of this Long.
|
||||
*/
|
||||
getNumBitsAbs(): number;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than the specified's.
|
||||
*/
|
||||
greaterThan( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than the specified's.
|
||||
*/
|
||||
gt( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than or equal the specified's.
|
||||
*/
|
||||
greaterThanOrEqual( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is greater than or equal the specified's.
|
||||
*/
|
||||
gte( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is even.
|
||||
*/
|
||||
isEven(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is negative.
|
||||
*/
|
||||
isNegative(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is odd.
|
||||
*/
|
||||
isOdd(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is positive.
|
||||
*/
|
||||
isPositive(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value equals zero.
|
||||
*/
|
||||
isZero(): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than the specified's.
|
||||
*/
|
||||
lessThan( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than the specified's.
|
||||
*/
|
||||
lt( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than or equal the specified's.
|
||||
*/
|
||||
lessThanOrEqual( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value is less than or equal the specified's.
|
||||
*/
|
||||
lte( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Returns this Long modulo the specified.
|
||||
*/
|
||||
modulo( other: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long modulo the specified.
|
||||
*/
|
||||
mod( other: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns the product of this and the specified Long.
|
||||
*/
|
||||
multiply( multiplier: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns the product of this and the specified Long.
|
||||
*/
|
||||
mul( multiplier: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Negates this Long's value.
|
||||
*/
|
||||
negate(): Long;
|
||||
|
||||
/**
|
||||
* Negates this Long's value.
|
||||
*/
|
||||
neg(): Long;
|
||||
|
||||
/**
|
||||
* Returns the bitwise NOT of this Long.
|
||||
*/
|
||||
not(): Long;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value differs from the specified's.
|
||||
*/
|
||||
notEquals( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Tests if this Long's value differs from the specified's.
|
||||
*/
|
||||
neq( other: Long | number | string ): boolean;
|
||||
|
||||
/**
|
||||
* Returns the bitwise OR of this Long and the specified.
|
||||
*/
|
||||
or( other: Long | number | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits shifted to the left by the given amount.
|
||||
*/
|
||||
shiftLeft( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits shifted to the left by the given amount.
|
||||
*/
|
||||
shl( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits arithmetically shifted to the right by the given amount.
|
||||
*/
|
||||
shiftRight( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits arithmetically shifted to the right by the given amount.
|
||||
*/
|
||||
shr( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits logically shifted to the right by the given amount.
|
||||
*/
|
||||
shiftRightUnsigned( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns this Long with bits logically shifted to the right by the given amount.
|
||||
*/
|
||||
shru( numBits: number | Long ): Long;
|
||||
|
||||
/**
|
||||
* Returns the difference of this and the specified Long.
|
||||
*/
|
||||
subtract( subtrahend: number | Long | string ): Long;
|
||||
|
||||
/**
|
||||
* Returns the difference of this and the specified Long.
|
||||
*/
|
||||
sub( subtrahend: number | Long |string ): Long;
|
||||
|
||||
/**
|
||||
* Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
|
||||
*/
|
||||
toInt(): number;
|
||||
|
||||
/**
|
||||
* Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
|
||||
*/
|
||||
toNumber(): number;
|
||||
|
||||
/**
|
||||
* Converts this Long to signed.
|
||||
*/
|
||||
toSigned(): Long;
|
||||
|
||||
/**
|
||||
* Converts the Long to a string written in the specified radix.
|
||||
*/
|
||||
toString( radix?: number ): string;
|
||||
|
||||
/**
|
||||
* Converts this Long to unsigned.
|
||||
*/
|
||||
toUnsigned(): Long;
|
||||
|
||||
/**
|
||||
* Returns the bitwise XOR of this Long and the given one.
|
||||
*/
|
||||
xor( other: Long | number | string ): Long;
|
||||
}
|
||||
|
||||
declare module "long" {
|
||||
var Long: dcodeIO.LongStatic;
|
||||
declare module 'long' {
|
||||
export = Long;
|
||||
}
|
||||
Vendored
+41
-8
@@ -172,6 +172,7 @@ declare namespace __MaterialUI {
|
||||
interface CardActionsProps extends React.Props<CardActions> {
|
||||
expandable?: boolean;
|
||||
showExpandableButton?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class CardActions extends React.Component<CardActionsProps, {}> {
|
||||
}
|
||||
@@ -179,6 +180,7 @@ declare namespace __MaterialUI {
|
||||
interface CardExpandableProps extends React.Props<CardExpandable> {
|
||||
onExpanding?: (isExpanded: boolean) => void;
|
||||
expanded?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class CardExpandable extends React.Component<CardExpandableProps, {}> {
|
||||
}
|
||||
@@ -302,6 +304,7 @@ declare namespace __MaterialUI {
|
||||
size?: number;
|
||||
color?: string;
|
||||
innerStyle?: React.CSSProperties;
|
||||
style?: React.CSSProperties;
|
||||
|
||||
}
|
||||
export class CircularProgress extends React.Component<CircularProgressProps, {}> {
|
||||
@@ -367,6 +370,7 @@ declare namespace __MaterialUI {
|
||||
actionFocus?: string;
|
||||
autoDetectWindowHeight?: boolean;
|
||||
autoScrollBodyContent?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
bodyStyle?: React.CSSProperties;
|
||||
contentClassName?: string;
|
||||
contentInnerStyle?: React.CSSProperties;
|
||||
@@ -518,6 +522,7 @@ declare namespace __MaterialUI {
|
||||
menuItemClassName?: string;
|
||||
menuItemClassNameSubheader?: string;
|
||||
menuItemClassNameLink?: string;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class LeftNav extends React.Component<LeftNavProps, {}> {
|
||||
}
|
||||
@@ -537,6 +542,7 @@ declare namespace __MaterialUI {
|
||||
subheader?: string;
|
||||
subheaderStyle?: React.CSSProperties;
|
||||
zDepth?: number;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class List extends React.Component<ListProps, {}> {
|
||||
}
|
||||
@@ -568,6 +574,7 @@ declare namespace __MaterialUI {
|
||||
primaryText?: React.ReactNode;
|
||||
secondaryText?: React.ReactNode;
|
||||
secondaryTextLines?: number;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class ListItem extends React.Component<ListItemProps, {}> {
|
||||
}
|
||||
@@ -593,6 +600,7 @@ declare namespace __MaterialUI {
|
||||
toggle?: boolean;
|
||||
onTouchTap?: TouchTapEventHandler;
|
||||
isDisabled?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
|
||||
// for MenuItems.Types.NESTED
|
||||
items?: MenuItemRequest[];
|
||||
@@ -609,6 +617,7 @@ declare namespace __MaterialUI {
|
||||
active?: boolean;
|
||||
onItemTap?: ItemTapEventHandler;
|
||||
menuItemStyle?: React.CSSProperties;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class Menu extends React.Component<MenuProps, {}> {
|
||||
}
|
||||
@@ -628,6 +637,7 @@ declare namespace __MaterialUI {
|
||||
onToggle?: (e: React.MouseEvent, key: number, toggled: boolean) => void;
|
||||
selected?: boolean;
|
||||
active?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class MenuItem extends React.Component<MenuItemProps, {}> {
|
||||
static Types: { LINK: string, SUBHEADER: string, NESTED: string, }
|
||||
@@ -721,6 +731,7 @@ declare namespace __MaterialUI {
|
||||
size?: number;
|
||||
status?: string;
|
||||
top: number;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class RefreshIndicator extends React.Component<RefreshIndicatorProps, {}> {
|
||||
}
|
||||
@@ -729,12 +740,14 @@ declare namespace __MaterialUI {
|
||||
interface CircleRippleProps extends React.Props<CircleRipple> {
|
||||
color?: string;
|
||||
opacity?: number;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class CircleRipple extends React.Component<CircleRippleProps, {}> {
|
||||
}
|
||||
|
||||
interface FocusRippleProps extends React.Props<FocusRipple> {
|
||||
color?: string;
|
||||
style?: React.CSSProperties;
|
||||
innerStyle?: React.CSSProperties;
|
||||
opacity?: number;
|
||||
show?: boolean;
|
||||
@@ -746,6 +759,7 @@ declare namespace __MaterialUI {
|
||||
centerRipple?: boolean;
|
||||
color?: string;
|
||||
opacity?: number;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class TouchRipple extends React.Component<TouchRippleProps, {}> {
|
||||
}
|
||||
@@ -798,6 +812,7 @@ declare namespace __MaterialUI {
|
||||
required?: boolean;
|
||||
step?: number;
|
||||
value?: number;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class Slider extends React.Component<SliderProps, {}> {
|
||||
}
|
||||
@@ -806,6 +821,7 @@ declare namespace __MaterialUI {
|
||||
color?: string;
|
||||
hoverColor?: string;
|
||||
viewBox?: string;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class SvgIcon extends React.Component<SvgIconProps, {}> {
|
||||
}
|
||||
@@ -1053,6 +1069,7 @@ declare namespace __MaterialUI {
|
||||
backgroundColor?: string;
|
||||
borderColor?: string;
|
||||
};
|
||||
isRtl: boolean;
|
||||
}
|
||||
|
||||
interface RawTheme {
|
||||
@@ -1080,7 +1097,7 @@ declare namespace __MaterialUI {
|
||||
export var Transitions: Transitions;
|
||||
|
||||
interface Typography {
|
||||
textFullBlack:string;
|
||||
textFullBlack: string;
|
||||
textDarkBlack: string;
|
||||
textLightBlack: string;
|
||||
textMinBlack: string;
|
||||
@@ -1109,6 +1126,7 @@ declare namespace __MaterialUI {
|
||||
onShow?: () => void;
|
||||
onDismiss?: () => void;
|
||||
openOnMount?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class Snackbar extends React.Component<SnackbarProps, {}> {
|
||||
}
|
||||
@@ -1119,6 +1137,7 @@ declare namespace __MaterialUI {
|
||||
value?: string;
|
||||
selected?: boolean;
|
||||
width?: string;
|
||||
style?: React.CSSProperties;
|
||||
|
||||
// Called by Tabs component
|
||||
onActive?: (tab: Tab) => void;
|
||||
@@ -1156,8 +1175,9 @@ declare namespace __MaterialUI {
|
||||
onCellHoverExit?: (row: number, column: number) => void;
|
||||
onRowHover?: (row: number) => void;
|
||||
onRowHoverExit?: (row: number) => void;
|
||||
onRowSelection?: (selectedRows: number[])=> void;
|
||||
onRowSelection?: (selectedRows: number[]) => void;
|
||||
selectable?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class Table extends React.Component<TableProps, {}> {
|
||||
}
|
||||
@@ -1172,17 +1192,19 @@ declare namespace __MaterialUI {
|
||||
onCellHoverExit?: (row: number, column: number) => void;
|
||||
onRowHover?: (row: number) => void;
|
||||
onRowHoverExit?: (row: number) => void;
|
||||
onRowSelection?: (selectedRows: number[])=> void;
|
||||
onRowSelection?: (selectedRows: number[]) => void;
|
||||
preScanRows?: boolean;
|
||||
selectable?: boolean;
|
||||
showRowHover?: boolean;
|
||||
stripedRows?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class TableBody extends React.Component<TableBodyProps, {}> {
|
||||
}
|
||||
|
||||
interface TableFooterProps extends React.Props<TableFooter> {
|
||||
adjustForCheckbox?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class TableFooter extends React.Component<TableFooterProps, {}> {
|
||||
}
|
||||
@@ -1193,15 +1215,17 @@ declare namespace __MaterialUI {
|
||||
enableSelectAll?: boolean;
|
||||
onSelectAll?: (event: React.MouseEvent) => void;
|
||||
selectAllSelected?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class TableHeader extends React.Component<TableHeaderProps, {}> {
|
||||
}
|
||||
|
||||
interface TableHeaderColumnProps extends React.Props<TableHeaderColumn> {
|
||||
columnNumber?: number;
|
||||
onClick?: (e: React.MouseEvent, column: number) => void;
|
||||
onClick?: (e: React.MouseEvent, column: number) => void;
|
||||
tooltip?: string;
|
||||
tooltipStyle?: React.CSSProperties;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class TableHeaderColumn extends React.Component<TableHeaderColumnProps, {}> {
|
||||
}
|
||||
@@ -1219,6 +1243,7 @@ declare namespace __MaterialUI {
|
||||
selectable?: boolean;
|
||||
selected?: boolean;
|
||||
striped?: boolean;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class TableRow extends React.Component<TableRowProps, {}> {
|
||||
}
|
||||
@@ -1228,6 +1253,7 @@ declare namespace __MaterialUI {
|
||||
hoverable?: boolean;
|
||||
onHover?: (e: React.MouseEvent, column: number) => void;
|
||||
onHoverExit?: (e: React.MouseEvent, column: number) => void;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class TableRowColumn extends React.Component<TableRowColumnProps, {}> {
|
||||
}
|
||||
@@ -1311,23 +1337,27 @@ declare namespace __MaterialUI {
|
||||
|
||||
namespace Toolbar {
|
||||
interface ToolbarProps extends React.Props<Toolbar> {
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class Toolbar extends React.Component<ToolbarProps, {}> {
|
||||
}
|
||||
|
||||
interface ToolbarGroupProps extends React.Props<ToolbarGroup> {
|
||||
float?: string;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class ToolbarGroup extends React.Component<ToolbarGroupProps, {}> {
|
||||
}
|
||||
|
||||
interface ToolbarSeparatorProps extends React.Props<ToolbarSeparator> {
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class ToolbarSeparator extends React.Component<ToolbarSeparatorProps, {}> {
|
||||
}
|
||||
|
||||
interface ToolbarTitleProps extends React.HTMLAttributes, React.Props<ToolbarTitle> {
|
||||
text?: string;
|
||||
text?: string;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class ToolbarTitle extends React.Component<ToolbarTitleProps, {}> {
|
||||
}
|
||||
@@ -1349,9 +1379,9 @@ declare namespace __MaterialUI {
|
||||
color: string;
|
||||
}
|
||||
interface ColorManipulator {
|
||||
fade(color: string, amount: string|number): string;
|
||||
lighten(color: string, amount: string|number): string;
|
||||
darken(color: string, amount: string|number): string;
|
||||
fade(color: string, amount: string | number): string;
|
||||
lighten(color: string, amount: string | number): string;
|
||||
darken(color: string, amount: string | number): string;
|
||||
contrastRatio(background: string, foreground: string): number;
|
||||
contrastRatioLevel(background: string, foreground: string): ContrastLevel;
|
||||
}
|
||||
@@ -1443,6 +1473,7 @@ declare namespace __MaterialUI {
|
||||
value?: string | Array<string>;
|
||||
width?: string | number;
|
||||
touchTapCloseDelay?: number;
|
||||
style?: React.CSSProperties;
|
||||
|
||||
onKeyboardFocus?: React.FocusEventHandler;
|
||||
onItemTouchTap?: (e: TouchTapEvent, item: React.ReactElement<any>) => void;
|
||||
@@ -1462,6 +1493,7 @@ declare namespace __MaterialUI {
|
||||
value?: string | Array<string>;
|
||||
width?: string | number;
|
||||
zDepth?: number;
|
||||
style?: React.CSSProperties;
|
||||
}
|
||||
export class Menu extends React.Component<MenuProps, {}>{
|
||||
}
|
||||
@@ -1477,6 +1509,7 @@ declare namespace __MaterialUI {
|
||||
rightIcon?: React.ReactElement<any>;
|
||||
secondaryText?: React.ReactNode;
|
||||
value?: string;
|
||||
style?: React.CSSProperties;
|
||||
|
||||
onEscKeyDown?: React.KeyboardEventHandler;
|
||||
onItemTouchTap?: (e: TouchTapEvent, item: React.ReactElement<any>) => void;
|
||||
|
||||
Vendored
+1
-1
@@ -616,7 +616,7 @@ declare module Mongo {
|
||||
insert(doc: T, callback?: Function): string;
|
||||
rawCollection(): any;
|
||||
rawDatabase(): any;
|
||||
remove(selector: Mongo.Selector | Mongo.ObjectID | string, callback?: Function): void;
|
||||
remove(selector: Mongo.Selector | Mongo.ObjectID | string, callback?: Function): number;
|
||||
update(selector: Mongo.Selector | Mongo.ObjectID | string, modifier: Mongo.Modifier, options?: {
|
||||
multi?: boolean;
|
||||
upsert?: boolean;
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
/// <reference path="ng-stomp.d.ts" />
|
||||
|
||||
module ngStompTesting {
|
||||
|
||||
"use strict";
|
||||
var ngStompTest = "ngStompTest";
|
||||
|
||||
class test {
|
||||
constructor(private ngstomp:ngStomp) {
|
||||
var connectHeaders ={
|
||||
"Auth": "user",
|
||||
"Accept": "lol"
|
||||
};
|
||||
|
||||
ngstomp.connect('/endpoint', connectHeaders)
|
||||
|
||||
|
||||
// frame = CONNECTED headers
|
||||
.then(function (frame) {
|
||||
|
||||
this.subscription = ngstomp.subscribe('/dest', function (payload, headers, res) {
|
||||
this.payload = payload;
|
||||
}, {
|
||||
"headers": "are awesome"
|
||||
});
|
||||
|
||||
// Unsubscribe
|
||||
this.subscription.unsubscribe();
|
||||
|
||||
// Send message
|
||||
ngstomp.send('/dest', {
|
||||
message: 'body'
|
||||
}, {
|
||||
priority: 9,
|
||||
custom: 42 //Custom Headers
|
||||
});
|
||||
|
||||
// Disconnect
|
||||
ngstomp.disconnect(function () {
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
angular.module("app").controller(ngStompTest, test);
|
||||
}
|
||||
Vendored
+36
@@ -0,0 +1,36 @@
|
||||
// Type definitions for ngStomp
|
||||
// Project: https://github.com/beevelop/ng-stomp
|
||||
// Definitions by: Lukasz Potapczuk <https://github.com/lpotapczuk>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
/// <reference path="../angularjs/angular.d.ts" />
|
||||
|
||||
|
||||
interface ngStomp {
|
||||
sock:any;
|
||||
stomp:any;
|
||||
debug:any;
|
||||
off: any;
|
||||
|
||||
setDebug:(callback:Function)=> void;
|
||||
|
||||
connect: (endpoint:string, headers?:Headers)=> angular.IHttpPromise<any>;
|
||||
|
||||
disconnect: (callback:()=>void) => angular.IHttpPromise<any>;
|
||||
|
||||
subscribe: (destination:string, callback:(payload:string, headers:Headers, res:Function)=>void, headers?:Headers, scope?:any) => any;
|
||||
|
||||
unsubscribe: () => any;
|
||||
|
||||
send: (destination:string, body:any, headers:Headers)=> any;
|
||||
|
||||
}
|
||||
|
||||
interface Headers {
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Generated
+202
-239
@@ -2,254 +2,217 @@
|
||||
"name": "DefinitelyTyped",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"assertion-error": {
|
||||
"version": "1.0.1",
|
||||
"from": "assertion-error@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.1.tgz"
|
||||
},
|
||||
"balanced-match": {
|
||||
"version": "0.3.0",
|
||||
"from": "balanced-match@>=0.3.0 <0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz"
|
||||
},
|
||||
"bluebird": {
|
||||
"version": "2.10.2",
|
||||
"from": "bluebird@>=2.10.1 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.10.2.tgz"
|
||||
},
|
||||
"brace-expansion": {
|
||||
"version": "1.1.2",
|
||||
"from": "brace-expansion@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.2.tgz"
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"from": "concat-map@0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
|
||||
},
|
||||
"core-util-is": {
|
||||
"version": "1.0.2",
|
||||
"from": "core-util-is@>=1.0.0 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz"
|
||||
},
|
||||
"definition-header": {
|
||||
"version": "0.1.0",
|
||||
"from": "definition-header@>=0.1.0 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/definition-header/-/definition-header-0.1.0.tgz"
|
||||
},
|
||||
"definition-tester": {
|
||||
"version": "0.3.0",
|
||||
"from": "definition-tester@0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/definition-tester/-/definition-tester-0.3.0.tgz"
|
||||
},
|
||||
"findup-sync": {
|
||||
"version": "0.3.0",
|
||||
"from": "findup-sync@>=0.3.0 <0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz"
|
||||
},
|
||||
"git-wrapper": {
|
||||
"version": "0.1.1",
|
||||
"from": "git-wrapper@>=0.1.1 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/git-wrapper/-/git-wrapper-0.1.1.tgz"
|
||||
},
|
||||
"glob": {
|
||||
"version": "5.0.15",
|
||||
"from": "glob@>=5.0.14 <6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz"
|
||||
},
|
||||
"hoek": {
|
||||
"version": "2.16.3",
|
||||
"from": "hoek@>=2.2.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz"
|
||||
},
|
||||
"inflight": {
|
||||
"version": "1.0.4",
|
||||
"from": "inflight@>=1.0.4 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz"
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.1",
|
||||
"from": "inherits@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
|
||||
},
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"from": "isarray@0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
|
||||
},
|
||||
"isemail": {
|
||||
"version": "1.2.0",
|
||||
"from": "isemail@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isemail/-/isemail-1.2.0.tgz"
|
||||
},
|
||||
"joi": {
|
||||
"version": "4.9.0",
|
||||
"from": "joi@>=4.0.0 <5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/joi/-/joi-4.9.0.tgz"
|
||||
},
|
||||
"joi-assert": {
|
||||
"version": "0.0.3",
|
||||
"from": "joi-assert@0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/joi-assert/-/joi-assert-0.0.3.tgz"
|
||||
},
|
||||
"jsonparse": {
|
||||
"version": "0.0.5",
|
||||
"from": "jsonparse@0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz"
|
||||
},
|
||||
"JSONStream": {
|
||||
"version": "0.8.4",
|
||||
"from": "JSONStream@>=0.8.4 <0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz"
|
||||
},
|
||||
"lazy.js": {
|
||||
"version": "0.4.2",
|
||||
"from": "lazy.js@>=0.4.2 <0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.4.2.tgz"
|
||||
},
|
||||
"manticore": {
|
||||
"version": "0.2.4",
|
||||
"from": "manticore@>=0.2.4 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/manticore/-/manticore-0.2.4.tgz",
|
||||
"dependencies": {
|
||||
"bluebird": {
|
||||
"version": "2.10.1",
|
||||
"from": "bluebird@>=2.10.1 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.10.1.tgz"
|
||||
},
|
||||
"definition-header": {
|
||||
"version": "0.1.0",
|
||||
"from": "definition-header@>=0.1.0 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/definition-header/-/definition-header-0.1.0.tgz",
|
||||
"dependencies": {
|
||||
"joi": {
|
||||
"version": "4.9.0",
|
||||
"from": "joi@>=4.0.0 <5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/joi/-/joi-4.9.0.tgz",
|
||||
"dependencies": {
|
||||
"hoek": {
|
||||
"version": "2.16.3",
|
||||
"from": "hoek@>=2.2.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz"
|
||||
},
|
||||
"topo": {
|
||||
"version": "1.0.3",
|
||||
"from": "topo@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/topo/-/topo-1.0.3.tgz"
|
||||
},
|
||||
"isemail": {
|
||||
"version": "1.2.0",
|
||||
"from": "isemail@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/isemail/-/isemail-1.2.0.tgz"
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.10.6",
|
||||
"from": "moment@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.10.6.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"joi-assert": {
|
||||
"version": "0.0.3",
|
||||
"from": "joi-assert@0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/joi-assert/-/joi-assert-0.0.3.tgz",
|
||||
"dependencies": {
|
||||
"assertion-error": {
|
||||
"version": "1.0.1",
|
||||
"from": "assertion-error@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.1.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"parsimmon": {
|
||||
"version": "0.5.1",
|
||||
"from": "parsimmon@>=0.5.0 <0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-0.5.1.tgz",
|
||||
"dependencies": {
|
||||
"pjs": {
|
||||
"version": "5.1.1",
|
||||
"from": "pjs@>=5.0.0 <6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pjs/-/pjs-5.1.1.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xregexp": {
|
||||
"version": "2.0.0",
|
||||
"from": "xregexp@>=2.0.0 <2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"findup-sync": {
|
||||
"version": "0.3.0",
|
||||
"from": "findup-sync@>=0.3.0 <0.4.0",
|
||||
"resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz"
|
||||
},
|
||||
"git-wrapper": {
|
||||
"version": "0.1.1",
|
||||
"from": "git-wrapper@>=0.1.1 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/git-wrapper/-/git-wrapper-0.1.1.tgz"
|
||||
},
|
||||
"glob": {
|
||||
"version": "5.0.14",
|
||||
"from": "glob@>=5.0.14 <6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/glob/-/glob-5.0.14.tgz",
|
||||
"dependencies": {
|
||||
"inflight": {
|
||||
"version": "1.0.4",
|
||||
"from": "inflight@>=1.0.4 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.4.tgz",
|
||||
"dependencies": {
|
||||
"wrappy": {
|
||||
"version": "1.0.1",
|
||||
"from": "wrappy@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.1",
|
||||
"from": "inherits@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "2.0.10",
|
||||
"from": "minimatch@>=2.0.1 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-2.0.10.tgz",
|
||||
"dependencies": {
|
||||
"brace-expansion": {
|
||||
"version": "1.1.0",
|
||||
"from": "brace-expansion@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.0.tgz",
|
||||
"dependencies": {
|
||||
"balanced-match": {
|
||||
"version": "0.2.0",
|
||||
"from": "balanced-match@>=0.2.0 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.2.0.tgz"
|
||||
},
|
||||
"concat-map": {
|
||||
"version": "0.0.1",
|
||||
"from": "concat-map@0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"once": {
|
||||
"version": "1.3.2",
|
||||
"from": "once@>=1.3.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.3.2.tgz",
|
||||
"dependencies": {
|
||||
"wrappy": {
|
||||
"version": "1.0.1",
|
||||
"from": "wrappy@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.0",
|
||||
"from": "path-is-absolute@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"lazy.js": {
|
||||
"version": "0.4.2",
|
||||
"from": "lazy.js@>=0.4.2 <0.5.0",
|
||||
"resolved": "https://registry.npmjs.org/lazy.js/-/lazy.js-0.4.2.tgz"
|
||||
},
|
||||
"manticore": {
|
||||
"version": "0.2.4",
|
||||
"from": "manticore@>=0.2.4 <0.3.0",
|
||||
"resolved": "https://registry.npmjs.org/manticore/-/manticore-0.2.4.tgz",
|
||||
"dependencies": {
|
||||
"JSONStream": {
|
||||
"version": "0.8.4",
|
||||
"from": "JSONStream@>=0.8.4 <0.9.0",
|
||||
"resolved": "https://registry.npmjs.org/JSONStream/-/JSONStream-0.8.4.tgz",
|
||||
"dependencies": {
|
||||
"jsonparse": {
|
||||
"version": "0.0.5",
|
||||
"from": "jsonparse@0.0.5",
|
||||
"resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz"
|
||||
},
|
||||
"through": {
|
||||
"version": "2.3.8",
|
||||
"from": "through@>=2.2.7 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"bluebird": {
|
||||
"version": "1.2.4",
|
||||
"from": "bluebird@>=1.2.4 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-1.2.4.tgz"
|
||||
},
|
||||
"through2": {
|
||||
"version": "0.5.1",
|
||||
"from": "through2@>=0.5.1 <0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz",
|
||||
"dependencies": {
|
||||
"readable-stream": {
|
||||
"version": "1.0.33",
|
||||
"from": "readable-stream@>=1.0.17 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz",
|
||||
"dependencies": {
|
||||
"core-util-is": {
|
||||
"version": "1.0.1",
|
||||
"from": "core-util-is@>=1.0.0 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
|
||||
},
|
||||
"isarray": {
|
||||
"version": "0.0.1",
|
||||
"from": "isarray@0.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"from": "string_decoder@>=0.10.0 <0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
|
||||
},
|
||||
"inherits": {
|
||||
"version": "2.0.1",
|
||||
"from": "inherits@>=2.0.1 <2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"xtend": {
|
||||
"version": "3.0.0",
|
||||
"from": "xtend@>=3.0.0 <3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"type-detect": {
|
||||
"version": "0.1.2",
|
||||
"from": "type-detect@>=0.1.2 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.2.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"optimist": {
|
||||
"version": "0.6.1",
|
||||
"from": "optimist@>=0.6.1 <0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
|
||||
"dependencies": {
|
||||
"wordwrap": {
|
||||
"version": "0.0.3",
|
||||
"from": "wordwrap@>=0.0.2 <0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz"
|
||||
},
|
||||
"minimist": {
|
||||
"version": "0.0.10",
|
||||
"from": "minimist@>=0.0.1 <0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz"
|
||||
}
|
||||
}
|
||||
"version": "1.2.4",
|
||||
"from": "bluebird@>=1.2.4 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-1.2.4.tgz"
|
||||
}
|
||||
}
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.0",
|
||||
"from": "minimatch@>=2.0.0 <3.0.0||>=3.0.0 <4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.0.tgz"
|
||||
},
|
||||
"minimist": {
|
||||
"version": "0.0.10",
|
||||
"from": "minimist@>=0.0.1 <0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz"
|
||||
},
|
||||
"moment": {
|
||||
"version": "2.10.6",
|
||||
"from": "moment@>=2.0.0 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/moment/-/moment-2.10.6.tgz"
|
||||
},
|
||||
"once": {
|
||||
"version": "1.3.3",
|
||||
"from": "once@>=1.3.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz"
|
||||
},
|
||||
"optimist": {
|
||||
"version": "0.6.1",
|
||||
"from": "optimist@>=0.6.1 <0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz"
|
||||
},
|
||||
"parsimmon": {
|
||||
"version": "0.5.1",
|
||||
"from": "parsimmon@>=0.5.0 <0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-0.5.1.tgz"
|
||||
},
|
||||
"path-is-absolute": {
|
||||
"version": "1.0.0",
|
||||
"from": "path-is-absolute@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.0.tgz"
|
||||
},
|
||||
"pjs": {
|
||||
"version": "5.1.1",
|
||||
"from": "pjs@>=5.0.0 <6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/pjs/-/pjs-5.1.1.tgz"
|
||||
},
|
||||
"readable-stream": {
|
||||
"version": "1.0.33",
|
||||
"from": "readable-stream@>=1.0.17 <1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz"
|
||||
},
|
||||
"string_decoder": {
|
||||
"version": "0.10.31",
|
||||
"from": "string_decoder@>=0.10.0 <0.11.0",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
|
||||
},
|
||||
"through": {
|
||||
"version": "2.3.8",
|
||||
"from": "through@>=2.2.7 <3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz"
|
||||
},
|
||||
"through2": {
|
||||
"version": "0.5.1",
|
||||
"from": "through2@>=0.5.1 <0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz"
|
||||
},
|
||||
"topo": {
|
||||
"version": "1.1.0",
|
||||
"from": "topo@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/topo/-/topo-1.1.0.tgz"
|
||||
},
|
||||
"type-detect": {
|
||||
"version": "0.1.2",
|
||||
"from": "type-detect@>=0.1.2 <0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.2.tgz"
|
||||
},
|
||||
"typescript": {
|
||||
"version": "1.6.2",
|
||||
"from": "typescript@1.6.2",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-1.6.2.tgz"
|
||||
"version": "1.7.3",
|
||||
"from": "typescript@1.7.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-1.7.3.tgz"
|
||||
},
|
||||
"wordwrap": {
|
||||
"version": "0.0.3",
|
||||
"from": "wordwrap@>=0.0.2 <0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz"
|
||||
},
|
||||
"wrappy": {
|
||||
"version": "1.0.1",
|
||||
"from": "wrappy@>=1.0.0 <2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz"
|
||||
},
|
||||
"xregexp": {
|
||||
"version": "2.0.0",
|
||||
"from": "xregexp@>=2.0.0 <2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz"
|
||||
},
|
||||
"xtend": {
|
||||
"version": "3.0.0",
|
||||
"from": "xtend@>=3.0.0 <3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/xtend/-/xtend-3.0.0.tgz"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
/// <reference path="p2.d.ts"/>
|
||||
|
||||
// Create a physics world, where bodies and constraints live
|
||||
var world = new p2.World({
|
||||
gravity:[0, -9.82]
|
||||
});
|
||||
|
||||
// Create an empty dynamic body
|
||||
var circleBody = new p2.Body({
|
||||
mass: 5,
|
||||
position: [0, 10]
|
||||
});
|
||||
|
||||
// Add a circle shape to the body.
|
||||
var circleShape = new p2.Circle({ radius: 1 });
|
||||
circleBody.addShape(circleShape);
|
||||
|
||||
// ...and add the body to the world.
|
||||
// If we don't add it to the world, it won't be simulated.
|
||||
world.addBody(circleBody);
|
||||
|
||||
// Create an infinite ground plane.
|
||||
var groundBody = new p2.Body({
|
||||
mass: 0 // Setting mass to 0 makes the body static
|
||||
});
|
||||
var groundShape = new p2.Plane();
|
||||
groundBody.addShape(groundShape);
|
||||
world.addBody(groundBody);
|
||||
|
||||
// To get the trajectories of the bodies,
|
||||
// we must step the world forward in time.
|
||||
// This is done using a fixed time step size.
|
||||
var timeStep = 1 / 60; // seconds
|
||||
|
||||
// The "Game loop". Could be replaced by, for example, requestAnimationFrame.
|
||||
setInterval(function(){
|
||||
|
||||
// The step method moves the bodies forward in time.
|
||||
world.step(timeStep);
|
||||
|
||||
// Print the circle position to console.
|
||||
// Could be replaced by a render call.
|
||||
console.log("Circle y position: " + circleBody.position[1]);
|
||||
|
||||
}, 1000 * timeStep);
|
||||
Vendored
+1005
File diff suppressed because it is too large
Load Diff
+12
-12
@@ -20,22 +20,22 @@
|
||||
"node": ">= 0.12.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "./node_modules/.bin/dt --changes",
|
||||
"changes": "./node_modules/.bin/dt --changes",
|
||||
"lint": "./node_modules/.bin/dt --lint",
|
||||
"tscparams": "./node_modules/.bin/dt --tscparams --no-tests --no-headers",
|
||||
"all": "./node_modules/.bin/dt",
|
||||
"dry": "./node_modules/.bin/dt --dry --changes",
|
||||
"list": "./node_modules/.bin/dt --dry --print-files --print-refmap",
|
||||
"last": "./node_modules/.bin/dt --dry --print-files --print-refmap --changes",
|
||||
"files": "./node_modules/.bin/dt --dry --print-files",
|
||||
"refmap": "./node_modules/.bin/dt --dry --print-refmap",
|
||||
"help": "./node_modules/.bin/dt -h"
|
||||
"test": "dt --changes",
|
||||
"changes": "dt --changes",
|
||||
"lint": "dt --lint",
|
||||
"tscparams": "dt --tscparams --no-tests --no-headers",
|
||||
"all": "dt",
|
||||
"dry": "dt --dry --changes",
|
||||
"list": "dt --dry --print-files --print-refmap",
|
||||
"last": "dt --dry --print-files --print-refmap --changes",
|
||||
"files": "dt --dry --print-files",
|
||||
"refmap": "dt --dry --print-refmap",
|
||||
"help": "dt -h"
|
||||
},
|
||||
"dependencies": {
|
||||
},
|
||||
"devDependencies": {
|
||||
"definition-tester": "0.3.0",
|
||||
"typescript": "1.6.2"
|
||||
"typescript": "1.7.3"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="pako.d.ts" />
|
||||
|
||||
import pako = require("pako");
|
||||
|
||||
var chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9])
|
||||
var chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]);
|
||||
|
||||
var deflate = new pako.Deflate({ level: 3});
|
||||
|
||||
deflate.push(chunk1, false);
|
||||
deflate.push(chunk2, true); // true -> last chunk
|
||||
|
||||
if (deflate.err) {
|
||||
throw new Error( deflate.err.toString() );
|
||||
}
|
||||
|
||||
console.log(deflate.result);
|
||||
Vendored
+63
@@ -0,0 +1,63 @@
|
||||
// Type definitions for pako 0.2.8
|
||||
// Project: https://github.com/nodeca/pako
|
||||
// Definitions by: Denis Cappellin <http://github.com/cappellin>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module Pako {
|
||||
|
||||
/**
|
||||
* Compress data with deflate algorithm and options.
|
||||
*/
|
||||
export function deflate( data: Uint8Array | Array<number> | string, options?: any ): string;
|
||||
/**
|
||||
* The same as deflate, but creates raw data, without wrapper (header and adler32 crc).
|
||||
*/
|
||||
export function deflateRaw( data: Uint8Array | Array<number> | string, options?: any ): string;
|
||||
/**
|
||||
* The same as deflate, but create gzip wrapper instead of deflate one.
|
||||
*/
|
||||
export function gzip( data: Uint8Array | Array<number> | string, options?: any ): string;
|
||||
/**
|
||||
* Decompress data with inflate/ungzip and options. Autodetect format via wrapper header
|
||||
* by default. That's why we don't provide separate ungzip method.
|
||||
*/
|
||||
export function inflate( data: Uint8Array | Array<number> | string, options?: any ): Uint8Array;
|
||||
export function inflate( data: Uint8Array | Array<number> | string, options?: any ): Array<number>;
|
||||
export function inflate( data: Uint8Array | Array<number> | string, options?: any ): String;
|
||||
/**
|
||||
* The same as inflate, but creates raw data, without wrapper (header and adler32 crc).
|
||||
*/
|
||||
export function inflateRaw( data: Uint8Array | Array<number> | string, options?: any ): Uint8Array;
|
||||
export function inflateRaw( data: Uint8Array | Array<number> | string, options?: any ): Array<number>;
|
||||
export function inflateRaw( data: Uint8Array | Array<number> | string, options?: any ): string;
|
||||
/**
|
||||
* Just shortcut to inflate, because it autodetects format by header.content. Done for convenience.
|
||||
*/
|
||||
export function ungzip( data: Uint8Array | Array<number> | string, options?: any ): Uint8Array;
|
||||
export function ungzip( data: Uint8Array | Array<number> | string, options?: any ): Array<number>;
|
||||
export function ungzip( data: Uint8Array | Array<number> | string, options?: any ): string;
|
||||
|
||||
export class Deflate {
|
||||
constructor( options?: any );
|
||||
err: number;
|
||||
msg: string;
|
||||
result: Uint8Array | Array<number>;
|
||||
onData( chunk: Uint8Array | Array<number> | string ): void;
|
||||
onEnd( status: number ): void;
|
||||
push( data: Uint8Array | Array<number> | ArrayBuffer | string, mode?: number | boolean ): boolean;
|
||||
}
|
||||
|
||||
export class Inflate {
|
||||
constructor( options?: any );
|
||||
err: number;
|
||||
msg: string;
|
||||
result: Uint8Array | Array<number> | string;
|
||||
onData( chunk: Uint8Array | Array<number> | string ): void;
|
||||
onEnd( status: number ): void;
|
||||
push( data: Uint8Array | Array<number> | ArrayBuffer | string, mode?: number | boolean ): boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'pako' {
|
||||
export = Pako;
|
||||
}
|
||||
@@ -206,6 +206,11 @@ declare module Q {
|
||||
* Returns a promise that is fulfilled with an array containing the fulfillment value of each promise, or is rejected with the same rejection reason as the first promise to be rejected.
|
||||
*/
|
||||
export function all<T>(promises: IPromise<T>[]): Promise<T[]>;
|
||||
|
||||
/**
|
||||
* Returns a promise for the first of an array of promises to become settled.
|
||||
*/
|
||||
export function race<T>(promises: IPromise<T>[]): Promise<T>;
|
||||
|
||||
/**
|
||||
* Returns a promise that is fulfilled with an array of promise state snapshots, but only after all the original promises have settled, i.e. become either fulfilled or rejected.
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
/// <reference path="./query-string.d.ts" />
|
||||
|
||||
import qs = require('query-string');
|
||||
|
||||
qs.stringify({ foo: 'bar' });
|
||||
qs.stringify({ foo: 'bar', bar: 'baz' });
|
||||
|
||||
qs.parse('?foo=bar');
|
||||
qs.parse('#foo=bar');
|
||||
qs.parse('&foo=bar&foo=baz');
|
||||
|
||||
qs.extract('http://foo.bar/?abc=def&hij=klm');
|
||||
qs.extract('http://foo.bar/?foo=bar');
|
||||
Vendored
+27
@@ -0,0 +1,27 @@
|
||||
// Type definitions for query-string v3.0.0
|
||||
// Project: https://github.com/sindresorhus/query-string
|
||||
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module "query-string" {
|
||||
/**
|
||||
* Parse a query string into an object.
|
||||
* Leading ? or # are ignored, so you can pass location.search or location.hash directly.
|
||||
* @param str
|
||||
*/
|
||||
export function parse(str: string): any;
|
||||
|
||||
/**
|
||||
* Stringify an object into a query string, sorting the keys.
|
||||
*
|
||||
* @param obj
|
||||
*/
|
||||
export function stringify(obj: any): string;
|
||||
|
||||
/**
|
||||
* Extract a query string from a URL that can be passed into .parse().
|
||||
*
|
||||
* @param str
|
||||
*/
|
||||
export function extract(str: string): string;
|
||||
}
|
||||
@@ -170,6 +170,30 @@ QUnit.module("module A", {
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.module("module with async setup and teardown", {
|
||||
setup: function (assert) {
|
||||
var done = assert.async();
|
||||
setTimeout(function () {
|
||||
// prepare something for all following tests
|
||||
});
|
||||
},
|
||||
teardown: function (assert) {
|
||||
// clean up after each test
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.module("module with async setup and teardown", {
|
||||
beforeEach: function (assert: QUnitAssert) {
|
||||
var done = assert.async();
|
||||
setTimeout(function () {
|
||||
// prepare something for all following tests
|
||||
});
|
||||
},
|
||||
afterEach: function () {
|
||||
// clean up after each test
|
||||
}
|
||||
});
|
||||
|
||||
QUnit.test("a test", function (assert) {
|
||||
|
||||
function square(x) {
|
||||
|
||||
Vendored
+8
-4
@@ -148,23 +148,27 @@ interface URLConfigItem {
|
||||
interface LifecycleObject {
|
||||
/**
|
||||
* Runs before each test
|
||||
* @param assert
|
||||
* @deprecated
|
||||
*/
|
||||
setup?: () => void;
|
||||
setup?: (assert: QUnitAssert) => void;
|
||||
|
||||
/**
|
||||
* Runs after each test
|
||||
* @param assert
|
||||
* @deprecated
|
||||
*/
|
||||
teardown?: () => void;
|
||||
teardown?: (assert: QUnitAssert) => void;
|
||||
/**
|
||||
* Runs before each test
|
||||
* @param assert
|
||||
*/
|
||||
beforeEach?: () => void;
|
||||
beforeEach?: (assert: QUnitAssert) => void;
|
||||
/**
|
||||
* Runs after each test
|
||||
* @param assert
|
||||
*/
|
||||
afterEach?: () => void;
|
||||
afterEach?: (assert: QUnitAssert) => void;
|
||||
|
||||
/**
|
||||
* Any additional properties on the hooks object will be added to that context.
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/// <reference path="../redis/redis.d.ts" />
|
||||
/// <reference path="./ratelimiter.d.ts" />
|
||||
|
||||
import redis = require('redis');
|
||||
import Limiter = require('ratelimiter');
|
||||
|
||||
let id: string;
|
||||
let db: redis.RedisClient;
|
||||
let limit = new Limiter({ id: id, db: db });
|
||||
|
||||
const str: string = limit.inspect();
|
||||
|
||||
limit.get((err, limit): void => {
|
||||
const total: number = limit.total;
|
||||
const remaining: number = limit.remaining;
|
||||
const reset: number = limit.reset;
|
||||
});
|
||||
Vendored
+59
@@ -0,0 +1,59 @@
|
||||
// Type definitions for ratelimiter 2.1.1
|
||||
// Project: https://github.com/tj/node-ratelimiter
|
||||
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../redis/redis.d.ts" />
|
||||
|
||||
declare module "ratelimiter" {
|
||||
import { RedisClient } from 'redis';
|
||||
|
||||
interface LimiterOption {
|
||||
/**
|
||||
* The identifier to limit against (typically a user id)
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* Redis connection instance
|
||||
*/
|
||||
db: RedisClient;
|
||||
|
||||
/**
|
||||
* Max requests within duration
|
||||
*/
|
||||
max?: number;
|
||||
|
||||
/**
|
||||
* Duration of limit in milliseconds
|
||||
*/
|
||||
duration?: number;
|
||||
}
|
||||
|
||||
interface LimiterInfo {
|
||||
/**
|
||||
* max value
|
||||
*/
|
||||
total: number;
|
||||
|
||||
/**
|
||||
* Number of calls left in current duration without decreasing current get
|
||||
*/
|
||||
remaining: number;
|
||||
|
||||
/**
|
||||
* Time in milliseconds until the end of current duration
|
||||
*/
|
||||
reset: number;
|
||||
}
|
||||
|
||||
class Limiter {
|
||||
constructor(opts: LimiterOption);
|
||||
|
||||
inspect(): string;
|
||||
|
||||
get(fn: (err: any, info: LimiterInfo) => void): void;
|
||||
}
|
||||
|
||||
export = Limiter;
|
||||
}
|
||||
@@ -3,10 +3,8 @@
|
||||
|
||||
Note: This must be compiled with the target set to ES6
|
||||
|
||||
|
||||
The content of index.io.js could be something like
|
||||
|
||||
|
||||
'use strict';
|
||||
|
||||
import { AppRegistry } from 'react-native'
|
||||
@@ -15,11 +13,7 @@ The content of index.io.js could be something like
|
||||
AppRegistry.registerComponent('MopNative', () => Welcome);
|
||||
|
||||
|
||||
|
||||
|
||||
NOTE: I (Bruno Grieder) complete these definitions as I port the UI Explorer to Typescript
|
||||
If you are in a hurry for the latest definitions, or are looking for typescript examples,
|
||||
check https://github.com/bgrieder/RNTSExplorer
|
||||
For a list of complete Typescript examples: check https://github.com/bgrieder/RNTSExplorer
|
||||
|
||||
*/
|
||||
|
||||
|
||||
Vendored
+276
-320
@@ -5,24 +5,24 @@
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// These definitions are meant to be used with the TSC compiler target set to ES6
|
||||
// USING: these definitions are meant to be used with the TSC compiler target set to ES6
|
||||
//
|
||||
// This work is based on an original work made by Bernd Paradies: https://github.com/bparadie
|
||||
// USAGE EXAMPLES: check the RNTSExplorer project at https://github.com/bgrieder/RNTSExplorer
|
||||
//
|
||||
// WARNING: this work is very much beta:
|
||||
// -it is still missing react-native definitions (see below)
|
||||
// -it re-exports the whole of react 0.14 which may not be what react-native actually does
|
||||
// CONTRIBUTING: please open pull requests and make sure that the changes do not break RNTSExplorer (they should not)
|
||||
// Do not hesitate to open a pull request against RNTSExplorer to provide an example for a case not covered by the current App
|
||||
//
|
||||
// I (Bruno Grieder) complete these definitions as I port the UI Explorer to Typescript
|
||||
// If you are in a hurry for the latest definitions, check those in https://github.com/bgrieder/RNTSExplorer
|
||||
// CREDITS: This work is based on an original work made by Bernd Paradies: https://github.com/bparadie
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
/// <reference path="../react/react.d.ts" />
|
||||
|
||||
//so we know what is "original" React
|
||||
import React = __React;
|
||||
|
||||
declare namespace ReactNative {
|
||||
//react-native "extends" react
|
||||
declare namespace __React {
|
||||
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ declare namespace ReactNative {
|
||||
|
||||
|
||||
// not in lib.es6.d.ts but called by react-native
|
||||
done(callback?: (value: T) => void): void;
|
||||
done( callback?: ( value: T ) => void ): void;
|
||||
}
|
||||
|
||||
export interface PromiseConstructor {
|
||||
@@ -121,6 +121,7 @@ declare namespace ReactNative {
|
||||
// @see lib.es6.d.ts
|
||||
export var Promise: PromiseConstructor;
|
||||
|
||||
//TODO: BGR: Replace with ComponentClass ?
|
||||
// node_modules/react-tools/src/classic/class/ReactClass.js
|
||||
export interface ReactClass<D, P, S> {
|
||||
// TODO:
|
||||
@@ -135,6 +136,73 @@ declare namespace ReactNative {
|
||||
export type Runnable = ( appParameters: any ) => void;
|
||||
|
||||
|
||||
// Similar to React.SyntheticEvent except for nativeEvent
|
||||
interface NativeSyntheticEvent<T> {
|
||||
bubbles: boolean
|
||||
cancelable: boolean
|
||||
currentTarget: EventTarget
|
||||
defaultPrevented: boolean
|
||||
eventPhase: number
|
||||
isTrusted: boolean
|
||||
nativeEvent: T
|
||||
preventDefault(): void
|
||||
stopPropagation(): void
|
||||
target: EventTarget
|
||||
timeStamp: Date
|
||||
type: string
|
||||
}
|
||||
|
||||
export interface NativeTouchEvent {
|
||||
/**
|
||||
* Array of all touch events that have changed since the last event
|
||||
*/
|
||||
changedTouches: NativeTouchEvent[]
|
||||
|
||||
/**
|
||||
* The ID of the touch
|
||||
*/
|
||||
identifier: string
|
||||
|
||||
/**
|
||||
* The X position of the touch, relative to the element
|
||||
*/
|
||||
locationX: number
|
||||
|
||||
/**
|
||||
* The Y position of the touch, relative to the element
|
||||
*/
|
||||
locationY: number
|
||||
|
||||
/**
|
||||
* The X position of the touch, relative to the screen
|
||||
*/
|
||||
pageX: number
|
||||
|
||||
/**
|
||||
* The Y position of the touch, relative to the screen
|
||||
*/
|
||||
pageY: number
|
||||
|
||||
/**
|
||||
* The node id of the element receiving the touch event
|
||||
*/
|
||||
target: string
|
||||
|
||||
/**
|
||||
* A time identifier for the touch, useful for velocity calculation
|
||||
*/
|
||||
timestamp: number
|
||||
|
||||
/**
|
||||
* Array of all current touches on the screen
|
||||
*/
|
||||
touches : NativeTouchEvent[]
|
||||
}
|
||||
|
||||
export interface GestureResponderEvent extends NativeSyntheticEvent<NativeTouchEvent> {
|
||||
}
|
||||
|
||||
|
||||
export interface PointProperties {
|
||||
x: number
|
||||
y: number
|
||||
@@ -147,8 +215,23 @@ declare namespace ReactNative {
|
||||
right?: number
|
||||
}
|
||||
|
||||
/**
|
||||
* //FIXME: need to find documentation on which compoenent is a native (i.e. non composite component)
|
||||
*/
|
||||
export interface NativeComponent {
|
||||
setNativeProps: (props: Object) => void
|
||||
setNativeProps: ( props: Object ) => void
|
||||
}
|
||||
|
||||
/**
|
||||
* //FIXME: need to find documentation on which component is a TTouchable and can implement that interface
|
||||
* @see React.DOMAtributes
|
||||
*/
|
||||
export interface Touchable {
|
||||
onTouchStart?: ( event: GestureResponderEvent ) => void
|
||||
onTouchMove?: ( event: GestureResponderEvent ) => void
|
||||
onTouchEnd?: ( event: GestureResponderEvent ) => void
|
||||
onTouchCancel?: ( event: GestureResponderEvent ) => void
|
||||
onTouchEndCapture?: ( event: GestureResponderEvent ) => void
|
||||
}
|
||||
|
||||
export type AppConfig = {
|
||||
@@ -583,55 +666,6 @@ declare namespace ReactNative {
|
||||
}
|
||||
|
||||
|
||||
export interface GestureResponderEvent {
|
||||
nativeEvent : {
|
||||
/**
|
||||
* Array of all touch events that have changed since the last event
|
||||
*/
|
||||
changedTouches: any[]
|
||||
|
||||
/**
|
||||
* The ID of the touch
|
||||
*/
|
||||
identifier: string
|
||||
|
||||
/**
|
||||
* The X position of the touch, relative to the element
|
||||
*/
|
||||
locationX: number
|
||||
|
||||
/**
|
||||
* The Y position of the touch, relative to the element
|
||||
*/
|
||||
locationY: number
|
||||
|
||||
/**
|
||||
* The X position of the touch, relative to the screen
|
||||
*/
|
||||
pageX: number
|
||||
|
||||
/**
|
||||
* The Y position of the touch, relative to the screen
|
||||
*/
|
||||
pageY: number
|
||||
|
||||
/**
|
||||
* The node id of the element receiving the touch event
|
||||
*/
|
||||
target: string
|
||||
|
||||
/**
|
||||
* A time identifier for the touch, useful for velocity calculation
|
||||
*/
|
||||
timestamp: number
|
||||
|
||||
/**
|
||||
* Array of all current touches on the screen
|
||||
*/
|
||||
touches : any[]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gesture recognition on mobile devices is much more complicated than web.
|
||||
* A touch can go through several phases as the app determines what the user's intention is.
|
||||
@@ -667,12 +701,12 @@ declare namespace ReactNative {
|
||||
/**
|
||||
* Does this view want to become responder on the start of a touch?
|
||||
*/
|
||||
onStartShouldSetResponder?: (event: GestureResponderEvent) => boolean
|
||||
onStartShouldSetResponder?: ( event: GestureResponderEvent ) => boolean
|
||||
|
||||
/**
|
||||
* Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness?
|
||||
*/
|
||||
onMoveShouldSetResponder?: (event: GestureResponderEvent) => boolean
|
||||
onMoveShouldSetResponder?: ( event: GestureResponderEvent ) => boolean
|
||||
|
||||
/**
|
||||
* If the View returns true and attempts to become the responder, one of the following will happen:
|
||||
@@ -682,12 +716,12 @@ declare namespace ReactNative {
|
||||
* The View is now responding for touch events.
|
||||
* This is the time to highlight and show the user what is happening
|
||||
*/
|
||||
onResponderGrant?: (event: GestureResponderEvent) => void
|
||||
onResponderGrant?: ( event: GestureResponderEvent ) => void
|
||||
|
||||
/**
|
||||
* Something else is the responder right now and will not release it
|
||||
*/
|
||||
onResponderReject?: (event: GestureResponderEvent) => void
|
||||
onResponderReject?: ( event: GestureResponderEvent ) => void
|
||||
|
||||
/**
|
||||
* If the view is responding, the following handlers can be called:
|
||||
@@ -696,25 +730,25 @@ declare namespace ReactNative {
|
||||
/**
|
||||
* The user is moving their finger
|
||||
*/
|
||||
onResponderMove?: (event: GestureResponderEvent) => void
|
||||
onResponderMove?: ( event: GestureResponderEvent ) => void
|
||||
|
||||
/**
|
||||
* Fired at the end of the touch, ie "touchUp"
|
||||
*/
|
||||
onResponderRelease?: (event: GestureResponderEvent) => void
|
||||
onResponderRelease?: ( event: GestureResponderEvent ) => void
|
||||
|
||||
/**
|
||||
* Something else wants to become responder.
|
||||
* Should this view release the responder? Returning true allows release
|
||||
*/
|
||||
onResponderTerminationRequest?: (event: GestureResponderEvent) => boolean
|
||||
onResponderTerminationRequest?: ( event: GestureResponderEvent ) => boolean
|
||||
|
||||
/**
|
||||
* The responder has been taken from the View.
|
||||
* Might be taken by other views after a call to onResponderTerminationRequest,
|
||||
* or might be taken by the OS without asking (happens with control center/ notification center on iOS)
|
||||
*/
|
||||
onResponderTerminate?: (event: GestureResponderEvent) => void
|
||||
onResponderTerminate?: ( event: GestureResponderEvent ) => void
|
||||
|
||||
/**
|
||||
* onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
|
||||
@@ -729,7 +763,7 @@ declare namespace ReactNative {
|
||||
* So if a parent View wants to prevent the child from becoming responder on a touch start,
|
||||
* it should have a onStartShouldSetResponderCapture handler which returns true.
|
||||
*/
|
||||
onStartShouldSetResponderCapture?: (event: GestureResponderEvent) => boolean
|
||||
onStartShouldSetResponderCapture?: ( event: GestureResponderEvent ) => boolean
|
||||
|
||||
/**
|
||||
* onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
|
||||
@@ -864,7 +898,7 @@ declare namespace ReactNative {
|
||||
/**
|
||||
* @see https://facebook.github.io/react-native/docs/view.html#props
|
||||
*/
|
||||
export interface ViewProperties extends ViewPropertiesAndroid, ViewPropertiesIOS, GestureResponderHandlers, React.Props<ViewStatic> {
|
||||
export interface ViewProperties extends ViewPropertiesAndroid, ViewPropertiesIOS, GestureResponderHandlers, Touchable, React.Props<ViewStatic> {
|
||||
|
||||
/**
|
||||
* Overrides the text that's read by the screen reader when the user interacts with the element. By default, the label is constructed by traversing all the children and accumulating all the Text nodes separated by space.
|
||||
@@ -1680,7 +1714,7 @@ declare namespace ReactNative {
|
||||
showsPointsOfInterest?: boolean
|
||||
}
|
||||
|
||||
export interface MapViewProperties extends MapViewPropertiesIOS, React.Props<MapViewStatic> {
|
||||
export interface MapViewProperties extends MapViewPropertiesIOS, Touchable, React.Props<MapViewStatic> {
|
||||
|
||||
/**
|
||||
* Map annotations with title/subtitle.
|
||||
@@ -2423,7 +2457,6 @@ declare namespace ReactNative {
|
||||
}
|
||||
|
||||
|
||||
|
||||
export interface PixelRatioStatic {
|
||||
get(): number;
|
||||
}
|
||||
@@ -2632,7 +2665,7 @@ declare namespace ReactNative {
|
||||
zoomScale?: number
|
||||
}
|
||||
|
||||
export interface ScrollViewProperties extends ScrollViewIOSProperties {
|
||||
export interface ScrollViewProperties extends ScrollViewIOSProperties, Touchable {
|
||||
|
||||
/**
|
||||
* These styles will be applied to the scroll view content container which
|
||||
@@ -2962,13 +2995,13 @@ declare namespace ReactNative {
|
||||
* eventName is expected to be `change`
|
||||
* //FIXME: No doc - inferred from NetInfo.js
|
||||
*/
|
||||
addEventListener: (eventName: string, listener: (result: T) => void) => void
|
||||
addEventListener: ( eventName: string, listener: ( result: T ) => void ) => void
|
||||
|
||||
/**
|
||||
* eventName is expected to be `change`
|
||||
* //FIXME: No doc - inferred from NetInfo.js
|
||||
*/
|
||||
removeEventListener: (eventName: string, listener: (result: T) => void) => void
|
||||
removeEventListener: ( eventName: string, listener: ( result: T ) => void ) => void
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2996,30 +3029,6 @@ declare namespace ReactNative {
|
||||
isConnectionMetered: any
|
||||
}
|
||||
|
||||
/**
|
||||
* //FIXME: Documentation ?
|
||||
*/
|
||||
export interface PanResponderEvent {
|
||||
|
||||
bubbles: boolean
|
||||
cancelable: boolean
|
||||
currentTarget: number
|
||||
defaultPrevented: boolean
|
||||
dispatchConfig: any
|
||||
dispatchMarker: any
|
||||
eventPhase: any
|
||||
isDefaultPrevented: () => boolean
|
||||
isPropagationStopped: () => boolean
|
||||
isTrusted: boolean
|
||||
nativeEvent: GestureResponderEvent
|
||||
path: any
|
||||
target: number
|
||||
timeStamp: number
|
||||
touchHistory: any[]
|
||||
type: any
|
||||
|
||||
}
|
||||
|
||||
|
||||
export interface PanResponderGestureState {
|
||||
|
||||
@@ -3083,19 +3092,19 @@ declare namespace ReactNative {
|
||||
* @see documentation of GestureResponderHandlers
|
||||
*/
|
||||
export interface PanResponderCallbacks {
|
||||
onMoveShouldSetPanResponder?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean
|
||||
onStartShouldSetPanResponder?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderGrant?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderMove?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderRelease?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderTerminate?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onMoveShouldSetPanResponder?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean
|
||||
onStartShouldSetPanResponder?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderGrant?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderMove?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderRelease?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderTerminate?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
|
||||
onMoveShouldSetPanResponderCapture?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean
|
||||
onStartShouldSetPanResponderCapture?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean
|
||||
onPanResponderReject?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderStart?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderEnd?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderTerminationRequest?: ( e: PanResponderEvent, gestureState: PanResponderGestureState ) => boolean
|
||||
onMoveShouldSetPanResponderCapture?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean
|
||||
onStartShouldSetPanResponderCapture?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean
|
||||
onPanResponderReject?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderStart?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderEnd?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => void
|
||||
onPanResponderTerminationRequest?: ( e: GestureResponderEvent, gestureState: PanResponderGestureState ) => boolean
|
||||
}
|
||||
|
||||
export interface PanResponderInstance {
|
||||
@@ -3145,7 +3154,143 @@ declare namespace ReactNative {
|
||||
create( config: PanResponderCallbacks ): PanResponderInstance
|
||||
}
|
||||
|
||||
export interface PushNotificationPermissions {
|
||||
alert?: boolean
|
||||
badge?: boolean
|
||||
sound?: boolean
|
||||
}
|
||||
|
||||
export interface PushNotification {
|
||||
|
||||
|
||||
/**
|
||||
* An alias for `getAlert` to get the notification's main message string
|
||||
*/
|
||||
getMessage(): string | Object
|
||||
|
||||
/**
|
||||
* Gets the sound string from the `aps` object
|
||||
*/
|
||||
getSound(): string
|
||||
|
||||
/**
|
||||
* Gets the notification's main message from the `aps` object
|
||||
*/
|
||||
getAlert(): string | Object
|
||||
|
||||
/**
|
||||
* Gets the badge count number from the `aps` object
|
||||
*/
|
||||
getBadgeCount(): number
|
||||
|
||||
/**
|
||||
* Gets the data object on the notif
|
||||
*/
|
||||
getData(): Object
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle push notifications for your app, including permission handling and icon badge number.
|
||||
* @see https://facebook.github.io/react-native/docs/pushnotificationios.html#content
|
||||
*
|
||||
* //FIXME: BGR: The documentation seems completely off compared to the actual js implementation. I could never get the example to run
|
||||
*/
|
||||
export interface PushNotificationIOSStatic {
|
||||
|
||||
/**
|
||||
* Sets the badge number for the app icon on the home screen
|
||||
*/
|
||||
setApplicationIconBadgeNumber( number: number ): void
|
||||
|
||||
/**
|
||||
* Gets the current badge number for the app icon on the home screen
|
||||
*/
|
||||
getApplicationIconBadgeNumber( callback: ( badge: number ) => void ): void
|
||||
|
||||
/**
|
||||
* Attaches a listener to remote notifications while the app is running in the
|
||||
* foreground or the background.
|
||||
*
|
||||
* The handler will get be invoked with an instance of `PushNotificationIOS`
|
||||
*
|
||||
* The type MUST be 'notification'
|
||||
*/
|
||||
addEventListener( type: string, handler: ( notification: PushNotification ) => void ):void
|
||||
|
||||
/**
|
||||
* Requests all notification permissions from iOS, prompting the user's
|
||||
* dialog box.
|
||||
*/
|
||||
requestPermissions(): void
|
||||
|
||||
/**
|
||||
* See what push permissions are currently enabled. `callback` will be
|
||||
* invoked with a `permissions` object:
|
||||
*
|
||||
* - `alert` :boolean
|
||||
* - `badge` :boolean
|
||||
* - `sound` :boolean
|
||||
*/
|
||||
checkPermissions( callback: ( permissions: PushNotificationPermissions ) => void ): void
|
||||
|
||||
/**
|
||||
* Removes the event listener. Do this in `componentWillUnmount` to prevent
|
||||
* memory leaks
|
||||
*/
|
||||
removeEventListener( type: string, handler: ( notification: PushNotification ) => void ): void
|
||||
|
||||
/**
|
||||
* An initial notification will be available if the app was cold-launched
|
||||
* from a notification.
|
||||
*
|
||||
* The first caller of `popInitialNotification` will get the initial
|
||||
* notification object, or `null`. Subsequent invocations will return null.
|
||||
*/
|
||||
popInitialNotification(): PushNotification
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @enum('default', 'light-content')
|
||||
*/
|
||||
export type StatusBarStyle = string
|
||||
|
||||
/**
|
||||
* @enum('none','fade', 'slide')
|
||||
*/
|
||||
type StatusBarAnimation = string
|
||||
|
||||
|
||||
/**
|
||||
* //FIXME: No documentation is available (although this is self explanatory)
|
||||
*
|
||||
* @see https://facebook.github.io/react-native/docs/statusbarios.html#content
|
||||
*/
|
||||
export interface StatusBarIOSStatic {
|
||||
|
||||
setStyle(style: StatusBarStyle, animated?: boolean): void
|
||||
|
||||
setHidden(hidden: boolean, animation?: StatusBarAnimation): void
|
||||
|
||||
setNetworkActivityIndicatorVisible(visible: boolean): void
|
||||
}
|
||||
|
||||
/**
|
||||
* The Vibration API is exposed at VibrationIOS.vibrate().
|
||||
* On iOS, calling this function will trigger a one second vibration.
|
||||
* The vibration is asynchronous so this method will return immediately.
|
||||
*
|
||||
* There will be no effect on devices that do not support Vibration, eg. the iOS simulator.
|
||||
*
|
||||
* Vibration patterns are currently unsupported.
|
||||
*
|
||||
* @see https://facebook.github.io/react-native/docs/vibrationios.html#content
|
||||
*/
|
||||
export interface VibrationIOSStatic {
|
||||
vibrate(): void
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
@@ -3248,6 +3393,20 @@ declare namespace ReactNative {
|
||||
export var PanResponder: PanResponderStatic
|
||||
export type PanResponder = PanResponderStatic
|
||||
|
||||
export var PushNotificationIOS: PushNotificationIOSStatic
|
||||
export type PushNotificationIOS = PushNotificationIOSStatic
|
||||
|
||||
export var StatusBarIOS: StatusBarIOSStatic
|
||||
export type StatusBarIOS = StatusBarIOSStatic
|
||||
|
||||
export var VibrationIOS: VibrationIOSStatic
|
||||
export type VibrationIOS = VibrationIOSStatic
|
||||
|
||||
|
||||
//
|
||||
// /TODO: BGR: These are leftovers of the initial port that must be revisited
|
||||
//
|
||||
|
||||
export var SegmentedControlIOS: React.ComponentClass<SegmentedControlIOSProperties>
|
||||
|
||||
export var PixelRatio: PixelRatioStatic
|
||||
@@ -3256,216 +3415,11 @@ declare namespace ReactNative {
|
||||
export type DeviceEventSubscription = DeviceEventSubscriptionStatic
|
||||
export var InteractionManager: InteractionManagerStatic
|
||||
|
||||
|
||||
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// R E A C T - 0 . 1 4
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
export type ReactType = React.ReactType;
|
||||
|
||||
export interface ReactElement<P> extends React.ReactElement<P> {}
|
||||
|
||||
export interface ClassicElement<P> extends React.ClassicElement<P> {}
|
||||
|
||||
export interface DOMElement<P> extends React.DOMElement<P> {}
|
||||
|
||||
export type HTMLElement =React.ReactHTMLElement;
|
||||
export type SVGElement = React.ReactSVGElement;
|
||||
|
||||
//
|
||||
// Factories
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export interface Factory<P> extends React.Factory<P> {}
|
||||
|
||||
export interface ClassicFactory<P> extends React.ClassicFactory<P> {}
|
||||
|
||||
export interface DOMFactory<P> extends React.DOMFactory<P> {}
|
||||
|
||||
export type HTMLFactory = React.HTMLFactory;
|
||||
export type SVGFactory = React.SVGFactory;
|
||||
|
||||
//
|
||||
// React Nodes
|
||||
// http://facebook.github.io/react/docs/glossary.html
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export type ReactText = React.ReactText;
|
||||
export type ReactChild = React.ReactChild;
|
||||
|
||||
// Should be Array<ReactNode> but type aliases cannot be recursive
|
||||
export type ReactFragment = React.ReactFragment;
|
||||
export type ReactNode = React.ReactNode;
|
||||
|
||||
//
|
||||
// Top Level API
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export function createClass<P, S>( spec: React.ComponentSpec<P, S> ): React.ClassicComponentClass<P>;
|
||||
|
||||
export function createFactory<P>( type: string ): React.DOMFactory<P>;
|
||||
export function createFactory<P>( type: React.ClassicComponentClass<P> | string ): React.ClassicFactory<P>;
|
||||
export function createFactory<P>( type: React.ComponentClass<P> ): React.Factory<P>;
|
||||
|
||||
export function createElement<P>( type: string,
|
||||
props?: P,
|
||||
...children: React.ReactNode[] ): React.DOMElement<P>;
|
||||
export function createElement<P>( type: React.ClassicComponentClass<P> | string,
|
||||
props?: P,
|
||||
...children: React.ReactNode[] ): React.ClassicElement<P>;
|
||||
export function createElement<P>( type: React.ComponentClass<P>,
|
||||
props?: P,
|
||||
...children: React.ReactNode[] ): React.ReactElement<P>;
|
||||
|
||||
export function cloneElement<P>( element: React.DOMElement<P>,
|
||||
props?: P,
|
||||
...children: React.ReactNode[] ): React.DOMElement<P>;
|
||||
export function cloneElement<P>( element: React.ClassicElement<P>,
|
||||
props?: P,
|
||||
...children: React.ReactNode[] ): React.ClassicElement<P>;
|
||||
export function cloneElement<P>( element: React.ReactElement<P>,
|
||||
props?: P,
|
||||
...children: React.ReactNode[] ): React.ReactElement<P>;
|
||||
|
||||
export function isValidElement( object: {} ): boolean;
|
||||
|
||||
export var DOM: React.ReactDOM;
|
||||
export var PropTypes: React.ReactPropTypes;
|
||||
export var Children: React.ReactChildren;
|
||||
|
||||
//
|
||||
// Component API
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Base component for plain JS classes
|
||||
export class Component<P, S> extends React.Component<P,S> {}
|
||||
|
||||
export interface ClassicComponent<P, S> extends React.ClassicComponent<P,S> {}
|
||||
|
||||
export interface DOMComponent<P> extends ClassicComponent<P, any> {
|
||||
tagName: string;
|
||||
}
|
||||
|
||||
export interface ChildContextProvider<CC> extends React.ChildContextProvider<CC> {}
|
||||
|
||||
//
|
||||
// Class Interfaces
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export interface ComponentClass<P> extends React.ComponentClass<P> {}
|
||||
|
||||
export interface ClassicComponentClass<P> extends React.ClassicComponentClass<P> {}
|
||||
|
||||
//
|
||||
// Component Specs and Lifecycle
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export interface ComponentLifecycle<P, S> extends React.ComponentLifecycle<P,S> {}
|
||||
|
||||
export interface Mixin<P, S> extends React.Mixin<P,S> {}
|
||||
|
||||
export interface ComponentSpec<P, S> extends React.ComponentSpec<P,S> {}
|
||||
|
||||
//
|
||||
// Event System
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export interface SyntheticEvent extends React.SyntheticEvent {}
|
||||
|
||||
export interface DragEvent extends React.DragEvent {}
|
||||
|
||||
export interface ClipboardEvent extends React.ClipboardEvent {}
|
||||
|
||||
export interface KeyboardEvent extends React.KeyboardEvent {}
|
||||
|
||||
|
||||
export interface FocusEvent extends React.FocusEvent {}
|
||||
|
||||
export interface FormEvent extends React.FormEvent {}
|
||||
|
||||
export interface MouseEvent extends React.MouseEvent {}
|
||||
|
||||
export interface TouchEvent extends React.TouchEvent {}
|
||||
|
||||
export interface UIEvent extends React.UIEvent {}
|
||||
|
||||
export interface WheelEvent extends React.WheelEvent {}
|
||||
|
||||
//
|
||||
// Event Handler Types
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export interface EventHandler<E extends React.SyntheticEvent> extends React.EventHandler<E> {}
|
||||
|
||||
export interface DragEventHandler extends React.DragEventHandler {}
|
||||
export interface ClipboardEventHandler extends React.ClipboardEventHandler {}
|
||||
export interface KeyboardEventHandler extends React.KeyboardEventHandler {}
|
||||
export interface FocusEventHandler extends React.FocusEventHandler {}
|
||||
export interface FormEventHandler extends React.FormEventHandler {}
|
||||
export interface MouseEventHandler extends React.MouseEventHandler {}
|
||||
export interface TouchEventHandler extends React.TouchEventHandler {}
|
||||
export interface UIEventHandler extends React.UIEventHandler {}
|
||||
export interface WheelEventHandler extends React.WheelEventHandler {}
|
||||
|
||||
//
|
||||
// Props / DOM Attributes
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export interface Props<T> extends React.Props<T> {}
|
||||
|
||||
export interface DOMAttributes extends React.DOMAttributes {}
|
||||
|
||||
// This interface is not complete. Only properties accepting
|
||||
// unitless numbers are listed here (see CSSProperty.js in React)
|
||||
export interface CSSProperties extends React.CSSProperties {}
|
||||
|
||||
export interface HTMLAttributes extends React.HTMLAttributes {}
|
||||
|
||||
export interface SVGAttributes extends React.SVGAttributes {}
|
||||
|
||||
//
|
||||
// React.DOM
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export interface ReactDOM extends React.ReactDOM {}
|
||||
|
||||
//
|
||||
// React.PropTypes
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export interface Validator<T> extends React.Validator<T> {}
|
||||
|
||||
export interface Requireable<T> extends React.Requireable<T> {}
|
||||
|
||||
export interface ValidationMap<T> extends React.ValidationMap<T> {}
|
||||
|
||||
export interface ReactPropTypes extends React.ReactPropTypes {}
|
||||
|
||||
//
|
||||
// React.Children
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export interface ReactChildren extends React.ReactChildren {}
|
||||
|
||||
//
|
||||
// Browser Interfaces
|
||||
// https://github.com/nikeee/2048-typescript/blob/master/2048/js/touch.d.ts
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export interface AbstractView extends React.AbstractView {}
|
||||
|
||||
export interface Touch extends React.Touch {}
|
||||
|
||||
export interface TouchList extends React.TouchList {}
|
||||
|
||||
//
|
||||
// Additional ( and controversial)
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
||||
export function __spread( target: any, ...sources: any[] ): any;
|
||||
|
||||
@@ -3504,10 +3458,16 @@ declare namespace ReactNative {
|
||||
|
||||
declare module "react-native" {
|
||||
|
||||
import ReactNative = __React
|
||||
export default ReactNative
|
||||
}
|
||||
|
||||
declare var global: __React.GlobalStatic
|
||||
|
||||
declare function require( name: string ): any
|
||||
|
||||
|
||||
//TODO: BGR: this is a left-over from the initial port. Not sure it makes any sense
|
||||
declare module "Dimensions" {
|
||||
import React from 'react-native';
|
||||
|
||||
@@ -3518,7 +3478,3 @@ declare module "Dimensions" {
|
||||
var ExportDimensions: Dimensions;
|
||||
export = ExportDimensions;
|
||||
}
|
||||
|
||||
declare var global: ReactNative.GlobalStatic
|
||||
|
||||
declare function require( name: string ): any
|
||||
|
||||
Vendored
+27
@@ -310,6 +310,11 @@ declare module "react-router/lib/useRoutes" {
|
||||
|
||||
}
|
||||
|
||||
declare module "react-router/lib/PatternUtils" {
|
||||
|
||||
export function formatPattern(pattern: string, params: {}): string;
|
||||
|
||||
}
|
||||
|
||||
declare module "react-router/lib/RouteUtils" {
|
||||
|
||||
@@ -396,12 +401,33 @@ declare module "react-router" {
|
||||
|
||||
import { createRoutes } from "react-router/lib/RouteUtils"
|
||||
|
||||
import { formatPattern } from "react-router/lib/PatternUtils"
|
||||
|
||||
import RoutingContext from "react-router/lib/RoutingContext"
|
||||
|
||||
import PropTypes from "react-router/lib/PropTypes"
|
||||
|
||||
import match from "react-router/lib/match"
|
||||
|
||||
// PlainRoute is defined in the API documented at:
|
||||
// https://github.com/rackt/react-router/blob/master/docs/API.md
|
||||
// but not included in any of the .../lib modules above.
|
||||
export type PlainRoute = ReactRouter.PlainRoute
|
||||
|
||||
// The following definitions are also very useful to export
|
||||
// because by using these types lots of potential type errors
|
||||
// can be exposed:
|
||||
export type EnterHook = ReactRouter.EnterHook
|
||||
export type LeaveHook = ReactRouter.LeaveHook
|
||||
export type ParseQueryString = ReactRouter.ParseQueryString
|
||||
export type RedirectFunction = ReactRouter.RedirectFunction
|
||||
export type RouteComponentProps<P,R> = ReactRouter.RouteComponentProps<P,R>;
|
||||
export type RouteHook = ReactRouter.RouteHook
|
||||
export type StringifyQuery = ReactRouter.StringifyQuery
|
||||
export type RouterListener = ReactRouter.RouterListener
|
||||
export type RouterState = ReactRouter.RouterState
|
||||
export type HistoryBase = ReactRouter.HistoryBase
|
||||
|
||||
export {
|
||||
Router,
|
||||
Link,
|
||||
@@ -415,6 +441,7 @@ declare module "react-router" {
|
||||
RouteContext,
|
||||
useRoutes,
|
||||
createRoutes,
|
||||
formatPattern,
|
||||
RoutingContext,
|
||||
PropTypes,
|
||||
match
|
||||
|
||||
@@ -50,7 +50,7 @@ myApp.config((RestangularProvider: restangular.IProvider) => {
|
||||
});
|
||||
|
||||
|
||||
interface MyAppScope extends ng.IScope {
|
||||
interface MyAppScope extends angular.IScope {
|
||||
accounts: string[];
|
||||
allAccounts: any[];
|
||||
account: any;
|
||||
|
||||
Vendored
+10
-21
@@ -16,30 +16,19 @@ declare module 'restangular' {
|
||||
|
||||
declare module restangular {
|
||||
|
||||
interface IPromise<T> extends ng.IPromise<T> {
|
||||
interface IPromise<T> extends angular.IPromise<T> {
|
||||
call(methodName: string, params?: any): IPromise<T>;
|
||||
get(fieldName: string): IPromise<T>;
|
||||
$object: T;
|
||||
}
|
||||
|
||||
interface ICollectionPromise<T> extends ng.IPromise<T[]> {
|
||||
interface ICollectionPromise<T> extends angular.IPromise<T[]> {
|
||||
push(object: any): ICollectionPromise<T>;
|
||||
call(methodName: string, params?: any): ICollectionPromise<T>;
|
||||
get(fieldName: string): ICollectionPromise<T>;
|
||||
$object: T[];
|
||||
}
|
||||
|
||||
interface IRequestConfig {
|
||||
params?: any;
|
||||
headers?: any;
|
||||
cache?: any;
|
||||
withCredentials?: boolean;
|
||||
data?: any;
|
||||
transformRequest?: any;
|
||||
transformResponse?: any;
|
||||
timeout?: any; // number | promise
|
||||
}
|
||||
|
||||
interface IResponse {
|
||||
status: number;
|
||||
data: any;
|
||||
@@ -60,14 +49,14 @@ declare module restangular {
|
||||
addElementTransformer(route: string, isCollection: boolean, transformer: Function): void;
|
||||
setTransformOnlyServerElements(active: boolean): void;
|
||||
setOnElemRestangularized(callback: (elem: any, isCollection: boolean, what: string, restangular: IService) => any): void;
|
||||
setResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: ng.IDeferred<any>) => any): void;
|
||||
setResponseExtractor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: ng.IDeferred<any>) => any): void;
|
||||
addResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: ng.IDeferred<any>) => any): void;
|
||||
setResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: angular.IDeferred<any>) => any): void;
|
||||
setResponseExtractor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: angular.IDeferred<any>) => any): void;
|
||||
addResponseInterceptor(responseInterceptor: (data: any, operation: string, what: string, url: string, response: IResponse, deferred: angular.IDeferred<any>) => any): void;
|
||||
setRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string) => any): void;
|
||||
addRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string) => any): void;
|
||||
setFullRequestInterceptor(fullRequestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: IRequestConfig) => {element: any; headers: any; params: any}): void;
|
||||
addFullRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: IRequestConfig) => {headers: any; params: any; element: any; httpConfig: IRequestConfig}): void;
|
||||
setErrorInterceptor(errorInterceptor: (response: IResponse, deferred: ng.IDeferred<any>) => any): void;
|
||||
setFullRequestInterceptor(fullRequestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: angular.IRequestShortcutConfig) => {element: any; headers: any; params: any}): void;
|
||||
addFullRequestInterceptor(requestInterceptor: (element: any, operation: string, what: string, url: string, headers: any, params: any, httpConfig: angular.IRequestShortcutConfig) => {headers: any; params: any; element: any; httpConfig: angular.IRequestShortcutConfig}): void;
|
||||
setErrorInterceptor(errorInterceptor: (response: IResponse, deferred: angular.IDeferred<any>) => any): void;
|
||||
setRestangularFields(fields: {[fieldName: string]: string}): void;
|
||||
setMethodOverriders(overriders: string[]): void;
|
||||
setJsonp(jsonp: boolean): void;
|
||||
@@ -124,7 +113,7 @@ declare module restangular {
|
||||
clone(): IElement;
|
||||
plain(): any;
|
||||
plain<T>(): T;
|
||||
withHttpConfig(httpConfig: IRequestConfig): IElement;
|
||||
withHttpConfig(httpConfig: angular.IRequestShortcutConfig): IElement;
|
||||
save(queryParams?: any, headers?: any): IPromise<any>;
|
||||
getRestangularUrl(): string;
|
||||
}
|
||||
@@ -139,7 +128,7 @@ declare module restangular {
|
||||
options(queryParams?: any, headers?: any): IPromise<any>;
|
||||
patch(queryParams?: any, headers?: any): IPromise<any>;
|
||||
putElement(idx: any, params: any, headers: any): IPromise<any>;
|
||||
withHttpConfig(httpConfig: IRequestConfig): ICollection;
|
||||
withHttpConfig(httpConfig: angular.IRequestShortcutConfig): ICollection;
|
||||
clone(): ICollection;
|
||||
plain(): any;
|
||||
plain<T>(): T[];
|
||||
|
||||
Vendored
+1
@@ -110,6 +110,7 @@ declare module "restify" {
|
||||
version ?: string;
|
||||
responseTimeHeader ?: string;
|
||||
responseTimeFormatter ?: (durationInMilliseconds: number) => any;
|
||||
handleUpgrades ?: boolean;
|
||||
}
|
||||
|
||||
interface ClientOptions {
|
||||
|
||||
Vendored
+2
-2
@@ -73,8 +73,8 @@ declare module SourceMap {
|
||||
constructor(line: number, column: number, source: string);
|
||||
constructor(line: number, column: number, source: string, chunk?: string, name?: string);
|
||||
public static fromStringWithSourceMap(code: string, sourceMapConsumer: SourceMapConsumer, relativePath?: string): SourceNode;
|
||||
public add(chunk: string): void;
|
||||
public prepend(chunk: string): void;
|
||||
public add(chunk: any): SourceNode;
|
||||
public prepend(chunk: any): SourceNode;
|
||||
public setSourceContent(sourceFile: string, sourceContent: string): void;
|
||||
public walk(fn: (chunk: string, mapping: MappedPosition) => void): void;
|
||||
public walkSourceContents(fn: (file: string, content: string) => void): void;
|
||||
|
||||
@@ -1,17 +1,20 @@
|
||||
/// <reference path="./superagent.d.ts" />
|
||||
/// <reference path="superagent.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
// via: http://visionmedia.github.io/superagent/
|
||||
|
||||
import request = require('superagent')
|
||||
import fs = require('fs');
|
||||
import * as request from 'superagent';
|
||||
import * as fs from 'fs';
|
||||
|
||||
// Examples taken from https://github.com/visionmedia/superagent/blob/gh-pages/docs/index.md
|
||||
// and https://github.com/visionmedia/superagent/blob/master/Readme.md
|
||||
|
||||
request
|
||||
.post('/api/pet')
|
||||
.send({ name: 'Manny', species: 'cat' })
|
||||
.set('X-API-Key', 'foobar')
|
||||
.set('Accept', 'application/json')
|
||||
.end((res: request.Response) => {
|
||||
.end((err, res) => {
|
||||
if (res.ok) {
|
||||
console.log('yay got ' + JSON.stringify(res.body));
|
||||
} else {
|
||||
@@ -25,7 +28,7 @@ agent
|
||||
.send({ name: 'Manny', species: 'cat' })
|
||||
.set('X-API-Key', 'foobar')
|
||||
.set('Accept', 'application/json')
|
||||
.end((res: request.Response) => {
|
||||
.end((err, res) => {
|
||||
if (res.error) {
|
||||
console.log('oh no ' + res.error.message);
|
||||
} else {
|
||||
@@ -33,8 +36,19 @@ agent
|
||||
}
|
||||
});
|
||||
|
||||
// Plugins
|
||||
var nocache = require('superagent-no-cache');
|
||||
var prefix = require('superagent-prefix')('/static');
|
||||
|
||||
var callback = (res: request.Response) => {};
|
||||
request
|
||||
.get('/some-url')
|
||||
.use(prefix) // Prefixes *only* this request
|
||||
.use(nocache) // Prevents caching of *only* this request
|
||||
.end(function(err, res){
|
||||
// Do something
|
||||
});
|
||||
|
||||
var callback = (err: any, res: request.Response) => {};
|
||||
|
||||
// Request basics
|
||||
request
|
||||
@@ -44,6 +58,10 @@ request
|
||||
request('GET', '/search')
|
||||
.end(callback);
|
||||
|
||||
request
|
||||
.get('http://example.com/search')
|
||||
.end(callback);
|
||||
|
||||
request
|
||||
.head('/favicon.ico')
|
||||
.end(callback);
|
||||
@@ -100,6 +118,12 @@ request
|
||||
.query('range=1..5')
|
||||
.end(callback);
|
||||
|
||||
// HEAD requests
|
||||
request
|
||||
.head('/users')
|
||||
.query({ email: 'joe@smith.com' })
|
||||
.end(callback);
|
||||
|
||||
// POST / PUT requests
|
||||
request.post('/user')
|
||||
.set('Content-Type', 'application/json')
|
||||
@@ -139,6 +163,7 @@ request.post('/user')
|
||||
request.post('/user')
|
||||
.type('png');
|
||||
|
||||
// Setting Accept
|
||||
request.get('/user')
|
||||
.accept('application/json');
|
||||
|
||||
@@ -254,5 +279,3 @@ request
|
||||
.attach('image', 'path/to/tobi.png')
|
||||
.on('error', (err: any) => {})
|
||||
.end(callback);
|
||||
|
||||
|
||||
|
||||
Vendored
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for SuperAgent 0.15.4
|
||||
// Type definitions for SuperAgent v1.4.0
|
||||
// Project: https://github.com/visionmedia/superagent
|
||||
// Definitions by: Alex Varju <https://github.com/varju/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -8,7 +8,7 @@
|
||||
declare module "superagent" {
|
||||
import stream = require('stream');
|
||||
|
||||
type CallbackHandler = { (err: any, res: request.Response): void; }|{ (res: request.Response): void; };
|
||||
type CallbackHandler = (err: any, res: request.Response) => void;
|
||||
|
||||
var request: request.SuperAgentStatic;
|
||||
|
||||
@@ -102,6 +102,7 @@ declare module "superagent" {
|
||||
set(field: Object): Req;
|
||||
timeout(ms: number): Req;
|
||||
type(val: string): Req;
|
||||
use(fn: Function): Req;
|
||||
withCredentials(): Req;
|
||||
write(data: string, encoding?: string): Req;
|
||||
write(data: Buffer, encoding?: string): Req;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/// <reference path="supertest.d.ts" />
|
||||
/// <reference path="../express/express.d.ts" />
|
||||
|
||||
import supertest = require('supertest')
|
||||
import express = require('express');
|
||||
import * as supertest from 'supertest';
|
||||
import * as express from 'express';
|
||||
|
||||
var app = express();
|
||||
|
||||
@@ -11,7 +11,7 @@ supertest(app)
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Content-Length', '20')
|
||||
.expect(201)
|
||||
.end((err: any, res: supertest.Response) => {
|
||||
.end((err, res) => {
|
||||
if (err) throw err;
|
||||
});
|
||||
|
||||
@@ -56,4 +56,3 @@ function hasPreviousAndNextKeys(res: supertest.Response) {
|
||||
if (!('next' in res.body)) return "missing next key";
|
||||
if (!('prev' in res.body)) throw new Error("missing prev key");
|
||||
}
|
||||
|
||||
|
||||
Vendored
+3
-2
@@ -1,4 +1,4 @@
|
||||
// Type definitions for SuperTest 0.14.0
|
||||
// Type definitions for SuperTest v1.1.0
|
||||
// Project: https://github.com/visionmedia/supertest
|
||||
// Definitions by: Alex Varju <https://github.com/varju/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
@@ -8,7 +8,7 @@
|
||||
declare module "supertest" {
|
||||
import superagent = require('superagent');
|
||||
|
||||
type CallbackHandler = { (err: any, res: supertest.Response): void; }|{ (res: supertest.Response): void; };
|
||||
type CallbackHandler = (err: any, res: supertest.Response) => void;
|
||||
|
||||
function supertest(app: any): supertest.SuperTest;
|
||||
|
||||
@@ -29,6 +29,7 @@ declare module "supertest" {
|
||||
expect(field: string, val: string, callback?: CallbackHandler): Test;
|
||||
expect(field: string, val: RegExp, callback?: CallbackHandler): Test;
|
||||
expect(checker: (res: Response) => any): Test;
|
||||
end(callback?: CallbackHandler): Test;
|
||||
}
|
||||
|
||||
interface Response extends superagent.Response {
|
||||
|
||||
Vendored
+2
@@ -4588,6 +4588,8 @@ declare module THREE {
|
||||
};
|
||||
};
|
||||
|
||||
shadowMap: WebGLShadowMapInstance;
|
||||
|
||||
/**
|
||||
* Return the WebGL context.
|
||||
*/
|
||||
|
||||
Vendored
+2
-2
@@ -3857,7 +3857,7 @@ declare module uiGrid {
|
||||
* defaults to uiGridConstants.filter.INPUT, which gives a text box. If set to uiGridConstants.filter.SELECT
|
||||
* then a select box will be shown with options selectOptions
|
||||
*/
|
||||
type?: number;
|
||||
type?: number | string;
|
||||
/**
|
||||
* options in the format [{ value: 1, label: 'male' }]. No i18n filter is provided, you need to perform the i18n
|
||||
* on the values before you provide them
|
||||
@@ -3870,7 +3870,7 @@ declare module uiGrid {
|
||||
disableCancelButton?: boolean;
|
||||
}
|
||||
export interface ISelectOption {
|
||||
value: number;
|
||||
value: number | string;
|
||||
label: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
/// <reference path="./umzug.d.ts" />
|
||||
/// <reference path="../sequelize/sequelize.d.ts" />
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
import Umzug = require("umzug");
|
||||
import Sequelize = require("sequelize");
|
||||
|
||||
|
||||
var umzug = new Umzug({});
|
||||
|
||||
umzug.up().then(function (result) {
|
||||
// do something with the result
|
||||
});
|
||||
|
||||
umzug.execute({
|
||||
migrations: ['some-id', 'some-other-id'],
|
||||
method: 'up'
|
||||
}).then(function (migrations) {
|
||||
// "migrations" will be an Array of all executed/reverted migrations.
|
||||
});
|
||||
|
||||
umzug.pending().then(function (migrations) {
|
||||
// "migrations" will be an Array with the names of
|
||||
// pending migrations.
|
||||
});
|
||||
|
||||
umzug.executed().then(function (migrations) {
|
||||
// "migrations" will be an Array of already executed migrations.
|
||||
});
|
||||
|
||||
umzug.up().then(function (migrations) {
|
||||
// "migrations" will be an Array with the names of the
|
||||
// executed migrations.
|
||||
});
|
||||
|
||||
umzug.up({ to: '20141101203500-task' }).then(function (migrations) {});
|
||||
|
||||
umzug.up({ migrations: ['20141101203500-task', '20141101203501-task-2'] });
|
||||
|
||||
umzug.up('20141101203500-task'); // Runs just the passed migration
|
||||
umzug.up(['20141101203500-task', '20141101203501-task-2']);
|
||||
|
||||
umzug.down().then(function (migration) {
|
||||
// "migration" will the name of the reverted migration.
|
||||
});
|
||||
|
||||
umzug.down({ to: '20141031080000-task' }).then(function (migrations) {
|
||||
// "migrations" will be an Array with the names of all reverted migrations.
|
||||
});
|
||||
|
||||
umzug.down({ migrations: ['20141101203500-task', '20141101203501-task-2'] });
|
||||
|
||||
umzug.down('20141101203500-task'); // Runs just the passed migration
|
||||
umzug.down(['20141101203500-task', '20141101203501-task-2']);
|
||||
|
||||
var AnotherUmzug = new Umzug({
|
||||
// The storage.
|
||||
// Possible values: 'json', 'sequelize', an object
|
||||
storage: 'json',
|
||||
|
||||
// The options for the storage.
|
||||
// Check the available storages for further details.
|
||||
storageOptions: {},
|
||||
|
||||
// The logging function.
|
||||
// A function that gets executed everytime migrations start and have ended.
|
||||
logging: false,
|
||||
|
||||
// The name of the positive method in migrations.
|
||||
upName: 'up',
|
||||
|
||||
// The name of the negative method in migrations.
|
||||
downName: 'down',
|
||||
|
||||
migrations: {
|
||||
// The params that gets passed to the migrations.
|
||||
// Might be an array or a synchronous function which returns an array.
|
||||
params: [],
|
||||
|
||||
// The path to the migrations directory.
|
||||
path: 'migrations',
|
||||
|
||||
// The pattern that determines whether or not a file is a migration.
|
||||
pattern: /^\d+[\w-]+\.js$/,
|
||||
|
||||
// A function that receives and returns the to be executed function.
|
||||
// This can be used to modify the function.
|
||||
wrap: function (fun : Function) { return fun; }
|
||||
}
|
||||
});
|
||||
|
||||
var AnotherUmzug = new Umzug({
|
||||
// The storage.
|
||||
// Possible values: 'json', 'sequelize', an object
|
||||
storage: 'json',
|
||||
storageOptions: {
|
||||
path: process.cwd() + '/db/sequelize-meta.json'
|
||||
}
|
||||
});
|
||||
|
||||
var sequelize = new Sequelize('');
|
||||
|
||||
var AnotherUmzug = new Umzug({
|
||||
// The storage.
|
||||
// Possible values: 'json', 'sequelize', an object
|
||||
storage: 'sequelize',
|
||||
storageOptions: {
|
||||
// The configured instance of Sequelize.
|
||||
// Optional if `model` is passed.
|
||||
sequelize: sequelize,
|
||||
|
||||
// The to be used Sequelize model.
|
||||
// Must have column name matching `columnName` option
|
||||
// Optional of `sequelize` is passed.
|
||||
model: sequelize.define<any, any>( 'model', {} ),
|
||||
|
||||
// The name of the to be used model.
|
||||
// Defaults to 'SequelizeMeta'
|
||||
modelName: 'Schema',
|
||||
|
||||
// The name of table to create if `model` option is not supplied
|
||||
// Defaults to `modelName`
|
||||
tableName: 'Schema',
|
||||
|
||||
// The name of table column holding migration name.
|
||||
// Defaults to 'name'.
|
||||
columnName: 'migration',
|
||||
|
||||
// The type of the column holding migration name.
|
||||
// Defaults to `Sequelize.STRING`
|
||||
columnType: Sequelize.STRING(100)
|
||||
}
|
||||
|
||||
});
|
||||
Vendored
+188
@@ -0,0 +1,188 @@
|
||||
// Type definitions for Umzug v1.7.0
|
||||
// Project: https://github.com/sequelize/umzug
|
||||
// Definitions by: Ivan Drinchev <https://github.com/drinchev/>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/// <reference path="../bluebird/bluebird.d.ts" />
|
||||
/// <reference path="../sequelize/sequelize.d.ts" />
|
||||
|
||||
declare module "umzug" {
|
||||
|
||||
import Sequelize = require("sequelize");
|
||||
|
||||
interface MigrationOptions {
|
||||
|
||||
/*
|
||||
* The params that gets passed to the migrations.
|
||||
* Might be an array or a synchronous function which returns an array.
|
||||
*/
|
||||
params?: Array<any>;
|
||||
|
||||
/** The path to the migrations directory. */
|
||||
path?: string;
|
||||
|
||||
/** The pattern that determines whether or not a file is a migration. */
|
||||
pattern?: RegExp;
|
||||
|
||||
/**
|
||||
* A function that receives and returns the to be executed function.
|
||||
* This can be used to modify the function.
|
||||
*/
|
||||
wrap?: <T>( fn : T ) => T;
|
||||
|
||||
}
|
||||
|
||||
interface JSONStorageOptions {
|
||||
|
||||
/**
|
||||
* The path to the json storage.
|
||||
* Defaults to process.cwd() + '/umzug.json';
|
||||
*/
|
||||
path?: string;
|
||||
|
||||
}
|
||||
|
||||
interface SequelizeStorageOptions {
|
||||
|
||||
/**
|
||||
* The configured instance of Sequelize.
|
||||
* Optional if `model` is passed.
|
||||
*/
|
||||
sequelize?: Sequelize.Sequelize;
|
||||
|
||||
/**
|
||||
* The to be used Sequelize model.
|
||||
* Must have column name matching `columnName` option
|
||||
* Optional of `sequelize` is passed.
|
||||
*/
|
||||
model?: Sequelize.Model<any, any>;
|
||||
|
||||
/**
|
||||
* The name of the to be used model.
|
||||
* Defaults to 'SequelizeMeta'
|
||||
*/
|
||||
modelName?: string;
|
||||
|
||||
/**
|
||||
* The name of table to create if `model` option is not supplied
|
||||
* Defaults to `modelName`
|
||||
*/
|
||||
tableName?: string;
|
||||
|
||||
/**
|
||||
* The name of table column holding migration name.
|
||||
* Defaults to 'name'.
|
||||
*/
|
||||
columnName: string;
|
||||
|
||||
/**
|
||||
* The type of the column holding migration name.
|
||||
* Defaults to `Sequelize.STRING`
|
||||
*/
|
||||
columnType: Sequelize.DataTypeAbstract;
|
||||
|
||||
}
|
||||
|
||||
interface ExecuteOptions {
|
||||
migrations?: Array<string>;
|
||||
method?: string;
|
||||
}
|
||||
|
||||
interface UmzugOptions {
|
||||
|
||||
/**
|
||||
* The storage.
|
||||
* Possible values: 'json', 'sequelize', an object
|
||||
*/
|
||||
storage?: string;
|
||||
|
||||
/**
|
||||
* The options for the storage.
|
||||
*/
|
||||
storageOptions?: JSONStorageOptions | SequelizeStorageOptions | Object;
|
||||
|
||||
/**
|
||||
* The logging function.
|
||||
* A function that gets executed everytime migrations start and have ended.
|
||||
*/
|
||||
logging? : boolean | Function;
|
||||
|
||||
/**
|
||||
* The name of the positive method in migrations.
|
||||
*/
|
||||
upName? : string;
|
||||
|
||||
/**
|
||||
* The name of the negative method in migrations.
|
||||
*/
|
||||
downName? : string;
|
||||
|
||||
/**
|
||||
* Options for defined migration
|
||||
*/
|
||||
migrations? : MigrationOptions;
|
||||
|
||||
}
|
||||
|
||||
interface UpDownToOptions {
|
||||
|
||||
/**
|
||||
* It is also possible to pass the name of a migration in order to
|
||||
* just run the migrations from the current state to the passed
|
||||
* migration name.
|
||||
*/
|
||||
to: string;
|
||||
|
||||
}
|
||||
|
||||
interface UpDownMigrationsOptions {
|
||||
|
||||
/**
|
||||
* Running specific migrations while ignoring the right order, can be
|
||||
* done like this:
|
||||
*/
|
||||
migrations: Array<string>;
|
||||
|
||||
}
|
||||
|
||||
class Umzug {
|
||||
|
||||
constructor(options?: UmzugOptions);
|
||||
|
||||
/**
|
||||
* The execute method is a general purpose function that runs for
|
||||
* every specified migrations the respective function.
|
||||
*/
|
||||
execute(options? : ExecuteOptions) : Promise<Array<string>>;
|
||||
|
||||
/**
|
||||
* You can get a list of pending/not yet executed migrations like this:
|
||||
*/
|
||||
pending() : Promise<Array<string>>;
|
||||
|
||||
/**
|
||||
* You can get a list of already executed migrations like this:
|
||||
*/
|
||||
executed() : Promise<Array<string>>;
|
||||
|
||||
/**
|
||||
* The up method can be used to execute all pending migrations.
|
||||
*/
|
||||
up(migration?: string) : Promise<string>;
|
||||
up(migrations?: Array<string>) : Promise<Array<string>>;
|
||||
up(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise<Array<string>>;
|
||||
|
||||
/**
|
||||
* The down method can be used to revert the last executed migration.
|
||||
*/
|
||||
down(migration?: string) : Promise<string>;
|
||||
down(migrations?: Array<string>) : Promise<Array<string>>;
|
||||
down(options?: UpDownToOptions | UpDownMigrationsOptions ) : Promise<Array<string>>;
|
||||
|
||||
}
|
||||
|
||||
var umzug : typeof Umzug;
|
||||
|
||||
export = umzug;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
/// <reference path="wreck.d.ts" />
|
||||
|
||||
import Wreck = require('wreck');
|
||||
|
||||
Wreck.get('https://google.com/', {}, function (err: any, res: any, payload: any) {
|
||||
/* do stuff */
|
||||
});
|
||||
|
||||
|
||||
var method = 'GET'; // GET, POST, PUT, DELETE
|
||||
var uri = 'https://google.com/';
|
||||
var readableStream = Wreck.toReadableStream('foo=bar');
|
||||
|
||||
var wreck = Wreck.defaults({
|
||||
headers: { 'x-foo-bar': 123 }
|
||||
});
|
||||
|
||||
// cascading example -- does not alter `wreck`
|
||||
var wreckWithTimeout = wreck.defaults({
|
||||
timeout: 5
|
||||
});
|
||||
|
||||
// all attributes are optional
|
||||
var options = {
|
||||
maxBytes: 1048576, // 1 MB, default: unlimited
|
||||
rejectUnauthorized: true
|
||||
};
|
||||
|
||||
var optionalCallback = function (err: any, res: any) {
|
||||
|
||||
/* handle err if it exists, in which case res will be undefined */
|
||||
|
||||
// buffer the response stream
|
||||
Wreck.read(res, null, function (err: any, body: any) {
|
||||
/* do stuff */
|
||||
});
|
||||
};
|
||||
|
||||
var req = wreck.request(method, uri, options, optionalCallback);
|
||||
Vendored
+41
@@ -0,0 +1,41 @@
|
||||
// Type definitions for wreck 7.0.0
|
||||
// Project: https://github.com/hapijs/wreck
|
||||
// Definitions by: Marcin Porębski <http://github.com/marcinporebski>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="../node/node.d.ts" />
|
||||
|
||||
declare module "wreck"
|
||||
{
|
||||
import http = require('http');
|
||||
import stream = require('stream');
|
||||
|
||||
|
||||
interface WreckObject
|
||||
{
|
||||
defaults: (options: any) => WreckObject;
|
||||
|
||||
request: (method: string, uri: string, options: any, callback?: (err: any, response: http.IncomingMessage) => void) => http.ClientRequest;
|
||||
|
||||
read: (response: http.IncomingMessage, options: any, callback: (err: any, payload: any) => void) => void;
|
||||
|
||||
get: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest;
|
||||
post: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest;
|
||||
patch: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest;
|
||||
put: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest;
|
||||
delete: (uri: string, options: any, callback: (err: any, response: http.IncomingMessage, payload: any) => void) => http.ClientRequest;
|
||||
|
||||
toReadableStream: (payload: any, encoding?: string) => stream.Readable;
|
||||
|
||||
parseCacheControl: (field: string) => any;
|
||||
|
||||
agents: {
|
||||
http: http.Agent,
|
||||
https: http.Agent
|
||||
};
|
||||
}
|
||||
|
||||
var wreck: WreckObject;
|
||||
|
||||
export = wreck;
|
||||
}
|
||||
Vendored
+1
@@ -44,6 +44,7 @@ declare module YT {
|
||||
origin?: string;
|
||||
playerpiid?: string;
|
||||
playlist?: string[];
|
||||
playsinline?: number;
|
||||
rel?: number;
|
||||
showinfo?: number;
|
||||
start?: number;
|
||||
|
||||
Reference in New Issue
Block a user