Merge remote-tracking branch 'refs/remotes/borisyankov/master'

This commit is contained in:
MatejQ
2015-11-09 08:29:06 +01:00
55 changed files with 6998 additions and 1777 deletions
+1
View File
@@ -1119,6 +1119,7 @@ This document generated by [dt-contributors-generator](https://github.com/vvakam
* [:link:](simple-cw-node/simple-cw-node.d.ts) [simple-cw-node](https://github.com/astronaughts/simple-cw-node) by [vvakame](https://github.com/vvakame)
* [:link:](simplebar/simplebar.d.ts) [simplebar.js](https://github.com/Grsmto/simplebar) by [Gregor Woiwode](https://github.com/gregonnet)
* [:link:](jquery.simplemodal/jquery.simplemodal.d.ts) [SimpleModal](http://www.ericmmartin.com/projects/simplemodal) by [Friedrich von Never](https://github.com/ForNeVeR)
* [:link:](simpleStorage/simplestorage.js.d.ts) [simpleStorage](https://github.com/andris9/simpleStorage) by [Áxel Costas Pena](https://github.com/axelcostaspena)
* [:link:](sinon/sinon.d.ts) [Sinon](http://sinonjs.org) by [William Sears](https://github.com/mrbigdog2u)
* [:link:](sinon-chai/sinon-chai.d.ts) [sinon-chai](https://github.com/domenic/sinon-chai) by [Kazi Manzur Rashid](https://github.com/kazimanzurrashid), [Jed Mao](https://github.com/jedmao)
* [:link:](sinon-chrome/sinon-chrome.d.ts) [Sinon-Chrome](https://github.com/vitalets/sinon-chrome) by [Tim Perry](https://github.com/pimterry)
+32
View File
@@ -1,5 +1,6 @@
/// <reference path="amqplib.d.ts" />
// promise api tests
import amqp = require("amqplib");
var msg = "Hello World";
@@ -19,3 +20,34 @@ amqp.connect("amqp://localhost")
.then(channel => channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString())))
.ensure(() => connection.close());
});
// callback api tests
import amqpcb = require("amqplib/callback_api");
amqpcb.connect("amqp://localhost", (err, connection) => {
if(!err) {
connection.createChannel((err, channel) => {
if (!err) {
channel.assertQueue("myQueue", {}, (err, ok) => {
if(!err) {
channel.sendToQueue("myQueue", new Buffer(msg));
}
});
}
});
}
});
amqpcb.connect("amqp://localhost", (err, connection) => {
if(!err) {
connection.createChannel((err, channel) => {
if (!err) {
channel.assertQueue("myQueue", {}, (err, ok) => {
if(!err) {
channel.consume("myQueue", newMsg => console.log("New Message: " + newMsg.content.toString()));
}
});
}
});
}
});
+87 -13
View File
@@ -1,22 +1,12 @@
// Type definitions for amqplib 0.3.x
// Project: https://github.com/squaremo/amqp.node
// Definitions by: Michael Nahkies <https://github.com/mnahkies>
// Definitions by: Michael Nahkies <https://github.com/mnahkies>, Ab Reitsma <https://github.com/abreits>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../when/when.d.ts" />
/// <reference path="../node/node.d.ts" />
declare module "amqplib" {
import events = require("events");
import when = require("when");
interface Connection extends events.EventEmitter {
close(): when.Promise<void>;
createChannel(): when.Promise<Channel>;
createConfirmChannel(): when.Promise<Channel>;
}
declare module "amqplib/properties" {
module Replies {
interface Empty {
}
@@ -25,6 +15,9 @@ declare module "amqplib" {
messageCount: number;
consumerCount: number;
}
interface PurgeQueue {
messageCount: number;
}
interface DeleteQueue {
messageCount: number;
}
@@ -100,6 +93,22 @@ declare module "amqplib" {
fields: Object;
properties: Object;
}
}
declare module "amqplib" {
import events = require("events");
import when = require("when");
import shared = require("amqplib/properties")
import Replies = shared.Replies;
import Options = shared.Options;
import Message = shared.Message;
interface Connection extends events.EventEmitter {
close(): when.Promise<void>;
createChannel(): when.Promise<Channel>;
createConfirmChannel(): when.Promise<Channel>;
}
interface Channel extends events.EventEmitter {
close(): when.Promise<void>;
@@ -108,7 +117,7 @@ declare module "amqplib" {
checkQueue(queue: string): when.Promise<Replies.AssertQueue>;
deleteQueue(queue: string, options?: Options.DeleteQueue): when.Promise<Replies.DeleteQueue>;
purgeQueue(queue: string): when.Promise<Replies.DeleteQueue>;
purgeQueue(queue: string): when.Promise<Replies.PurgeQueue>;
bindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
unbindQueue(queue: string, source: string, pattern: string, args?: any): when.Promise<Replies.Empty>;
@@ -142,3 +151,68 @@ declare module "amqplib" {
function connect(url: string, socketOptions?: any): when.Promise<Connection>;
}
declare module "amqplib/callback_api" {
import events = require("events");
import shared = require("amqplib/properties")
import Replies = shared.Replies;
import Options = shared.Options;
import Message = shared.Message;
interface Connection extends events.EventEmitter {
close(callback?: (err: any) => void): void;
createChannel(callback: (err: any, channel: Channel) => void): void;
createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void;
}
interface Channel extends events.EventEmitter {
close(callback: (err: any) => void): void;
assertQueue(queue?: string, options?: Options.AssertQueue, callback?: (err:any, ok: Replies.AssertQueue) => void): void;
checkQueue(queue: string, callback?: (err: any, ok: Replies.AssertQueue) => void): void;
deleteQueue(queue: string, options?: Options.DeleteQueue, callback?: (err:any, ok: Replies.DeleteQueue) => void): void;
purgeQueue(queue: string, callback?: (err:any, ok: Replies.PurgeQueue) => void): void;
bindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
unbindQueue(queue: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
assertExchange(exchange: string, type: string, options?: Options.AssertExchange, callback?: (err: any, ok: Replies.AssertExchange) => void): void;
checkExchange(exchange: string, callback?: (err: any, ok: Replies.Empty) => void): void;
deleteExchange(exchange: string, options?: Options.DeleteExchange, callback?: (err: any, ok: Replies.Empty) => void): void;
bindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
unbindExchange(destination: string, source: string, pattern: string, args?: any, callback?: (err: any, ok: Replies.Empty) => void): void;
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish): boolean;
sendToQueue(queue: string, content: Buffer, options?: Options.Publish): boolean;
consume(queue: string, onMessage: (msg: Message) => any, options?: Options.Consume, callback?: (err: any, ok: Replies.Consume) => void): void;
cancel(consumerTag: string, callback?: (err: any, ok: Replies.Empty) => void): void;
get(queue: string, options?: Options.Get, callback?: (err: any, ok: Message | boolean) => void): void;
ack(message: Message, allUpTo?: boolean): void;
ackAll(): void;
nack(message: Message, allUpTo?: boolean, requeue?: boolean): void;
nackAll(requeue?: boolean): void;
reject(message: Message, requeue?: boolean): void;
prefetch(count: number, global?: boolean): void;
recover(callback?: (err: any, ok: Replies.Empty) => void): void;
}
interface ConfirmChannel extends Channel {
publish(exchange: string, routingKey: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean;
sendToQueue(queue: string, content: Buffer, options?: Options.Publish, callback?: (err: any, ok: Replies.Empty) => void): boolean;
waitForConfirms(callback?: (err: any) => void): void;
}
function connect(callback: (err: any, connection: Connection) => void): void;
function connect(url: string, callback: (err: any, connection: Connection) => void): void;
function connect(url: string, socketOptions: any, callback: (err: any, connection: Connection) => void): void;
}
+3 -3
View File
@@ -76,11 +76,11 @@ interface Async {
each<T>(arr: T[], iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
eachSeries<T>(arr: T[], iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
eachLimit<T>(arr: T[], limit: number, iterator: AsyncIterator<T>, callback?: ErrorCallback): void;
forEachOf(obj: any, iterator: (item: any, key: [string|number], callback?: ErrorCallback) => void, callback: ErrorCallback): void;
forEachOf(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
forEachOf<T>(obj: T[], iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
forEachOfSeries(obj: any, iterator: (item: any, key: [string|number], callback?: ErrorCallback) => void, callback: ErrorCallback): void;
forEachOfSeries(obj: any, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
forEachOfSeries<T>(obj: T[], iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: [string|number], callback?: ErrorCallback) => void, callback: ErrorCallback): void;
forEachOfLimit(obj: any, limit: number, iterator: (item: any, key: string|number, callback?: ErrorCallback) => void, callback: ErrorCallback): void;
forEachOfLimit<T>(obj: T[], limit: number, iterator: AsyncForEachOfIterator<T>, callback?: ErrorCallback): void;
map<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
mapSeries<T, R>(arr: T[], iterator: AsyncResultIterator<T, R>, callback?: AsyncResultArrayCallback<R>): any;
@@ -0,0 +1,17 @@
/// <reference path="closure-compiler.d.ts"/>
import {compile} from 'closure-compiler';
compile('some.source()', {'check-only': null},
(err: Error, stdout: string, stderr: string): void => {
console.log('Got', err, 'stdout', stdout, 'stderr', stderr);
});
// No options, Callback wins.
compile('some.source()', (err: Error, stdout: string, stderr: string): void => {
console.log('Got', err, 'stdout', stdout, 'stderr', stderr);
});
compile(null, {'js': ['a/f.js', 'a/f2.js'], 'check-only': null},
(err: Error, stdout: string, stderr: string): void => {
console.log('Got', err, 'stdout', stdout, 'stderr', stderr);
});
+11
View File
@@ -0,0 +1,11 @@
// Type definitions for closure-compiler
// Project: https://github.com/tim-smart/node-closure/
// Definitions by: Martin Probst <https://github.com/mprobst>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module 'closure-compiler' {
type Callback = (err: Error, stdout: string, stderr: string) => any;
function compile(src: string, callback: Callback): void;
function compile(src: string, options: {[k: string]: string | string[]},
callback: Callback): void;
}
+32
View File
@@ -0,0 +1,32 @@
/// <reference path="./connect.d.ts" />
import * as http from "http";
import * as connect from "connect";
const app = connect();
// log all requests
app.use((req: http.IncomingMessage, res: http.ServerResponse, next: Function) => {
console.log(req, res);
next();
});
// Stop on errors
app.use((err: Error, req: http.IncomingMessage, res: http.ServerResponse, next: Function) => {
if (err) {
return res.end(`Error: ${err}`);
}
next();
});
// respond to all requests
app.use((req: http.IncomingMessage, res: http.ServerResponse) => {
res.end("Hello from Connect!\n");
});
//create node.js http server and listen on port
http.createServer(app).listen(3000);
//create node.js http server and listen on port using connect shortcut
app.listen(3000);
+92
View File
@@ -0,0 +1,92 @@
// Type definitions for connect v3.4.0
// Project: https://github.com/senchalabs/connect
// Definitions by: Maxime LUCE <https://github.com/SomaticIT/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "connect" {
import * as http from "http";
/**
* Create a new connect server.
* @public
*/
function createServer(): createServer.Server;
module createServer {
export type ServerHandle = HandleFunction | http.Server;
export type SimpleHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse) => void;
export type NextHandleFunction = (req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void;
export type ErrorHandleFunction = (err: Error, req: http.IncomingMessage, res: http.ServerResponse, next: Function) => void;
export type HandleFunction = SimpleHandleFunction | NextHandleFunction | ErrorHandleFunction;
export interface ServerStackItem {
route: string;
handle: ServerHandle;
}
export interface Server extends NodeJS.EventEmitter {
(req: http.IncomingMessage, res: http.ServerResponse, next?: Function): void;
route: string;
stack: ServerStackItem[];
/**
* Utilize the given middleware `handle` to the given `route`,
* defaulting to _/_. This "route" is the mount-point for the
* middleware, when given a value other than _/_ the middleware
* is only effective when that segment is present in the request's
* pathname.
*
* For example if we were to mount a function at _/admin_, it would
* be invoked on _/admin_, and _/admin/settings_, however it would
* not be invoked for _/_, or _/posts_.
*
* @public
*/
use(fn: HandleFunction): Server;
use(route: string, fn: HandleFunction): Server;
/**
* Handle server requests, punting them down
* the middleware stack.
*
* @private
*/
handle(req: http.IncomingMessage, res: http.ServerResponse, next: Function): void;
/**
* Listen for connections.
*
* This method takes the same arguments
* as node's `http.Server#listen()`.
*
* HTTP and HTTPS:
*
* If you run your application both as HTTP
* and HTTPS you may wrap them individually,
* since your Connect "server" is really just
* a JavaScript `Function`.
*
* var connect = require('connect')
* , http = require('http')
* , https = require('https');
*
* var app = connect();
*
* http.createServer(app).listen(80);
* https.createServer(options, app).listen(443);
*
* @api public
*/
listen(port: number, hostname?: string, backlog?: number, callback?: Function): http.Server;
listen(port: number, hostname?: string, callback?: Function): http.Server;
listen(path: string, callback?: Function): http.Server;
listen(handle: any, listeningListener?: Function): http.Server;
}
}
export = createServer;
}
+2
View File
@@ -171,6 +171,8 @@ declare module Faker {
uuid(): string;
boolean(): boolean;
};
seed(value: number): void;
}
interface Card {
+17
View File
@@ -0,0 +1,17 @@
/// <reference path="./finalhandler.d.ts" />
import {ServerRequest, ServerResponse} from "http";
import finalHandler from "finalhandler";
let req: ServerRequest;
let res: ServerResponse;
let options: {
onerror: (err: any, req: ServerRequest, res: ServerResponse) => void;
message: boolean|((err: any, status: number) => string);
stacktrace: boolean;
};
let result: (err: any) => void;
result = finalHandler(req, res);
result = finalHandler(req, res, options);
+20
View File
@@ -0,0 +1,20 @@
// Type definitions for finalhandler
// Project: https://github.com/pillarjs/finalhandler
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "finalhandler" {
import {ServerRequest, ServerResponse} from "http";
export interface Options {
message?: boolean|((err: any, status: number) => string);
onerror?: (err: any, req: ServerRequest, res: ServerResponse) => void;
stacktrace?: boolean;
}
function finalHandler(req: ServerRequest, res: ServerResponse, options?: Options): (err: any) => void;
export default finalHandler;
}
+57
View File
@@ -0,0 +1,57 @@
/// <reference path="./flat.d.ts" />
import {flatten, unflatten} from "flat";
module TestFlatten {
let options: {
delimiter?: string;
safe?: boolean;
maxDepth?: number;
};
type Target = {
a: {
b: number;
},
c: boolean[][];
};
let target: Target;
type Result = {
'a.b': number;
'c.0.0': boolean;
};
let result: Result;
result = flatten<Target, Result>(target);
result = flatten<Target, Result>(target, options);
}
module TestUnflatten {
let options: {
delimiter?: string;
object?: boolean;
overwrite?: boolean;
};
type Target = {
'a.b': number;
'c.0.0': boolean;
};
let target: Target;
type Result = {
a: {
b: number;
},
c: boolean[][];
};
let result: Result;
result = unflatten<Target, Result>(target);
result = unflatten<Target, Result>(target, options);
}
+41
View File
@@ -0,0 +1,41 @@
// Type definitions for flat
// Project: https://github.com/hughsk/flat
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module FlatTypes {
interface FlattenOptions {
delimiter?: string;
safe?: boolean;
maxDepth?: number;
}
interface Flatten {
<TTarget, TResult>(
target: TTarget,
options?: FlattenOptions
): TResult;
flatten: Flatten;
unflatten: Unflatten;
}
interface UnflattenOptions {
delimiter?: string;
object?: boolean;
overwrite?: boolean;
}
interface Unflatten {
<TTarget, TResult>(
target: TTarget,
options?: UnflattenOptions
): TResult;
}
}
declare module "flat" {
var flatten: FlatTypes.Flatten;
export = flatten;
}
+6
View File
@@ -192,6 +192,12 @@ declare module grunt {
*/
requires(prop: string, ...andProps: string[]): void
requires(prop: string[], ...andProps: string[][]): void
/**
* Recursively merges properties of the specified configObject into the current project configuration.
* You can use this method to append configuration options, targets, etc., to already defined tasks.
*/
merge<T>(configObject: T): void;
}
}
+3
View File
@@ -22,8 +22,11 @@ declare module "gulp-inject" {
ignorePath?: string | string[];
relative?: boolean;
addPrefix?: string;
addSuffix?: string;
addRootSlash?: boolean;
name?: string;
removeTags?: boolean;
empty?: boolean;
starttag?: string | ITagFunction;
endtag?: string | ITagFunction;
transform?: ITransformFunction;
+21
View File
@@ -0,0 +1,21 @@
/// <reference path="iniparser.d.ts" />
import * as iniparser from 'iniparser';
type Result = {section: {param: string}};
let file: string;
{
let callback: (err: any, data: Result) => void;
let result: void;
iniparser.parse(file, callback);
}
{
let result: Result;
result = iniparser.parseSync<Result>(file);
result = iniparser.parseString<Result>('');
}
+15
View File
@@ -0,0 +1,15 @@
// Type definitions for iniparser
// Project: https://github.com/shockie/node-iniparser
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "iniparser" {
export function parse<T>(
file: string,
callback: (err: any, data: T) => void
): void;
export function parseSync<T>(file: string): T;
export function parseString<T>(data: string): T;
}
+1
View File
@@ -40,6 +40,7 @@ declare module jest {
toBeFalsy(): boolean;
toBeTruthy(): boolean;
toBeNull(): boolean;
toBeDefined(): boolean;
toBeUndefined(): boolean;
toMatch(expected: RegExp): boolean;
toContain(expected: string): boolean;
+2
View File
@@ -11,6 +11,8 @@ interface PNotifyStack {
push?: string;
spacing1?: number;
spacing2?: number;
firstpos1?: number;
firstpos2?: number;
context?: JQuery
}
+8 -1
View File
@@ -12,6 +12,7 @@ var knex = Knex({
});
var knex = Knex({
debug: true,
client: 'mysql',
connection: {
socketPath : '/path/to/socket.sock',
@@ -32,7 +33,13 @@ var knex = Knex({
},
pool: {
min: 0,
max: 7
max: 7,
afterCreate: (connection: any, callback: Function) => {
return callback(null, connection);
},
beforeDestroy: (connection: any, callback: Function) => {
return callback(null, connection);
}
}
});
+5
View File
@@ -135,6 +135,8 @@ declare module "knex" {
transacting(trx: Transaction): QueryBuilder;
connection(connection: any): QueryBuilder;
clone(): QueryBuilder;
}
interface As {
@@ -394,6 +396,7 @@ declare module "knex" {
}
interface Config {
debug?: boolean;
client?: string;
dialect?: string;
connection: string|ConnectionConfig|
@@ -427,7 +430,9 @@ declare module "knex" {
interface PoolConfig {
name?: string;
create?: Function;
afterCreate?: Function;
destroy?: Function;
beforeDestroy?: Function;
min?: number;
max?: number;
refreshIdle?: boolean;
+10 -2
View File
@@ -11,6 +11,9 @@
Version 1.1 - added test for makeEditable
Version 1.2 - amended callback on commmand.fail() method - accepts response,
status and message values
Note: Typescript version 1.4 or higher is required for union types
and type declarations
*/
@@ -29,8 +32,13 @@ function CommandTests() {
.done((data: any) => {
alert("success");
})
.fail((error: string) => {
alert(error);
.fail((response) => {
// dummy
return false;
})
.fail((response, status, message) => {
// fail has response, error and text
alert(status + message);
});
// initialize command with options (action only)
+6 -2
View File
@@ -1,8 +1,9 @@
// Type definitions for ko.plus v0.0.21
// Type definitions for ko.plus v0.0.24
// Project: https://github.com/stevegreatrex/ko.plus
// Definitions by: Howard Richards <https://github.com/conficient>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="../knockout/knockout.d.ts" />
/**
@@ -16,6 +17,9 @@
*
* Version 1.1 - fixed bug - makeEditable is now a function on .editable
* also refactored how the Editable classes inherit to simplify
*
* Version 1.2 - amended callback on commmand.fail() method - accepts response,
* status and message values
*/
//
@@ -87,7 +91,7 @@ declare module KoPlus {
//
done: (callback: (data: any) => void) => Command;
fail: (callback: (error: string) => void) => Command;
fail: (callback: (response: any, status?: string, statusText?:string) => void) => Command;
always: (callback: Function) => Command;
+487 -132
View File
@@ -104,46 +104,43 @@ result = <(key: string) => any>testMapCache.get;
result = <(key: string) => boolean>testMapCache.has;
result = <(key: string, value: any) => _.Dictionary<any>>testMapCache.set;
/*************
* Chaining *
*************/
result = <_.LoDashWrapper<string>>_('test');
result = <_.LoDashWrapper<number>>_(1);
result = <_.LoDashWrapper<boolean>>_(true);
result = <_.LoDashArrayWrapper<string>>_(['test1', 'test2']);
// Appears to be a change in the compiler, if the type explicity implements the object indexer.
// Looking at: https://typescript.codeplex.com/wikipage?title=Known%20breaking%20changes%20between%200.8%20and%200.9&referringTitle=Documentation
// "The noimplicitany option now warns on the use of the hidden default indexer"
result = <_.LoDashObjectWrapper<_.Dictionary<string>>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' });
// _
module TestWrapper {
{
let result: _.LoDashImplicitWrapper<string>;
result = _('');
}
result = <_.LoDashWrapper<string>>_.chain('test');
result = <_.LoDashWrapper<string>>_('test').chain();
result = <_.LoDashWrapper<number>>_.chain(1);
result = <_.LoDashWrapper<number>>_(1).chain();
result = <_.LoDashWrapper<boolean>>_.chain(true);
result = <_.LoDashWrapper<boolean>>_(true).chain();
result = <_.LoDashArrayWrapper<string>>_.chain(['test1', 'test2']);
result = <_.LoDashArrayWrapper<string>>_(['test1', 'test2']).chain();
result = <_.LoDashObjectWrapper<_.Dictionary<string>>>_.chain(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' });
result = <_.LoDashObjectWrapper<_.Dictionary<string>>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).chain();
{
let result: _.LoDashImplicitWrapper<number>;
result = _(42);
}
{
let result: _.LoDashImplicitWrapper<boolean>;
result = _(true);
}
{
let result: _.LoDashImplicitArrayWrapper<string>;
result = _<string>(['']);
}
{
let result: _.LoDashImplicitObjectWrapper<{a: string}>;
result = _<{a: string}>({a: ''});
}
}
//Wrapped array shortcut methods
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).concat(5, 6);
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).concat([5, 6]);
result = <string>_([1, 2, 3, 4]).join(',');
result = <number>_([1, 2, 3, 4]).pop();
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).push(5, 6, 7);
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).reverse();
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3, 4]).push(5, 6, 7);
result = <number>_([1, 2, 3, 4]).shift();
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).sort((a, b) => 1);
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).splice(1);
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).splice(1, 2, 5, 6);
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).unshift(5, 6);
result = <number[]>_.tap([1, 2, 3, 4], function (array) { console.log(array); });
result = <_.LoDashWrapper<string>>_('test').tap(function (value) { console.log(value); });
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).tap(function (array) { console.log(array); });
result = <_.LoDashObjectWrapper<_.Dictionary<string>>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).tap(function (array) { console.log(array); });
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3, 4]).sort((a, b) => 1);
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3, 4]).splice(1);
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3, 4]).splice(1, 2, 5, 6);
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3, 4]).unshift(5, 6);
result = <string>_('test').toString();
result = <string>_([1, 2, 3]).toString();
@@ -412,10 +409,10 @@ result = <Array<number>>_.flatten([1, [2], [[3]]], true);
result = <Array<number>>_.flatten<number>([1, [2], [3, [[4]]]], true);
result = <Array<number|boolean>>_.flatten<number|boolean>([1, [2], [3, [[false]]]], true);
result = <_.LoDashArrayWrapper<number>>_([[1, 2], [3, 4], 5, 6]).flatten();
result = <_.LoDashArrayWrapper<number|Array<Array<number>>>>_([1, [2], [3, [[4]]]]).flatten();
result = <_.LoDashImplicitArrayWrapper<number>>_([[1, 2], [3, 4], 5, 6]).flatten();
result = <_.LoDashImplicitArrayWrapper<number|Array<Array<number>>>>_([1, [2], [3, [[4]]]]).flatten();
result = <_.LoDashArrayWrapper<number>>_([1, [2], [3, [[4]]]]).flatten(true);
result = <_.LoDashImplicitArrayWrapper<number>>_([1, [2], [3, [[4]]]]).flatten(true);
// _.flattenDeep
module TestFlattenDeep {
@@ -1053,76 +1050,417 @@ result = <number[]>_([1, 2]).zipWith<number>([1, 2], [1, 2], [1, 2], [1, 2], [1,
* Chain *
*********/
// _.chain
module TestChain {
{
let result: _.LoDashExplicitWrapper<string>;
result = _.chain('');
result = _('').chain();
result = _.chain('').chain();
result = _('').chain().chain();
}
{
let result: _.LoDashExplicitWrapper<number>;
result = _.chain(42);
result = _(42).chain();
}
{
let result: _.LoDashExplicitWrapper<boolean>;
result = _.chain(true);
result = _(true).chain();
}
{
let result: _.LoDashExplicitArrayWrapper<string>;
result = _.chain(['']);
result = _(['']).chain();
}
{
let result: _.LoDashExplicitObjectWrapper<{a: string}>;
result = _.chain<{a: string}>({a: ''});
result = _<{a: string}>({a: ''}).chain();
}
}
// _.tap
module TestTap {
{
let interceptor: (value: string) => void;
let result: string;
_.tap('', interceptor);
_.tap('', interceptor, any);
}
{
let interceptor: (value: string[]) => void;
let result: _.LoDashImplicitArrayWrapper<string>;
_.tap([''], interceptor);
_.tap([''], interceptor, any);
}
{
let interceptor: (value: {a: string}) => void;
let result: _.LoDashImplicitObjectWrapper<{a: string}>;
_.tap({a: ''}, interceptor);
_.tap({a: ''}, interceptor, any);
}
{
let interceptor: (value: string) => void;
let result: _.LoDashImplicitWrapper<string>;
_.chain('').tap(interceptor, any);
_.chain('').tap(interceptor, any);
_('').tap(interceptor);
_('').tap(interceptor, any);
}
{
let interceptor: (value: string[]) => void;
let result: _.LoDashImplicitArrayWrapper<string>;
_.chain(['']).tap(interceptor);
_.chain(['']).tap(interceptor, any);
_(['']).tap(interceptor);
_(['']).tap(interceptor, any);
}
{
let interceptor: (value: {a: string}) => void;
let result: _.LoDashImplicitObjectWrapper<{a: string}>;
_.chain({a: ''}).tap(interceptor);
_.chain({a: ''}).tap(interceptor, any);
_({a: ''}).tap(interceptor);
_({a: ''}).tap(interceptor, any);
}
{
let interceptor: (value: string) => void;
let result: _.LoDashExplicitWrapper<string>;
_.chain('').tap(interceptor, any);
_.chain('').tap(interceptor, any);
_('').chain().tap(interceptor);
_('').chain().tap(interceptor, any);
}
{
let interceptor: (value: string[]) => void;
let result: _.LoDashExplicitArrayWrapper<string>;
_.chain(['']).tap(interceptor);
_.chain(['']).tap(interceptor, any);
_(['']).chain().tap(interceptor);
_(['']).chain().tap(interceptor, any);
}
{
let interceptor: (value: {a: string}) => void;
let result: _.LoDashExplicitObjectWrapper<{a: string}>;
_.chain({a: ''}).tap(interceptor);
_.chain({a: ''}).tap(interceptor, any);
_({a: ''}).chain().tap(interceptor);
_({a: ''}).chain().tap(interceptor, any);
}
}
// _.thru
{
let result: number;
result = _.thru<number, number>(1, (value: number) => value);
result = _.thru<number, number>(1, (value: number) => value, any);
}
{
let result: _.LoDashWrapper<number>;
result = _(1).thru<number>((value: number) => value);
result = _(1).thru<number>((value: number) => value, any);
}
{
let result: _.LoDashWrapper<string>;
result = _('').thru<string>((value: string) => value);
result = _('').thru<string>((value: string) => value, any);
}
{
let result: _.LoDashWrapper<boolean>;
result = _(true).thru<boolean>((value: boolean) => value);
result = _(true).thru<boolean>((value: boolean) => value, any);
}
{
let result: _.LoDashObjectWrapper<any>;
result = _({}).thru<Object>((value: Object) => value);
result = _({}).thru<Object>((value: Object) => value, any);
}
{
let result: _.LoDashArrayWrapper<number>;
result = _([1, 2, 3]).thru<number>((value: number[]) => value);
result = _([1, 2, 3]).thru<number>((value: number[]) => value, any);
module TestThru {
interface Interceptor<T> {
(value: T): T;
}
{
let interceptor: Interceptor<number>;
let result: number;
result = _.thru<number, number>(1, interceptor);
result = _.thru<number, number>(1, interceptor, any);
}
{
let interceptor: Interceptor<number>;
let result: _.LoDashImplicitWrapper<number>;
result = _(1).thru<number>(interceptor);
result = _(1).thru<number>(interceptor, any);
}
{
let interceptor: Interceptor<string>;
let result: _.LoDashImplicitWrapper<string>;
result = _('').thru<string>(interceptor);
result = _('').thru<string>(interceptor, any);
}
{
let interceptor: Interceptor<boolean>;
let result: _.LoDashImplicitWrapper<boolean>;
result = _(true).thru<boolean>(interceptor);
result = _(true).thru<boolean>(interceptor, any);
}
{
let interceptor: Interceptor<{a: string}>;
let result: _.LoDashImplicitObjectWrapper<{a: string}>;
result = _({a: ''}).thru<{a: string}>(interceptor);
result = _({a: ''}).thru<{a: string}>(interceptor, any);
}
{
let interceptor: Interceptor<number[]>;
let result: _.LoDashImplicitArrayWrapper<number>;
result = _([1, 2, 3]).thru<number>(interceptor);
result = _([1, 2, 3]).thru<number>(interceptor, any);
}
{
let interceptor: Interceptor<number>;
let result: _.LoDashExplicitWrapper<number>;
result = _(1).chain().thru<number>(interceptor);
result = _(1).chain().thru<number>(interceptor, any);
}
{
let interceptor: Interceptor<string>;
let result: _.LoDashExplicitWrapper<string>;
result = _('').chain().thru<string>(interceptor);
result = _('').chain().thru<string>(interceptor, any);
}
{
let interceptor: Interceptor<boolean>;
let result: _.LoDashExplicitWrapper<boolean>;
result = _(true).chain().thru<boolean>(interceptor);
result = _(true).chain().thru<boolean>(interceptor, any);
}
{
let interceptor: Interceptor<{a: string}>;
let result: _.LoDashExplicitObjectWrapper<{a: string}>;
result = _({a: ''}).chain().thru<{a: string}>(interceptor);
result = _({a: ''}).chain().thru<{a: string}>(interceptor, any);
}
{
let interceptor: Interceptor<number[]>;
let result: _.LoDashExplicitArrayWrapper<number>;
result = _([1, 2, 3]).chain().thru<number>(interceptor);
result = _([1, 2, 3]).chain().thru<number>(interceptor, any);
}
}
// _.prototype.commit
{
let result: _.LoDashWrapper<number>;
result = _(42).commit();
module TestCommit {
{
let result: _.LoDashImplicitWrapper<number>;
result = _(42).commit();
}
{
let result: _.LoDashImplicitArrayWrapper<any>;
result = _<any>([]).commit();
}
{
let result: _.LoDashImplicitObjectWrapper<any>;
result = _({}).commit();
}
{
let result: _.LoDashExplicitWrapper<number>;
result = _(42).chain().commit();
}
{
let result: _.LoDashExplicitArrayWrapper<any>;
result = _<any>([]).chain().commit();
}
{
let result: _.LoDashExplicitObjectWrapper<any>;
result = _({}).chain().commit();
}
}
{
let result: _.LoDashArrayWrapper<any>;
result = _<any>([]).commit();
}
{
let result: _.LoDashObjectWrapper<any>;
result = _({}).commit();
// _.prototype.concat
module TestConcat {
{
let result: _.LoDashImplicitArrayWrapper<number>;
result = _(1).concat<number>(2);
result = _(1).concat<number>(2, 3);
result = _(1).concat<number>(2, 3, 4);
result = _(1).concat(2);
result = _(1).concat(2, 3);
result = _(1).concat(2, 3, 4);
}
{
let result: _.LoDashImplicitArrayWrapper<string>;
result = _<string>(['']).concat<string>(['']);
result = _<string>(['']).concat<string>([''], ['']);
result = _<string>(['']).concat<string>([''], [''], ['']);
result = _<string>(['']).concat(['']);
result = _<string>(['']).concat([''], ['']);
result = _<string>(['']).concat([''], [''], ['']);
}
{
let result: _.LoDashImplicitArrayWrapper<{a: string}>;
result = _({a: ''}).concat<{a: string}>({a: ''});
result = _({a: ''}).concat<{a: string}>({a: ''}, {a: ''});
result = _({a: ''}).concat<{a: string}>({a: ''}, {a: ''}, {a: ''});
result = _({a: ''}).concat({a: ''});
result = _({a: ''}).concat({a: ''}, {a: ''});
result = _({a: ''}).concat({a: ''}, {a: ''}, {a: ''});
}
{
let result: _.LoDashExplicitArrayWrapper<number>;
result = _(1).chain().concat<number>(2);
result = _(1).chain().concat<number>(2, 3);
result = _(1).chain().concat<number>(2, 3, 4);
result = _(1).chain().concat(2);
result = _(1).chain().concat(2, 3);
result = _(1).chain().concat(2, 3, 4);
}
{
let result: _.LoDashExplicitArrayWrapper<string>;
result = _<string>(['']).chain().concat<string>(['']);
result = _<string>(['']).chain().concat<string>([''], ['']);
result = _<string>(['']).chain().concat<string>([''], [''], ['']);
result = _<string>(['']).chain().concat(['']);
result = _<string>(['']).chain().concat([''], ['']);
result = _<string>(['']).chain().concat([''], [''], ['']);
}
{
let result: _.LoDashExplicitArrayWrapper<{a: string}>;
result = _({a: ''}).chain().concat<{a: string}>({a: ''});
result = _({a: ''}).chain().concat<{a: string}>({a: ''}, {a: ''});
result = _({a: ''}).chain().concat<{a: string}>({a: ''}, {a: ''}, {a: ''});
result = _({a: ''}).chain().concat({a: ''});
result = _({a: ''}).chain().concat({a: ''}, {a: ''});
result = _({a: ''}).chain().concat({a: ''}, {a: ''}, {a: ''});
}
}
// _.prototype.plant
{
let result: _.LoDashWrapper<number>;
result = _(any).plant(42);
module TestPlant {
{
let result: _.LoDashImplicitWrapper<number>;
result = _(any).plant(42);
}
{
let result: _.LoDashImplicitStringWrapper;
result = _(any).plant('');
}
{
let result: _.LoDashImplicitWrapper<boolean>;
result = _(any).plant(true);
}
{
let result: _.LoDashImplicitNumberArrayWrapper;
result = _(any).plant([42]);
}
{
let result: _.LoDashImplicitArrayWrapper<any>;
result = _(any).plant<any>([]);
}
{
let result: _.LoDashImplicitObjectWrapper<{}>;
result = _(any).plant<{}>({});
}
{
let result: _.LoDashExplicitWrapper<number>;
result = _(any).chain().plant(42);
}
{
let result: _.LoDashExplicitStringWrapper;
result = _(any).chain().plant('');
}
{
let result: _.LoDashExplicitWrapper<boolean>;
result = _(any).chain().plant(true);
}
{
let result: _.LoDashExplicitNumberArrayWrapper;
result = _(any).chain().plant([42]);
}
{
let result: _.LoDashExplicitArrayWrapper<any>;
result = _(any).chain().plant<any>([]);
}
{
let result: _.LoDashExplicitObjectWrapper<{}>;
result = _(any).chain().plant<{}>({});
}
}
{
let result: _.LoDashStringWrapper;
result = _(any).plant('');
}
{
let result: _.LoDashWrapper<boolean>;
result = _(any).plant(true);
}
{
let result: _.LoDashNumberArrayWrapper;
result = _(any).plant([42]);
}
{
let result: _.LoDashArrayWrapper<any>;
result = _(any).plant<any>([]);
}
{
let result: _.LoDashObjectWrapper<{}>;
result = _(any).plant<{}>({});
// _.prototype.reverse
module TestReverse {
{
let result: _.LoDashImplicitArrayWrapper<number>;
result: _([42]).reverse();
}
{
let result: _.LoDashExplicitArrayWrapper<number>;
result: _([42]).chain().reverse();
}
}
/**************
@@ -1318,9 +1656,9 @@ result = <_.Dictionary<number>>_.countBy([4.3, 6.1, 6.4], function (num) { retur
result = <_.Dictionary<number>>_.countBy([4.3, 6.1, 6.4], function (num) { return this.floor(num); }, Math);
result = <_.Dictionary<number>>_.countBy(['one', 'two', 'three'], 'length');
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy(function (num) { return Math.floor(num); });
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy(function (num) { return this.floor(num); }, Math);
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_(['one', 'two', 'three']).countBy('length');
result = <_.LoDashImplicitObjectWrapper<_.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy(function (num) { return Math.floor(num); });
result = <_.LoDashImplicitObjectWrapper<_.Dictionary<number>>>_([4.3, 6.1, 6.4]).countBy(function (num) { return this.floor(num); }, Math);
result = <_.LoDashImplicitObjectWrapper<_.Dictionary<number>>>_(['one', 'two', 'three']).countBy('length');
// _.detect
module TestDetect {
@@ -1509,11 +1847,11 @@ result = <number[]>_.each([1, 2, 3], function (num) { console.log(num); });
result = <_.Dictionary<number>>_.each({ 'one': 1, 'two': 2, 'three': 3 }, function (num) { console.log(num); });
result = <IFoodType>_.each<IFoodType, string>({ name: 'apple', type: 'fruit' }, function (value, key) { console.log(value, key) });
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3]).forEach(function (num) { console.log(num); });
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).forEach(function (num) { console.log(num); });
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3]).forEach(function (num) { console.log(num); });
result = <_.LoDashImplicitObjectWrapper<_.Dictionary<number>>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).forEach(function (num) { console.log(num); });
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3]).each(function (num) { console.log(num); });
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).each(function (num) { console.log(num); });
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3]).each(function (num) { console.log(num); });
result = <_.LoDashImplicitObjectWrapper<_.Dictionary<number>>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).each(function (num) { console.log(num); });
result = <number[]>_.forEachRight([1, 2, 3], function (num) { console.log(num); });
result = <_.Dictionary<number>>_.forEachRight({ 'one': 1, 'two': 2, 'three': 3 }, function (num) { console.log(num); });
@@ -1521,11 +1859,11 @@ result = <_.Dictionary<number>>_.forEachRight({ 'one': 1, 'two': 2, 'three': 3 }
result = <number[]>_.eachRight([1, 2, 3], function (num) { console.log(num); });
result = <_.Dictionary<number>>_.eachRight({ 'one': 1, 'two': 2, 'three': 3 }, function (num) { console.log(num); });
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3]).forEachRight(function (num) { console.log(num); });
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).forEachRight(function (num) { console.log(num); });
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3]).forEachRight(function (num) { console.log(num); });
result = <_.LoDashImplicitObjectWrapper<_.Dictionary<number>>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).forEachRight(function (num) { console.log(num); });
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3]).eachRight(function (num) { console.log(num); });
result = <_.LoDashObjectWrapper<_.Dictionary<number>>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).eachRight(function (num) { console.log(num); });
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3]).eachRight(function (num) { console.log(num); });
result = <_.LoDashImplicitObjectWrapper<_.Dictionary<number>>>_(<{ [index: string]: number; }>{ 'one': 1, 'two': 2, 'three': 3 }).eachRight(function (num) { console.log(num); });
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);
@@ -1764,14 +2102,14 @@ result = <IFoodCombined[]>_(foodsCombined).reject({ 'type': 'fruit' }).value();
result = <number>_.sample([1, 2, 3, 4]);
result = <number[]>_.sample([1, 2, 3, 4], 2);
result = <_.LoDashWrapper<number>>_([1, 2, 3, 4]).sample();
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3, 4]).sample(2);
result = <_.LoDashImplicitWrapper<number>>_([1, 2, 3, 4]).sample();
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3, 4]).sample(2);
result = <number>_([1, 2, 3, 4]).sample().value();
result = <number[]>_([1, 2, 3, 4]).sample(2).value();
result = <number[]>_.shuffle([1, 2, 3, 4, 5, 6]);
result = <_.LoDashArrayWrapper<number>>_([1, 2, 3]).shuffle();
result = <_.LoDashArrayWrapper<_.Dictionary<string>>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).shuffle();
result = <_.LoDashImplicitArrayWrapper<number>>_([1, 2, 3]).shuffle();
result = <_.LoDashImplicitArrayWrapper<_.Dictionary<string>>>_(<{ [index: string]: string; }>{ 'key1': 'test1', 'key2': 'test2' }).shuffle();
result = <number>_.size([1, 2]);
result = <number>_([1, 2]).size();
@@ -1860,7 +2198,24 @@ result = <IStoogesCombined[]>_(stoogesCombined).where({ 'quotes': ['Poifect!'] }
* Date *
********/
result = <number>_.now();
module TestNow {
{
let result: number;
result = _.now();
result = _(42).now();
result = _<any>([]).now();
result = _({}).now();
}
{
let result: _.LoDashExplicitWrapper<number>;
result = _(42).chain().now();
result = _<any>([]).chain().now();
result = _({}).chain().now();
}
}
/*************
* Functions *
@@ -1963,8 +2318,8 @@ result = <number>_(testComposeSquareFn).compose<(n: number, m: number) => number
var createCallbackObj: { [index: string]: string; } = { name: 'Joe' };
result = <() => any>_.createCallback('name');
result = <() => boolean>_.createCallback(createCallbackObj);
result = <_.LoDashObjectWrapper<() => any>>_('name').createCallback();
result = <_.LoDashObjectWrapper<() => boolean>>_(createCallbackObj).createCallback();
result = <_.LoDashImplicitObjectWrapper<() => any>>_('name').createCallback();
result = <_.LoDashImplicitObjectWrapper<() => boolean>>_(createCallbackObj).createCallback();
// _.curry
var testCurryFn = (a: number, b: number, c: number) => [a, b, c];
@@ -2028,14 +2383,14 @@ source.addEventListener('message', <Function>_.debounce(function () { }, 250, {
'maxWait': 1000
}), false);
result = <_.LoDashObjectWrapper<Function>>_(function () { }).debounce(150);
result = <_.LoDashImplicitObjectWrapper<Function>>_(function () { }).debounce(150);
jQuery('#postbox').on('click', <_.LoDashObjectWrapper<Function>>_(function () { }).debounce(300, {
jQuery('#postbox').on('click', <_.LoDashImplicitObjectWrapper<Function>>_(function () { }).debounce(300, {
'leading': true,
'trailing': false
}));
source.addEventListener('message', <_.LoDashObjectWrapper<Function>>_(function () { }).debounce(250, {
source.addEventListener('message', <_.LoDashImplicitObjectWrapper<Function>>_(function () { }).debounce(250, {
'maxWait': 1000
}), false);
@@ -2043,11 +2398,11 @@ var returnedDebounce = _.throttle(function (a: any) { return a * 5; }, 5);
returnedThrottled(4);
result = <number>_.defer(function () { console.log('deferred'); });
result = <_.LoDashWrapper<number>>_(function () { console.log('deferred'); }).defer();
result = <_.LoDashImplicitWrapper<number>>_(function () { console.log('deferred'); }).defer();
var log = _.bind(console.log, console);
result = <number>_.delay(log, 1000, 'logged later');
result = <_.LoDashWrapper<number>>_(log).delay(1000, 'logged later');
result = <_.LoDashImplicitWrapper<number>>_(log).delay(1000, 'logged later');
// _.flow
var testFlowSquareFn = (n: number) => n * n;
@@ -2644,8 +2999,8 @@ result = <NameAge>_.assign({ 'name': 'moe' }, { 'age': 40 }, function (a, b) {
return typeof a == 'undefined' ? b : a;
});
result = <_.LoDashObjectWrapper<NameAge>>_({ 'name': 'moe' }).assign({ 'age': 40 });
result = <_.LoDashObjectWrapper<NameAge>>_({ 'name': 'moe' }).assign({ 'age': 40 }, function (a, b) {
result = <_.LoDashImplicitObjectWrapper<NameAge>>_({ 'name': 'moe' }).assign({ 'age': 40 });
result = <_.LoDashImplicitObjectWrapper<NameAge>>_({ 'name': 'moe' }).assign({ 'age': 40 }, function (a, b) {
return typeof a == 'undefined' ? b : a;
});
@@ -2654,8 +3009,8 @@ result = <NameAge>_.extend({ 'name': 'moe' }, { 'age': 40 }, function (a, b) {
return typeof a == 'undefined' ? b : a;
});
result = <_.LoDashObjectWrapper<NameAge>>_({ 'name': 'moe' }).extend({ 'age': 40 });
result = <_.LoDashObjectWrapper<NameAge>>_({ 'name': 'moe' }).extend({ 'age': 40 }, function (a, b) {
result = <_.LoDashImplicitObjectWrapper<NameAge>>_({ 'name': 'moe' }).extend({ 'age': 40 });
result = <_.LoDashImplicitObjectWrapper<NameAge>>_({ 'name': 'moe' }).extend({ 'age': 40 }, function (a, b) {
return typeof a == 'undefined' ? b : a;
});
@@ -2684,7 +3039,7 @@ interface Food {
}
var foodDefaults = { 'name': 'apple' };
result = <Food>_.defaults(foodDefaults, { 'name': 'banana', 'type': 'fruit' });
result = <_.LoDashObjectWrapper<Food>>_(foodDefaults).defaults({ 'name': 'banana', 'type': 'fruit' });
result = <_.LoDashImplicitObjectWrapper<Food>>_(foodDefaults).defaults({ 'name': 'banana', 'type': 'fruit' });
//_.defaultsDeep
interface DefaultsDeepResult {
@@ -2784,7 +3139,7 @@ result = <Dog>_.forIn(new Dog('Dagny'), function (value, key) {
console.log(key);
});
result = <_.LoDashObjectWrapper<Dog>>_(new Dog('Dagny')).forIn(function (value, key) {
result = <_.LoDashImplicitObjectWrapper<Dog>>_(new Dog('Dagny')).forIn(function (value, key) {
console.log(key);
});
@@ -2792,7 +3147,7 @@ result = <Dog>_.forInRight(new Dog('Dagny'), function (value, key) {
console.log(key);
});
result = <_.LoDashObjectWrapper<Dog>>_(new Dog('Dagny')).forInRight(function (value, key) {
result = <_.LoDashImplicitObjectWrapper<Dog>>_(new Dog('Dagny')).forInRight(function (value, key) {
console.log(key);
});
@@ -2806,7 +3161,7 @@ result = <ZeroOne>_.forOwn(<ZeroOne>{ '0': 'zero', '1': 'one', 'one': '2' }, fun
console.log(key);
});
result = <_.LoDashObjectWrapper<ZeroOne>>_({ '0': 'zero', '1': 'one', 'length': 2 }).forOwn(function (num, key) {
result = <_.LoDashImplicitObjectWrapper<ZeroOne>>_({ '0': 'zero', '1': 'one', 'length': 2 }).forOwn(function (num, key) {
console.log(key);
});
@@ -2814,15 +3169,15 @@ result = <any>_.forOwnRight({ '0': 'zero', '1': 'one', 'length': 2 }, function (
console.log(key);
});
result = <_.LoDashObjectWrapper<ZeroOne>>_({ '0': 'zero', '1': 'one', 'length': 2 }).forOwnRight(function (num, key) {
result = <_.LoDashImplicitObjectWrapper<ZeroOne>>_({ '0': 'zero', '1': 'one', 'length': 2 }).forOwnRight(function (num, key) {
console.log(key);
});
result = <string[]>_.functions(_);
result = <string[]>_.methods(_);
result = <_.LoDashArrayWrapper<string>>_(_).functions();
result = <_.LoDashArrayWrapper<string>>_(_).methods();
result = <_.LoDashImplicitArrayWrapper<string>>_(_).functions();
result = <_.LoDashImplicitArrayWrapper<string>>_(_).methods();
// _.get
result = <number>_.get<number>({ 'a': [{ 'b': { 'c': 3 } }] }, 'a[0].b.c');
+852 -635
View File
File diff suppressed because it is too large Load Diff
+3
View File
@@ -255,6 +255,7 @@ moment.locale('en', {
weekdaysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
weekdaysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
longDateFormat: {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM D YYYY",
@@ -376,6 +377,7 @@ moment.locale('en', {
moment.locale('en', {
longDateFormat : {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
l: "M/D/YYYY",
@@ -390,6 +392,7 @@ moment.locale('en', {
moment.locale('en', {
longDateFormat : {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM Do YYYY",
+3 -1
View File
@@ -19,7 +19,7 @@ declare module moment {
month?: number;
/** Month */
M?: number;
/** Week */
weeks?: number;
/** Week */
@@ -346,11 +346,13 @@ declare module moment {
LLL: string;
LLLL: string;
LT: string;
LTS: string;
l?: string;
ll?: string;
lll?: string;
llll?: string;
lt?: string;
lts?: string;
}
interface MomentRelativeTime {
+3
View File
@@ -266,6 +266,7 @@ moment.locale('en', {
weekdaysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"],
weekdaysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"],
longDateFormat: {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM D YYYY",
@@ -387,6 +388,7 @@ moment.locale('en', {
moment.locale('en', {
longDateFormat : {
LTS: "h:mm:ss A",
LT: "h:mm A",
L: "MM/DD/YYYY",
l: "M/D/YYYY",
@@ -401,6 +403,7 @@ moment.locale('en', {
moment.locale('en', {
longDateFormat : {
LTS: "h:mm A",
LT: "h:mm A",
L: "MM/DD/YYYY",
LL: "MMMM Do YYYY",
+8
View File
@@ -127,6 +127,14 @@ declare module "mongodb" {
// Creates an ObjectID from a hex string representation of an ObjectID.
// hexString create a ObjectID from a passed in 24 byte hexstring.
public static createFromHexString(hexString: string): ObjectID;
// Checks if a value is a valid bson ObjectId
// id - Value to be checked
public static isValid(id: string): Boolean;
// Generate a 12 byte id string used in ObjectID's
// time - optional parameter allowing to pass in a second based timestamp
public generate(time?: number): string;
}
// Class documentation : http://mongodb.github.io/node-mongodb-native/api-bson-generated/binary.html
+6 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for polymer v1.1.2
// Type definitions for polymer v1.1.5
// Project: https://github.com/Polymer/polymer
// Definitions by: Louis Grignon <https://github.com/lgrignon>, Suguru Inatomi <https://github.com/laco0416>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -161,7 +161,7 @@ declare module polymer {
getContentChildren?(selector: string): HTMLElement[];
fire?(type: string, detail?: Object, options?: Object): CustomEvent;
fire?(type: string, detail?: any, options?: Object): CustomEvent;
async?(callback: ()=>void, waitTime?: number): number;
@@ -177,6 +177,10 @@ declare module polymer {
create?(tag: string, props: Object): Element;
isLightDescendant?(node: HTMLElement): boolean;
isLocalDescendant?(node: HTMLElement): boolean
// XStyling
updateStyles?(): void;
+42 -8
View File
@@ -4,7 +4,7 @@
/// <reference path="../react-router/react-router.d.ts" />
/// <reference path="../object-assign/object-assign.d.ts" />
import { Component } from 'react';
import { Component, ReactElement } from 'react';
import * as React from 'react';
import * as Router from 'react-router';
import { Route, RouterState } from 'react-router';
@@ -23,13 +23,13 @@ interface CounterState {
declare var increment: Function;
class Counter extends Component<any, any> {
render() {
return (
<button onClick={this.props.onIncrement}>
{this.props.value}
</button>
);
}
render() {
return (
<button onClick={this.props.onIncrement}>
{this.props.value}
</button>
);
}
}
function mapStateToProps(state: CounterState) {
@@ -242,3 +242,37 @@ connect(mapStateToProps2, actionCreators, mergeProps)(TodoApp);
interface TestProp {
property1: number;
someOtherProperty?: string;
}
interface TestState {
isLoaded: boolean;
state1: number;
}
class TestComponent extends Component<TestProp, TestState> { }
const WrappedTestComponent = connect()(TestComponent);
// return value of the connect()(TestComponent) is of the type TestComponent
let ATestComponent: typeof TestComponent = null;
ATestComponent = TestComponent;
ATestComponent = WrappedTestComponent;
let anElement: ReactElement<TestProp>;
<TestComponent property1={42} />;
<WrappedTestComponent property1={42} />;
<ATestComponent property1={42} />;
class NonComponent {}
// this doesn't compile
//connect()(NonComponent);
// connect()(SomeClass) has the same constructor as SomeClass itself
class SomeClass extends Component<any, any> {
constructor(public foo: string) { super() }
public bar: number;
}
let bar: number = new (connect()(SomeClass))("foo").bar;
+2 -1
View File
@@ -10,8 +10,9 @@ declare module "react-redux" {
import { Component } from 'react';
import { Store, Dispatch, ActionCreator } from 'redux';
export class ElementClass extends Component<any, any> { }
export interface ClassDecorator {
<TFunction extends Function>(target: TFunction): TFunction|void;
<T extends (typeof ElementClass)>(component: T): T
}
/**
+59
View File
@@ -0,0 +1,59 @@
/// <reference path="reflux.d.ts" />
/// <reference path="../react/react.d.ts" />
import Reflux = require("reflux");
import React = require("react");
var syncActions = Reflux.createActions([
"statusUpdate",
"statusEdited",
"statusAdded"
]);
var asyncActions = Reflux.createActions({
fireBall: {asyncResult: true}
});
asyncActions.fireBall.listen(function () {
// Trigger async action
setTimeout(() => this.completed(true), 1000);
});
// Creates a DataStore
var statusStore = Reflux.createStore({
// Initial setup
init: function () {
// Register statusUpdate action
this.listenTo(asyncActions.fireBall, this.onFireBall);
},
// Callback
onFireBall: function (flag: boolean) {
var status = flag ? 'ONLINE' : 'OFFLINE';
// Pass on to listeners
this.trigger(status);
}
});
Reflux.createAction({
children: ["progressed", "completed", "failed"]
});
var actions = Reflux.createActions(["fireBall", "magicMissile"]);
var Store = Reflux.createStore({
init: function () {
this.listenToMany(actions);
},
onFireBall: function () {
// whoooosh!
},
onMagicMissile: function () {
// bzzzzapp!
}
});
+62
View File
@@ -0,0 +1,62 @@
// Type definitions for RefluxJS
// Project: https://github.com/reflux/refluxjs
// Definitions by: Maurice de Beijer <https://github.com/mauricedb>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module RefluxCore {
interface StoreDefinition {
listenables?: any[],
init?: Function,
getInitialState?: Function,
[propertyName: string]: any;
}
interface ListenFn {
(...params: any[]):any,
completed: Function,
failed: Function
}
interface Listenable {
listen: ListenFn
}
interface Subscription {
stop: Function,
listenable: Listenable
}
interface Store {
hasListener(listenable: Listenable): boolean,
listenToMany(listenables: Listenable[]): void,
validateListening(listenable: Listenable): string,
listenTo(listenable: Listenable, callback: Function, defaultCallback?: Function): Subscription,
stopListeningTo(listenable: Listenable): boolean,
stopListeningToAll(): void,
fetchInitialState(listenable: Listenable, defaultCallback: Function): void,
trigger(state: any):void;
}
interface ActionsDefinition {
[index: string]:any
}
interface Actions {
[index: string]: Listenable
}
function createStore(definition: StoreDefinition): Store;
function createAction(definition: ActionsDefinition): any;
function createActions(definition: ActionsDefinition): any;
function createActions(definitions: string[]): any;
function listenTo(store: Store, handler: string):void;
function setState(state: any):void;
}
declare module "reflux" {
export = RefluxCore;
}
+1 -1
View File
@@ -79,7 +79,7 @@ declare module 'request' {
method?: string;
headers?: Headers;
body?: any;
followRedirect?: boolean;
followRedirect?: boolean|((response: http.IncomingMessage) => boolean);
followAllRedirects?: boolean;
maxRedirects?: number;
encoding?: string;
+19 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for RequireJS 2.1.8
// Type definitions for RequireJS 2.1.20
// Project: http://requirejs.org/
// Definitions by: Josh Baldwin <https://github.com/jbaldwin/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -88,6 +88,10 @@ interface RequireConfig {
// baseUrl.
paths?: { [key: string]: any; };
// Allows configuring multiple module IDs to be found in
// another script.
bundles?: { [key: string]: any; };
// Dictionary of Shim's.
// does not cover case of key->string[]
shim?: { [key: string]: RequireShim; };
@@ -195,6 +199,20 @@ interface RequireConfig {
**/
scriptType?: string;
/**
* If set to true, skips the data-main attribute scanning done
* to start module loading. Useful if RequireJS is embedded in
* a utility library that may interact with other RequireJS
* library on the page, and the embedded version should not do
* data-main loading.
**/
skipDataMain?: boolean;
/**
* Allow extending requirejs to support Subresource Integrity
* (SRI).
**/
onNodeCreated?: (node: HTMLScriptElement, config: RequireConfig, moduleName: string, url: string) => void;
}
// todo: not sure what to do with this guy
+356 -5
View File
@@ -3,22 +3,373 @@
// Definitions by: Stefan Profanter <https://github.com/Pro/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/* ----------------------------------
NOTE: This typescript definition is not yet complete. I should be extended if definitions are missing.
---------------------------------- */
declare module ROSLIB {
export class Ros {
constructor(data: {
url: string
/**
* Manages connection to the server and all interactions with ROS.
*
* Emits the following events:
* * 'error' - there was an error with ROS
* * 'connection' - connected to the WebSocket server
* * 'close' - disconnected to the WebSocket server
* * <topicName> - a message came from rosbridge with the given topic name
* * <serviceID> - a service response came from rosbridge with the given ID
*
* @constructor
* @param options - possible keys include:
* * url (optional) - the WebSocket URL for rosbridge (can be specified later with `connect`)
*/
constructor(options:{
url?: string
});
on(eventName: string, callback: (event: any) => void) : void;
connect(url: string) : void;
on(eventName:string, callback:(event:any) => void):void;
/**
* Connect to the specified WebSocket.
*
* @param url - WebSocket URL for Rosbridge
*/
connect(url:string):void;
/**
* Disconnect from the WebSocket server.
*/
close():void;
/**
* Sends an authorization request to the server.
*
* @param mac - MAC (hash) string given by the trusted source.
* @param client - IP of the client.
* @param dest - IP of the destination.
* @param rand - Random string given by the trusted source.
* @param t - Time of the authorization request.
* @param level - User level as a string given by the client.
* @param end - End time of the client's session.
*/
authenticate(mac:string, client:string, dest:string, rand:string, t:number, level:string, end:string): void;
/**
* Sends the message over the WebSocket, but queues the message up if not yet
* connected.
*/
callOnConnection(message:any): void;
/**
* Retrieves list of topics in ROS as an array.
*
* @param callback function with params:
* * topics - Array of topic names
*/
getTopics(callback:(topics:string[]) => void, failedCallback:(error:any)=>void): void;
/**
* Retrieves Topics in ROS as an array as specific type
*
* @param topicType topic type to find:
* @param callback function with params:
* * topics - Array of topic names
*/
getTopicsForType(topicType:string, callback:(topics:string[]) => void, failedCallback:(error:any)=>void): void;
/**
* Retrieves list of active service names in ROS.
*
* @param callback - function with the following params:
* * services - array of service names
*/
getServices(callback:(services:string[]) => void, failedCallback:(error:any)=>void): void;
/**
* Retrieves list of services in ROS as an array as specific type
*
* @param serviceType service type to find:
* @param callback function with params:
* * topics - Array of service names
*/
getServicesForType(serviceType: string, callback:(services:string[]) => void, failedCallback:(error:any)=>void): void;
/**
* Retrieves list of active node names in ROS.
*
* @param callback - function with the following params:
* * nodes - array of node names
*/
getNodes(callback:(nodes:string[]) => void, failedCallback:(error:any)=>void): void;
/**
* Retrieves list of param names from the ROS Parameter Server.
*
* @param callback function with params:
* * params - array of param names.
*/
getParams(callback:(params:string[]) => void, failedCallback:(error:any)=>void): void;
/**
* Retrieves a type of ROS topic.
*
* @param topic name of the topic:
* @param callback - function with params:
* * type - String of the topic type
*/
getTopicType(topic: string, callback:(type:string) => void, failedCallback:(error:any)=>void): void;
/**
* Retrieves a type of ROS service.
*
* @param service name of service:
* @param callback - function with params:
* * type - String of the service type
*/
getServiceType(service: string, callback:(type:string) => void, failedCallback:(error:any)=>void): void;
/**
* Retrieves a detail of ROS message.
*
* @param callback - function with params:
* * details - Array of the message detail
* @param message - String of a topic type
*/
getMessageDetails(message: Message, callback:(detail:any) => void, failedCallback:(error:any)=>void): void;
/**
* Decode a typedefs into a dictionary like `rosmsg show foo/bar`
*
* @param defs - array of type_def dictionary
*/
decodeTypeDefs(defs: any): void;
}
export class Message {
/**
* Message objects are used for publishing and subscribing to and from topics.
*
* @constructor
* @param values - object matching the fields defined in the .msg definition file
*/
constructor(values:any);
}
export class Param {
/**
* A ROS parameter.
*
* @constructor
* @param options - possible keys include:
* * ros - the ROSLIB.Ros connection handle
* * name - the param name, like max_vel_x
*/
constructor(options:{
ros: Ros,
name: string
});
/**
* Fetches the value of the param.
*
* @param callback - function with the following params:
* * value - the value of the param from ROS.
*/
get(callback:(response:any) => void): void;
/**
* Sets the value of the param in ROS.
*
* @param value - value to set param to.
*/
set(value:any, callback:(response:any) => void): void;
/**
* Delete this parameter on the ROS server.
*/
delete(callback:(response:any) => void): void;
}
export class Service {
constructor(data: {
/**
* A ROS service client.
*
* @constructor
* @params options - possible keys include:
* * ros - the ROSLIB.Ros connection handle
* * name - the service name, like /add_two_ints
* * serviceType - the service type, like 'rospy_tutorials/AddTwoInts'
*/
constructor(data:{
ros: Ros,
name: string,
serviceType: string
});
/**
* Calls the service. Returns the service response in the callback.
*
* @param request - the ROSLIB.ServiceRequest to send
* @param callback - function with params:
* * response - the response from the service request
* @param failedCallback - the callback function when the service call failed (optional). Params:
* * error - the error message reported by ROS
*/
callService(request:ServiceRequest, callback:(response:any) => void, failedCallback?:(error:any) => void): void;
}
export class ServiceRequest {
/**
* A ServiceRequest is passed into the service call.
*
* @constructor
* @param values - object matching the fields defined in the .srv definition file
*/
constructor(values?: any);
}
export class ServiceResponse {
/**
* A ServiceResponse is returned from the service call.
*
* @constructor
* @param values - object matching the fields defined in the .srv definition file
*/
constructor(values?: any);
}
export class Topic {
/**
* Publish and/or subscribe to a topic in ROS.
*
* Emits the following events:
* * 'warning' - if there are any warning during the Topic creation
* * 'message' - the message data from rosbridge
*
* @constructor
* @param options - object with following keys:
* * ros - the ROSLIB.Ros connection handle
* * name - the topic name, like /cmd_vel
* * messageType - the message type, like 'std_msgs/String'
* * compression - the type of compression to use, like 'png'
* * throttle_rate - the rate (in ms in between messages) at which to throttle the topics
* * queue_size - the queue created at bridge side for re-publishing webtopics (defaults to 100)
* * latch - latch the topic when publishing
* * queue_length - the queue length at bridge side used when subscribing (defaults to 0, no queueing).
*/
constructor(options: {
ros: Ros,
name: string,
messageType: string,
compression: string,
throttle_rate: number,
queue_size: number,
latch: number,
queue_length: number
});
/**
* Every time a message is published for the given topic, the callback
* will be called with the message object.
*
* @param callback - function with the following params:
* * message - the published message
*/
subscribe(callback: (message: Message) => void): void;
/**
* Unregisters as a subscriber for the topic. Unsubscribing stop remove
* all subscribe callbacks. To remove a call back, you must explicitly
* pass the callback function in.
*
* @param callback - the optional callback to unregister, if
* * provided and other listeners are registered the topic won't
* * unsubscribe, just stop emitting to the passed listener
*/
unsubscribe(callback?: () => void): void;
/**
* Registers as a publisher for the topic.
*/
advertise(): void;
/**
* Unregisters as a publisher for the topic.
*/
unadvertise(): void;
/**
* Publish the message.
*
* @param message - A ROSLIB.Message object.
*/
publish(message: Message): void;
}
class ActionClient {
/**
* An actionlib action client.
*
* Emits the following events:
* * 'timeout' - if a timeout occurred while sending a goal
* * 'status' - the status messages received from the action server
* * 'feedback' - the feedback messages received from the action server
* * 'result' - the result returned from the action server
*
* @constructor
* @param options - object with following keys:
* * ros - the ROSLIB.Ros connection handle
* * serverName - the action server name, like /fibonacci
* * actionName - the action message name, like 'actionlib_tutorials/FibonacciAction'
* * timeout - the timeout length when connecting to the action server
*/
constructor(options: {
ros: Ros,
serverName: string,
actionName: string,
timeout: number
});
/**
* Cancel all goals associated with this ActionClient.
*/
cancel(): void;
}
class Goal {
/**
* An actionlib goal goal is associated with an action server.
*
* Emits the following events:
* * 'timeout' - if a timeout occurred while sending a goal
*
* @constructor
* @param object with following keys:
* * actionClient - the ROSLIB.ActionClient to use with this goal
* * goalMessage - The JSON object containing the goal for the action server
*/
constructor(options: {
actionClient: ActionClient,
goalMessage: any
});
/**
* Send the goal to the action server.
*
* @param timeout (optional) - a timeout length for the goal's result
*/
send(timeout?: number): void;
/**
* Cancel the current goal.
*/
cancel(): void;
}
}
+14
View File
@@ -72,6 +72,11 @@ interface Select2Options {
dropdownCssClass?: any;
escapeMarkup?: (markup: string) => string;
theme?: string;
/**
* Template can return both plain string that will be HTML escaped and a jquery object that can render HTML
*/
templateSelection?: (object: Select2SelectionObject) => any;
templateResult?: (object: Select2SelectionObject) => any;
}
interface Select2JQueryEventObject extends JQueryEventObject {
@@ -84,6 +89,15 @@ interface Select2JQueryEventObject extends JQueryEventObject {
};
}
interface Select2SelectionObject {
disabled: boolean,
element: HTMLOptionElement,
id: string,
selected: boolean,
text: string,
title: string,
}
interface JQuery {
off(events?: "change", selector?: any, handler?: (eventObject: Select2JQueryEventObject) => any): JQuery;
@@ -0,0 +1,17 @@
///<reference path="simplestorage.js.d.ts"/>
var versionTest: string = simpleStorage.version;
var canUseTest: boolean = simpleStorage.canUse();
var simpleStorageTest1: boolean|Error = simpleStorage.set("string", 7);
var simpleStorageTest2: boolean|Error = simpleStorage.set("string", 7, {});
var simpleStorageTest3: boolean|Error = simpleStorage.set("string", 7, { TTL: 7 });
var simpleStorageTest4: boolean|Error = simpleStorage.set("string", undefined);
var simpleStorageTest5: boolean|Error = simpleStorage.set("string", undefined, {});
var simpleStorageTest6: boolean|Error = simpleStorage.set("string", undefined, { TTL: 7 });
var getTest: any = simpleStorage.get("string");
var deleteKeyTest: boolean|Error = simpleStorage.deleteKey("string");
var setTTLTest: boolean|Error = simpleStorage.setTTL("string", 7);
var getTTLTest: number|boolean = simpleStorage.getTTL("string");
var flushTest: boolean|Error = simpleStorage.flush();
var indexTest: [string]|boolean = simpleStorage.index();
var storageSizeTest: number = simpleStorage.storageSize();
+110
View File
@@ -0,0 +1,110 @@
// Type definitions for simpleStorage v0.1.3
// Project: https://github.com/andris9/simpleStorage
// Definitions by: Áxel Costas Pena <https://github.com/axelcostaspena>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module simplestoragejs {
/**
* {@link simpleStorage} API is a subset of {@link http://www.jstorage.info/|jStorage} with slight modifications, so for most cases it should work out of the box if you are converting from {@link http://www.jstorage.info/|jStorage}. Main difference is between return values - if an action failed because of an error (storage full, storage not available, invalid data used etc.), you get the error object as the return value. {@link http://www.jstorage.info/|jStorage} never indicated anything if an error occurred.
* @see https://github.com/andris9/simpleStorage#usage
*/
export interface SimpleStorage {
version: string;
/**
* Check if local storage can be used.
* Returns <code>true</code> if storage is available.
* @see https://github.com/andris9/simpleStorage#canuse
*/
canUse(): boolean;
/**
* Store or update a value in local storage.
* Returns <code>true</code> if value was stored, <code>false</code> if value was not stored or <code>{@link Error}</code> object if value was not stored because of an error.
* @param key The key for the value.
* @param value Value to be stored (can be any JSONeable value).
* @param [options] Optional options object.
* @see https://github.com/andris9/simpleStorage#setkey-value-options
*/
set(key: string, value: any, options?: SetOptions): boolean|Error;
/**
* Retrieve a value from local storage.
* Returns the value for a key or undefined if the key was not found.
* @param key The key to be retrieved.
* @see https://github.com/andris9/simpleStorage#getkey
*/
get(key: string): any;
/**
* Removes a value from local storage.
* Returns <code>true</code> if the value was deleted, <code>false</code> if the value was not found or <code>{@link Error}</code> object if value was not deleted because of an error.
* @param key The key to be deleted.
* @see https://github.com/andris9/simpleStorage#deletekeykey
*/
deleteKey(key: string): boolean|Error;
/**
* Set a millisecond timeout. When the timeout is reached, the key is removed automatically from local storage.
* Returns <code>true</code> if ttl was set, <code>false</code> if value was not found or <code>{@link Error}</code> object if ttl was not set because of an error.
* @param key The key to be updated.
* @param ttl Timeout in milliseconds. If the value is 0, timeout is cleared from the key.
* @see https://github.com/andris9/simpleStorage#setttlkey-ttl
*/
setTTL(key: string, ttl: number): boolean|Error;
/**
* Retrieve remaining milliseconds for a key with TTL.
* Returns the finite number of remaining milliseconds, <code>Infinity</code> if TTL is not set for the selected key or <code>false</code> if the selected key does not exist or is expired.
* @param key The key to be checked.
* @see https://github.com/andris9/simpleStorage#getttlkey
*/
getTTL(key: string): number|boolean;
/**
* Clear all values.
* Returns <code>true</code> if storage was flushed or <code>{@link Error}</code> object if storage was not flushed because of an error.
* @see https://github.com/andris9/simpleStorage#flush
*/
flush(): boolean|Error;
/**
* Retrieve all used keys as an array.
* Returns an array of keys.
* @see https://github.com/andris9/simpleStorage#index
*/
index(): [string]|boolean;
/**
* Get used storage in symbol count.
* @see https://github.com/andris9/simpleStorage#storagesize
*/
storageSize(): number;
}
/**
* @see https://github.com/andris9/simpleStorage#setkey-value-options
*/
export interface SetOptions {
/**
* Sets the time-to-live (TTL) value in milliseconds for the given key/value.
*/
TTL?: number;
}
}
declare module "simpleStorage" {
export = simpleStorage;
}
/**
* Cross-browser key-value store database to store data locally in the browser.
* {@link simpleStorage} is a fork of {@link http://www.jstorage.info/|jStorage} that only includes the minimal set of features. Basically it is a wrapper for native <code>{@link JSON}</code> + <code>{@link WindowLocalStorage.localStorage|localStorage}</code> with some TTL magic mixed in.
* The module has no dependencies, you can use it as a standalone script (introduces {@link simpleStorage} global) or as an AMD module. All modern browsers (including mobile) are supported, older browsers (IE7, Firefox 3) are not.
* {@link simpleStorage} is very small - about 1kB in size when minimized and gzipped.
* @see https://github.com/andris9/simpleStorage#simplestorage
*/
declare var simpleStorage:simplestoragejs.SimpleStorage;
+15
View File
@@ -1038,6 +1038,12 @@ declare module uiGrid {
* @param {scrollEndHandler} handler callback
*/
scrollEnd: (scope: ng.IScope, handler: scrollEndHandler) => void;
/**
* is raised after the sort criteria on one or more columns have changed
* @param {ng.IScope} scope Grid scope
* @param {sortChangedHandler} handler callback
*/
sortChanged: (scope: ng.IScope, handler: sortChangedHandler<TEntity>) => void;
}
}
export interface columnVisibilityChangedHandler<TEntity> {
@@ -1096,6 +1102,15 @@ declare module uiGrid {
(scrollEvent: JQueryMouseEventObject): void;
}
export interface sortChangedHandler<TEntity> {
/**
* Sort change event callback
* @param {IGridInstance} grid instance
* @param {IGridColumn} array of gridColumns that have sorting on them, sorted in priority order
*/
(grid: IGridInstanceOf<TEntity>, columns: Array<IGridColumnOf<TEntity>>): void;
}
export module cellNav {
/**
* Column Definitions for cellNav feature, these are available to be set using the ui-grid
+2
View File
@@ -0,0 +1,2 @@
tsconfig.json
.idea/
+88
View File
@@ -0,0 +1,88 @@
# UIkit
UIkit is a lightweight and modular front-end framework for developing fast and powerful web interfaces.
* [Homepage](http://getuikit.com) - Learn more about UIkit
* [@getuikit](https://twitter.com/getuikit) - Get the latest buzz on Twitter
* [Google+ Community](https://plus.google.com/communities/114238665434626719878) - Share news and latest work
Join our developer chat. We are online every work day between 8:00 and 18:00 UTC
[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/uikit/uikit)
## Getting started
You have following options to get UIkit:
- Download the [latest release](https://github.com/uikit/uikit/releases/latest)
- Clone the repo, `git clone git://github.com/uikit/uikit.git`.
- Install with [Bower](http://bower.io): ```bower install uikit```
You find the compiled UIkit distribution in its own [repo](https://github.com/uikit/bower-uikit).
## Developers
First of all, install [Node](http://nodejs.org/). We use [Gulp](http://gulpjs.com) to build UIkit. If you haven't used Gulp before, you need to install the `gulp` package as a global install.
```
npm install --global gulp
```
If you haven't done so already, clone the UIkit git repo.
```
git clone git://github.com/uikit/uikit.git
```
Install the Node dependencies.
```
cd uikit
npm install
```
Run `gulp` to lint, build and minify the release.
```
gulp [-t themename]
```
The built version of UIkit will be put in the `/dist` subdirectory. Pass a theme name parameter to only build the specified theme.
### Browsersync
```
gulp sync
```
After running `gulp sync` a new browser instance will open, pointing to the uikit folder - `http://localhost:3000/`. The browser window will reload anytime you modify a source file.
### Custom prefix
Run gulp with your own prefix parameter ```-p``` to have all classes and JavaScript files custom prefixed.
```
gulp -p myprefix
```
## Contributing
UIkit follows the [GitFlow branching model](http://nvie.com/posts/a-successful-git-branching-model). The ```master``` branch always reflects a production-ready state while the latest development is taking place in the ```develop``` branch.
Each time you want to work on a fix or a new feature, create a new branch based on the ```develop``` branch: ```git checkout -b BRANCH_NAME develop```. Only pull requests to the ```develop``` branch will be merged.
## Versioning
UIkit is maintained by using the [Semantic Versioning Specification (SemVer)](http://semver.org).
## Browser Support
![Chrome](https://raw.github.com/alrra/browser-logos/master/chrome/chrome_48x48.png) | ![Firefox](https://raw.github.com/alrra/browser-logos/master/firefox/firefox_48x48.png) | ![IE](https://raw.github.com/alrra/browser-logos/master/internet-explorer/internet-explorer_48x48.png) | ![Safari](https://raw.github.com/alrra/browser-logos/master/safari/safari_48x48.png) | ![Opera](https://raw.github.com/alrra/browser-logos/master/opera/opera_48x48.png)
--- | --- | --- | --- | --- |
Latest ✔ | Latest ✔ | 9+ ✔ | 7.1+ ✔ | Latest ✔ |
Tested with [BrowserStack](https://www.browserstack.com) (thanks for sponsoring!).
## Copyright and License
Copyright [YOOtheme](http://www.yootheme.com) GmbH under the [MIT license](LICENSE.md).
+186
View File
@@ -0,0 +1,186 @@
/// <reference path="uikit.d.ts" />
function testModal() {
UIkit.modal.alert("Attention!");
UIkit.modal.confirm("Are you sure?", function () {
// will be executed on confirm.
});
UIkit.modal.prompt("Name:", 'value', function (newvalue:string) {
// will be executed on submit.
});
var modal = UIkit.modal.blockUI("Any content...");
modal.hide();
modal.show();
var modal = UIkit.modal(".modalSelector");
if (modal.isActive()) {
modal.hide();
} else {
modal.show();
}
}
function testOffCanvas() {
UIkit.offcanvas.show("#id");
UIkit.offcanvas.hide();
UIkit.offcanvas.hide(true);
}
function testLightBox() {
var element = "#group";
var lightbox = UIkit.lightbox(element, {/* options */});
var lightbox2 = UIkit.lightbox.create([
{source: 'http://url/to/video.mp4', 'type': 'video'},
{'source': 'http://url/to/image.jpg', 'type': 'image'}
]);
lightbox2.show();
var lightbox3 = UIkit.lightbox(element)
}
function testAutoComplete() {
UIkit.autocomplete("#group", {});
UIkit.autocomplete("#group");
}
function testDatepicker() {
var datepicker = UIkit.datepicker("#element", {});
}
function testHtmlEditor() {
var htmleditor = UIkit.htmleditor("textarea", {/* options */});
}
function testSlider() {
var slider = UIkit.slider("element", {})
}
function testSlideSet() {
var slideset = UIkit.slideset("element", {})
}
function testSlideShow() {
var slideshow = UIkit.slideshow("element", {})
}
function testParallax() {
var parallax = UIkit.parallax("element", {})
}
function testAccordion() {
var accordion = UIkit.accordion("element", {})
}
function testNotify() {
UIkit.notify({
message: 'Bazinga!',
status: 'info',
timeout: 5000,
pos: 'top-center'
});
// Shortcuts
UIkit.notify('My message');
UIkit.notify('My message', status);
UIkit.notify('My message', {/* options */});
UIkit.notify("Message...", {timeout: 0});
UIkit.notify("...", {pos: 'top-center'});
UIkit.notify("...", {status: 'info'});
}
function testSearch() {
var search = UIkit.search("element", {})
}
function testNestable() {
var nestable = UIkit.nestable('element', {});
}
function testSortable() {
var sortable = UIkit.sortable('element', {});
}
function testStick() {
var sticky = UIkit.sticky('element', {});
}
function testTimePicker() {
var timepicker = UIkit.timepicker('element', {})
}
function testTooltip() {
var tooltip = UIkit.tooltip('element', {})
}
function testUpload() {
$(function(){
var progressbar = $("#progressbar"),
bar = progressbar.find('.uk-progress-bar'),
settings = {
action: '/', // upload url
allow : '*.(jpg|jpeg|gif|png)', // allow only images
loadstart: function() {
bar.css("width", "0%").text("0%");
progressbar.removeClass("uk-hidden");
},
progress: function(percent: number) {
percent = Math.ceil(percent);
bar.css("width", percent+"%").text(percent+"%");
},
allcomplete: function(response: any) {
bar.css("width", "100%").text("100%");
setTimeout(function(){
progressbar.addClass("uk-hidden");
}, 250);
alert("Upload Completed")
}
};
var select = UIkit.uploadSelect($("#upload-select"), settings),
drop = UIkit.uploadDrop($("#upload-drop"), settings);
});
// Test with object literal
var select2 = UIkit.uploadSelect($("#upload-select"), {
action: '/', // upload url
allow: '*.(jpg|jpeg|gif|png)', // allow only images
loadstart: function () {
},
progress: function (percent:number) {
},
allcomplete: function (response:any) {
}
});
var drop2 = UIkit.uploadDrop($("#upload-drop"), {
action: '/', // upload url
allow: '*.(jpg|jpeg|gif|png)', // allow only images
loadstart: function () {
},
progress: function (percent:number) {
},
allcomplete: function (response:any) {
}
});
}
+1443
View File
File diff suppressed because it is too large Load Diff
+9
View File
@@ -0,0 +1,9 @@
/// <reference path="./utils-merge.d.ts" />
import merge from "utils-merge";
type Result = {a: string, b: number};
let result: Result;
result = merge<{a: string}, {b: number}, Result>({a: ''}, {b: 42});
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for utils-merge
// Project: https://github.com/jaredhanson/utils-merge
// Definitions by: Ilya Mochalov <https://github.com/chrootsu>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "utils-merge" {
function merge<TA, TB, TResult>(a: TA, b: TB): TResult;
export default merge;
}
+6 -2
View File
@@ -3,7 +3,7 @@
// Definitions by: Alexey Aylarov <https://github.com/aylarov/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module VoxImplant {
declare namespace VoxImplant {
module Events {
@@ -727,7 +727,7 @@ declare module VoxImplant {
*
* @param config Client configuration options
*/
init(config: Config): void;
init(config?: Config): void;
/**
* Check if WebRTC support is available
*/
@@ -1163,3 +1163,7 @@ declare module VoxImplant {
function version(): String;
}
declare module "voximplant-websdk" {
export = VoxImplant;
}
+15
View File
@@ -0,0 +1,15 @@
/// <reference path="./webpack-env.d.ts" />
interface SomeModule {
someMethod(): void;
}
let someModule = require<SomeModule>('./someModule');
someModule.someMethod();
let context = require.context('./somePath', true);
let contextModule = context<SomeModule>('./someModule');
require(['./someModule', './otherModule'], (someModule: SomeModule, otherModule: any) => {
});
+103
View File
@@ -0,0 +1,103 @@
// Type definitions for webpack 1.12.2 (module API)
// Project: https://github.com/webpack/webpack
// Definitions by: use-strict <https://github.com/use-strict>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/**
* Webpack module API - variables and global functions available inside modules
*/
declare namespace __WebpackModuleApi {
interface RequireContext {
keys(): string[];
<T>(id: string): T;
resolve(id: string): string;
}
interface RequireFunction {
/**
* Returns the exports from a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available.
*/
<T>(path: string): T;
/**
* Behaves similar to require.ensure, but the callback is called with the exports of each dependency in the paths array. There is no option to provide a chunk name.
*/
(paths: string[], callback: (...modules: any[]) => void): void;
/**
* Download additional dependencies on demand. The paths array lists modules that should be available. When they are, callback is called. If the callback is a function expression, dependencies in that source part are extracted and also loaded on demand. A single request is fired to the server, except if all modules are already available.
*
* This creates a chunk. The chunk can be named. If a chunk with this name already exists, the dependencies are merged into that chunk and that chunk is used.
*/
ensure: (paths: string[], callback: (require: <T>(path: string) => T) => void) => void;
context: (path: string, deep?: boolean, filter?: RegExp) => RequireContext;
/**
* Returns the module id of a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available.
*
* The module id is a number in webpack (in contrast to node.js where it is a string, the filename).
*/
resolve(path: string): number;
/**
* Like require.resolve, but doesnt include the module into the bundle. Its a weak dependency.
*/
resolveWeak(path: string): number;
/**
* Ensures that the dependency is available, but dont execute it. This can be use for optimizing the position of a module in the chunks.
*/
include(path: string): void;
/**
* Multiple requires to the same module result in only one module execution and only one export. Therefore a cache in the runtime exists. Removing values from this cache cause new module execution and a new export. This is only needed in rare cases (for compatibility!).
*/
cache: {
[id: string]: any;
}
}
}
declare var require: __WebpackModuleApi.RequireFunction;
/**
* The resource query of the current module.
*
* e.g. __resourceQuery === "?test" // Inside "file.js?test"
*/
declare var __resourceQuery: string;
/**
* Equals the config options output.publicPath.
*/
declare var __webpack_public_path__: string;
/**
* The raw require function. This expression isnt parsed by the Parser for dependencies.
*/
declare var __webpack_require__: any;
/**
* The internal chunk loading function
*
* @param chunkId The id for the chunk to load.
* @param callback A callback function called once the chunk is loaded.
*/
declare var __webpack_chunk_load__: (chunkId: any, callback: (require: (id: string) => any) => void) => void;
/**
* Access to the internal object of all modules.
*/
declare var __webpack_modules__: any[];
/**
* Access to the hash of the compilation.
*
* Only available with the HotModuleReplacementPlugin or the ExtendedAPIPlugin
*/
declare var __webpack_hash__: any;
/**
* Generates a require function that is not parsed by webpack. Can be used to do cool stuff with a global require function if available.
*/
declare var __non_webpack_require__: any;
/**
* Equals the config option debug
*/
declare var DEBUG: boolean;
-19
View File
@@ -386,22 +386,3 @@ plugin = new webpack.ExtendedAPIPlugin();
plugin = new webpack.NoErrorsPlugin();
plugin = new webpack.WatchIgnorePlugin(paths);
//
// http://webpack.github.io/docs/api-in-modules.html
//
interface SomeModule {
someMethod(): void;
}
let someModule: SomeModule = require('./someModule');
someModule.someMethod();
let context2 = require.context('./somePath', true);
let contextModule: SomeModule = context2('./someModule');
require(['./someModule', './otherModule'], (someModule: SomeModule, otherModule: any) => {
});
-98
View File
@@ -259,101 +259,3 @@ declare module "webpack" {
export = webpack;
}
/**
* Webpack module API - variables and global functions available inside modules
*/
declare namespace __WebpackModuleApi {
interface RequireContext {
keys(): string[];
<T>(id: string): T;
resolve(id: string): string;
}
interface RequireFunction {
/**
* Returns the exports from a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available.
*/
<T>(path: string): T;
/**
* Behaves similar to require.ensure, but the callback is called with the exports of each dependency in the paths array. There is no option to provide a chunk name.
*/
(paths: string[], callback: (...modules: any[]) => void): void;
/**
* Download additional dependencies on demand. The paths array lists modules that should be available. When they are, callback is called. If the callback is a function expression, dependencies in that source part are extracted and also loaded on demand. A single request is fired to the server, except if all modules are already available.
*
* This creates a chunk. The chunk can be named. If a chunk with this name already exists, the dependencies are merged into that chunk and that chunk is used.
*/
ensure: (paths: string[], callback: (require: <T>(path: string) => T) => void) => void;
context: (path: string, deep?: boolean, filter?: RegExp) => RequireContext;
/**
* Returns the module id of a dependency. The call is sync. No request to the server is fired. The compiler ensures that the dependency is available.
*
* The module id is a number in webpack (in contrast to node.js where it is a string, the filename).
*/
resolve(path: string): number;
/**
* Like require.resolve, but doesnt include the module into the bundle. Its a weak dependency.
*/
resolveWeak(path: string): number;
/**
* Ensures that the dependency is available, but dont execute it. This can be use for optimizing the position of a module in the chunks.
*/
include(path: string): void;
/**
* Multiple requires to the same module result in only one module execution and only one export. Therefore a cache in the runtime exists. Removing values from this cache cause new module execution and a new export. This is only needed in rare cases (for compatibility!).
*/
cache: {
[id: string]: any;
}
}
}
declare var require: __WebpackModuleApi.RequireFunction;
/**
* The resource query of the current module.
*
* e.g. __resourceQuery === "?test" // Inside "file.js?test"
*/
declare var __resourceQuery: string;
/**
* Equals the config options output.publicPath.
*/
declare var __webpack_public_path__: string;
/**
* The raw require function. This expression isnt parsed by the Parser for dependencies.
*/
declare var __webpack_require__: any;
/**
* The internal chunk loading function
*
* @param chunkId The id for the chunk to load.
* @param callback A callback function called once the chunk is loaded.
*/
declare var __webpack_chunk_load__: (chunkId: any, callback: (require: (id: string) => any) => void) => void;
/**
* Access to the internal object of all modules.
*/
declare var __webpack_modules__: any[];
/**
* Access to the hash of the compilation.
*
* Only available with the HotModuleReplacementPlugin or the ExtendedAPIPlugin
*/
declare var __webpack_hash__: any;
/**
* Generates a require function that is not parsed by webpack. Can be used to do cool stuff with a global require function if available.
*/
declare var __non_webpack_require__: any;
/**
* Equals the config option debug
*/
declare var DEBUG: boolean;
+2473 -820
View File
File diff suppressed because it is too large Load Diff
+20 -8
View File
@@ -8,6 +8,7 @@ import TokenOpts = X.TokenOpts;
var exp: RegExp;
var expArr: RegExp[];
var expArrArr: RegExp[][];
var chain: RegExp[];
var groupChain: { regex: RegExp; backref: string }[];
var groupChain1: { regex: RegExp; backref: number }[];
@@ -19,6 +20,7 @@ var search: string;
var searchEx: RegExp;
var bool: boolean;
var strArr: string[];
var strArrArr: string[][];
var pattern: string;
var flags: string;
var right: string;
@@ -42,6 +44,14 @@ str = XRegExp.version;
// -- -- -- -- -- -- -- -- -- -- -- -- --
regex = X(str);
regex = X(str, flags);
regex = X(regex);
str = X.version;
// -- -- -- -- -- -- -- -- -- -- -- -- --
XRegExp.addToken(regex, (arr, scope) => {
matchArr = arr;
str = scope;
@@ -69,13 +79,6 @@ matchArr = XRegExp.exec(str, regex);
// -- -- -- -- -- -- -- -- -- -- -- -- --
matchArr = XRegExp.forEach(str, regex, (match, index, input, regexp) => {
exp = regexp;
str = input;
num = index;
matchArr = match;
}, obj);
matchArr = XRegExp.forEach(str, regex, (match, index, input, regexp) => {
exp = regexp;
str = input;
@@ -92,6 +95,11 @@ XRegExp.install(obj);
bool = XRegExp.isInstalled(str);
bool = XRegExp.isRegExp(value);
strArr = XRegExp.match(str, regex);
strArr = XRegExp.match(str, regex, scope);
str = XRegExp.match(str, regex, "one");
strArr = XRegExp.matchChain(str, chain);
strArr = XRegExp.matchChain(str, groupChain);
strArr = XRegExp.matchChain(str, groupChain1);
@@ -113,6 +121,11 @@ str = XRegExp.replace(str, searchEx, str);
str = XRegExp.replace(str, searchEx, replacer, scope);
str = XRegExp.replace(str, searchEx, replacer);
// -- -- -- -- -- -- -- -- -- -- -- -- --
str = XRegExp.replaceEach(str, expArrArr);
str = XRegExp.replaceEach(str, strArrArr);
str = XRegExp.replaceEach(str, [[str, exp], [str, exp]]);
// -- -- -- -- -- -- -- -- -- -- -- -- --
strArr = XRegExp.split(str, search, limit);
@@ -135,4 +148,3 @@ regex = XRegExp.union(strArr, flags);
regex = XRegExp.union(strArr);
// -- -- -- -- -- -- -- -- -- -- -- -- --
+95 -23
View File
@@ -1,38 +1,58 @@
// Type definitions for XRegExp 2.0.0
// Type definitions for XRegExp 3.0.0
// Project: http://xregexp.com
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>,
// Johannes Fahrenkrug <https://github.com/jfahrenkrug>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module 'xregexp' {
// scopes: 'default', 'class', or 'all'
/*
Native flags:
g - global
i - ignore case
m - multiline anchors
y - sticky (Firefox 3+)
Additional XRegExp flags:
n - explicit capture
s - dot matches all (aka singleline)
x - free-spacing and line comments (aka extended)
*/
export interface TokenOpts {
scope?: string;
trigger?: () => boolean;
customFlags?: string;
}
export function XRegExp(pattern: string, flags?: string): RegExp;
export function XRegExp(pattern: RegExp): RegExp;
function OuterXRegExp(pattern: string, flags?: string): RegExp;
function OuterXRegExp(pattern: RegExp): RegExp;
export module XRegExp {
module OuterXRegExp {
// scopes: 'default', 'class', or 'all'
/*
Native flags:
g - global
i - ignore case
m - multiline anchors
y - sticky (Firefox 3+)
Additional XRegExp flags:
n - explicit capture
s - dot matches all (aka singleline)
x - free-spacing and line comments (aka extended)
*/
interface TokenOpts {
scope?: string;
trigger?: () => boolean;
customFlags?: string;
}
function XRegExp(pattern: string, flags?: string): RegExp;
function XRegExp(pattern: RegExp): RegExp;
/* Since xregexp 3.0.0 can be used either via
import X = require('xregexp');
X();
or via
import XRegExp = X.XRegExp;
XRegExp()
I had to duplicate the function declarations. I could simply not
find another way to accomplish this with TypeScript.
*/
// begin API definitions
function addToken(regex: RegExp, handler: (matchArr: RegExpExecArray, scope: string) => string, options?: TokenOpts): void;
function build(pattern: string, subs: string[], flags?: string): RegExp;
function cache(pattern: string, flags?: string): RegExp;
function escape(str: string): string;
function exec(str: string, regex: RegExp, pos?: number, sticky?: boolean): RegExpExecArray;
function forEach(str: string, regex: RegExp, callback: (matchArr: RegExpExecArray, index: number, input: string, regexp: RegExp) => void, context?: Object): any;
function forEach(str: string, regex: RegExp, callback: (matchArr: RegExpExecArray, index: number, input: string, regexp: RegExp) => void): any;
function globalize(regex: RegExp): RegExp;
function install(options: string): void;
@@ -40,6 +60,10 @@ declare module 'xregexp' {
function isInstalled(feature: string): boolean;
function isRegExp(value: any): boolean;
function match(str: string, regex: RegExp, scope: string): any;
function match(str: string, regex: RegExp, scope: "one"): string;
function match(str: string, regex: RegExp, scope: "all"): string[];
function match(str: string, regex: RegExp): string[];
function matchChain(str: string, chain: RegExp[]): string[];
function matchChain(str: string, chain: { regex: RegExp; backref: string }[]): string[];
function matchChain(str: string, chain: { regex: RegExp; backref: number }[]): string[];
@@ -49,6 +73,7 @@ declare module 'xregexp' {
function replace(str: string, search: string, replacement: Function, scope?: string): string;
function replace(str: string, search: RegExp, replacement: string, scope?: string): string;
function replace(str: string, search: RegExp, replacement: Function, scope?: string): string;
function replaceEach(str: string, replacements: Array<RegExp|string>[]): string;
function split(str: string, separator: string, limit?: number): string[];
function split(str: string, separator: RegExp, limit?: number): string[];
@@ -60,5 +85,52 @@ declare module 'xregexp' {
function union(patterns: string[], flags?: string): RegExp;
var version: string;
// end API definitions
module XRegExp {
// begin API definitions
function addToken(regex: RegExp, handler: (matchArr: RegExpExecArray, scope: string) => string, options?: TokenOpts): void;
function build(pattern: string, subs: string[], flags?: string): RegExp;
function cache(pattern: string, flags?: string): RegExp;
function escape(str: string): string;
function exec(str: string, regex: RegExp, pos?: number, sticky?: boolean): RegExpExecArray;
function forEach(str: string, regex: RegExp, callback: (matchArr: RegExpExecArray, index: number, input: string, regexp: RegExp) => void): any;
function globalize(regex: RegExp): RegExp;
function install(options: string): void;
function install(options: Object): void;
function isInstalled(feature: string): boolean;
function isRegExp(value: any): boolean;
function match(str: string, regex: RegExp, scope: string): any;
function match(str: string, regex: RegExp, scope: "one"): string;
function match(str: string, regex: RegExp, scope: "all"): string[];
function match(str: string, regex: RegExp): string[];
function matchChain(str: string, chain: RegExp[]): string[];
function matchChain(str: string, chain: { regex: RegExp; backref: string }[]): string[];
function matchChain(str: string, chain: { regex: RegExp; backref: number }[]): string[];
function matchRecursive(str: string, left: string, right: string, flags?: string, options?: Object): string[];
function replace(str: string, search: string, replacement: string, scope?: string): string;
function replace(str: string, search: string, replacement: Function, scope?: string): string;
function replace(str: string, search: RegExp, replacement: string, scope?: string): string;
function replace(str: string, search: RegExp, replacement: Function, scope?: string): string;
function replaceEach(str: string, replacements: Array<RegExp|string>[]): string;
function split(str: string, separator: string, limit?: number): string[];
function split(str: string, separator: RegExp, limit?: number): string[];
function test(str: string, regex: RegExp, pos?: number, sticky?: boolean): boolean;
function uninstall(options: Object): void;
function uninstall(options: string): void;
function union(patterns: string[], flags?: string): RegExp;
var version: string;
// end API definitions
}
}
export = OuterXRegExp;
}