This commit is contained in:
James O'Cull
2016-01-06 12:33:13 -05:00
109 changed files with 10559 additions and 883 deletions
+16 -1
View File
@@ -24,7 +24,7 @@ class FormConfig {
}
class AppController {
fields: AngularFormly.IFieldConfigurationObject[];
fields: AngularFormly.IFieldArray;
constructor() {
var vm = this;
vm.fields = [
@@ -99,6 +99,21 @@ class AppController {
templateOptions: {
label: 'no wrapper here...'
}
},
{
//From http://angular-formly.com/#/example/other/nested-formly-forms
key: 'address',
wrapper: 'panel',
templateOptions: { label: 'Address' },
fieldGroup: [{
key: 'town',
type: 'input',
templateOptions: {
required: true,
type: 'text',
label: 'Town'
}
}]
}
]
}
+20 -15
View File
@@ -1,7 +1,7 @@
// Type definitions for angular-formly 6.18.0
// Type definitions for angular-formly 7.2.3
// Project: https://github.com/formly-js/angular-formly
// Definitions by: Scott Hatcher <https://github.com/scatcher>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../angularjs/angular.d.ts" />
@@ -16,18 +16,23 @@ declare module 'angular-formly' {
declare module AngularFormly {
interface IFieldArray extends Array<IFieldConfigurationObject|IFieldGroup> {
}
interface IFieldGroup {
data?: Object;
className?: string;
elementAttributes?: { [key: string]: string };
fieldGroup: IFieldConfigurationObject[];
elementAttributes?: string;
fieldGroup: IFieldArray;
form?: Object;
hide?: boolean;
hideExpression?: string | IExpresssionFunction;
hideExpression?: string | IExpressionFunction;
key?: string | number;
model?: string | Object;
options?: IFormOptionsAPI
options?: IFormOptionsAPI;
templateOptions?: ITemplateOptions;
wrapper?: string | string[];
}
@@ -46,7 +51,7 @@ declare module AngularFormly {
/**
* see http://docs.angular-formly.com/docs/formly-expressions#expressionproperties-validators--messages
*/
interface IExpresssionFunction {
interface IExpressionFunction {
($viewValue: any, $modelValue: any, scope: ITemplateScope): any;
}
@@ -122,8 +127,8 @@ declare module AngularFormly {
* see http://docs.angular-formly.com/docs/field-configuration-object#validators-object
*/
interface IValidator {
expression: string | IExpresssionFunction;
message?: string | IExpresssionFunction;
expression: string | IExpressionFunction;
message?: string | IExpressionFunction;
}
@@ -154,7 +159,7 @@ declare module AngularFormly {
* see http://angular-formly.com/#/example/other/unique-value-async-validation
*/
asyncValidators?: {
[key: string]: string | IExpresssionFunction | IValidator;
[key: string]: string | IExpressionFunction | IValidator;
}
/**
@@ -204,7 +209,7 @@ declare module AngularFormly {
* see http://docs.angular-formly.com/docs/field-configuration-object#expressionproperties-object
*/
expressionProperties?: {
[key: string]: string | IExpresssionFunction | IValidator;
[key: string]: string | IExpressionFunction | IValidator;
}
@@ -224,7 +229,7 @@ declare module AngularFormly {
*
* see http://docs.angular-formly.com/docs/field-configuration-object#hideexpression-string--function
*/
hideExpression?: string | IExpresssionFunction;
hideExpression?: string | IExpressionFunction;
/**
@@ -416,7 +421,7 @@ declare module AngularFormly {
* like in this example.
*/
messages?: {
[key: string]: IExpresssionFunction | string;
[key: string]: IExpressionFunction | string;
}
@@ -440,7 +445,7 @@ declare module AngularFormly {
* see http://docs.angular-formly.com/docs/field-configuration-object#validators-object
*/
validators?: {
[key: string]: string | IExpresssionFunction | IValidator;
[key: string]: string | IExpressionFunction | IValidator;
}
@@ -573,7 +578,7 @@ declare module AngularFormly {
//Shortcut to options.formControl
fc: ng.IFormController | ng.IFormController[];
//all the fields for the form
fields: IFieldConfigurationObject[];
fields: IFieldArray;
//the form controller the field is in
form: any;
//The object passed as options.formState to the formly-form directive. Use this to share state between fields.
+10
View File
@@ -1806,6 +1806,16 @@ declare module protractor {
* @return {Protractor} a protractor instance.
*/
forkNewDriverInstance(opt_useSameUrl?: boolean, opt_copyMockModules?: boolean): Protractor;
/**
* Get the processed configuration object that is currently being run. This will contain
* the specs and capabilities properties of the current runner instance.
*
* Set by the runner.
*
* @return {webdriver.promise.Promise<any>} A promise which resolves to the capabilities object.
*/
getProcessedConfig(): webdriver.promise.Promise<any>;
}
/**
+1 -1
View File
@@ -22,7 +22,7 @@ declare module angular.translate {
interface IStorage {
get(name: string): string;
set(name: string, value: string): void;
put(name: string, value: string): void;
}
interface IStaticFilesLoaderOptions {
+1
View File
@@ -78,5 +78,6 @@ var droppedCallback: AngularUITree.IDroppedCallback = (eventInfo: AngularUITree.
var callbacks: AngularUITree.ICallbacks = {
accept: acceptCallback,
dragStart: droppedCallback,
dropped: droppedCallback
};
+1
View File
@@ -54,6 +54,7 @@ declare module AngularUITree {
interface ICallbacks {
accept: IAcceptCallback;
dragStart: IDroppedCallback;
dropped: IDroppedCallback;
}
@@ -24,3 +24,8 @@ appInsights.client.trackDependency("dependency name", "commandName", 500, true);
appInsights.client.commonProperties = {
environment: "dev"
};
// send any pending data and log the response
appInsights.client.sendPendingData(function (response) {
console.log(response);
});
+2 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for Application Insights v0.15.7
// Type definitions for Application Insights v0.15.8
// Project: https://github.com/Microsoft/ApplicationInsights-node.js
// Definitions by: Scott Southwood <https://github.com/scsouthw/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -358,7 +358,7 @@ interface Client {
/**
* Immediately send all queued telemetry.
*/
sendPendingData(): void;
sendPendingData(callback?: (response: string) => void): void;
getEnvelope(data: ContractsModule.Data<ContractsModule.Domain>, tagOverrides?: {
[key: string]: string;
}): ContractsModule.Envelope;
+2
View File
@@ -51,6 +51,8 @@ interface Auth0UserProfile {
user_id: string;
/** Represents one or more Identities that may be associated with the User. */
identities: Auth0Identity[];
user_metadata?: any;
app_metadata?: any;
}
/** Represents an Auth0UserProfile that has a Microsoft Account as the primary identity. */
+1
View File
@@ -0,0 +1 @@
/// <reference path="babylon.d.ts" />
+6327
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -766,6 +766,13 @@ func = Promise.promisify(f, obj);
obj = Promise.promisifyAll(obj);
anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback));
anyProm = Promise.fromNode(callback => nodeCallbackFuncErrorOnly(callback));
anyProm = Promise.fromNode(callback => nodeCallbackFunc(callback), {multiArgs : true});
anyProm = Promise.fromNode(callback => nodeCallbackFuncErrorOnly(callback), {multiArgs : true});
anyProm = Promise.fromCallback(callback => nodeCallbackFunc(callback));
anyProm = Promise.fromCallback(callback => nodeCallbackFuncErrorOnly(callback));
anyProm = Promise.fromCallback(callback => nodeCallbackFunc(callback), {multiArgs : true});
anyProm = Promise.fromCallback(callback => nodeCallbackFuncErrorOnly(callback), {multiArgs : true});
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+2 -1
View File
@@ -137,7 +137,8 @@ interface PromiseConstructor {
/**
* Returns a promise that is resolved by a node style callback function.
*/
fromNode(resolver: (callback: (err: any, result?: any) => void) => void): Promise<any>;
fromNode(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise<any>;
fromCallback(resolver: (callback: (err: any, result?: any) => void) => void, options? : {multiArgs? : boolean}): Promise<any>;
/**
* Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch.
+2
View File
@@ -136,6 +136,8 @@ interface BarChartOptions extends ChartOptions {
barStrokeWidth?: number;
barValueSpacing?: number;
barDatasetSpacing?: number;
scaleShowHorizontalLines?: boolean;
scaleShowVerticalLines?: boolean;
}
interface RadarChartOptions extends ChartSettings {
+2 -1
View File
@@ -65,10 +65,11 @@ declare module commander {
*
* @param {String} name
* @param {String} [desc]
* @param {Mixed} [opts]
* @return {Command} the new command
* @api public
*/
command(name:string, desc?:string):ICommand;
command(name:string, desc?:string, opts?: any):ICommand;
/**
* Add an implicit `help [cmd]` subcommand
+47
View File
@@ -0,0 +1,47 @@
/// <reference path="commonmark.d.ts" />
import commonmark = require('commonmark');
function logNode(node: commonmark.Node) {
console.log(
node.destination,
node.firstChild,
node.info,
node.isContainer,
node.lastChild,
node.level,
node.listDelimiter,
node.listStart,
node.listTight,
node.listType,
node.literal,
node.next,
node.onEnter,
node.onExit,
node.parent,
node.prev,
node.sourcepos,
node.title,
node.type);
}
var parser = new commonmark.Parser({ smart: true, time: true });
var node = parser.parse('# a piece of _markdown_');
let w = node.walker();
let step = w.next();
if (step.entering) {
logNode(step.node);
}
let xmlRenderer = new commonmark.XmlRenderer({ sourcepos: true, time: true });
let xml = xmlRenderer.render(node);
console.log(xml);
let htmlRenderer = new commonmark.HtmlRenderer({ safe: true, smart: true, sourcepos: true, time: true});
let html = htmlRenderer.render(node);
console.log(html);
+214
View File
@@ -0,0 +1,214 @@
// Type definitions for commonmark.js 0.22.1
// Project: https://github.com/jgm/commonmark.js
// Definitions by: Nico Jansen <https://github.com/nicojs>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module commonmark {
export interface NodeWalkingStep {
/**
* a boolean, which is true when we enter a Node from a parent or sibling, and false when we reenter it from a child
*/
entering: boolean;
/**
* The node belonging to this step
*/
node: Node;
}
export interface NodeWalker {
/**
* Returns an object with properties entering and node. Returns null when we have finished walking the tree.
*/
next(): NodeWalkingStep;
/**
* Resets the iterator to resume at the specified node and setting for entering. (Normally this isn't needed unless you do destructive updates to the Node tree.)
*/
resumeAt(node: Node, entering?: boolean): void;
}
export interface Position extends Array<Array<number>> {
}
export interface ListData {
type?: string,
tight?: boolean,
delimiter?: string,
bulletChar?: string
}
export class Node {
constructor(nodeType: string, sourcepos?: Position);
isContainer: boolean;
/**
* (read-only): one of Text, Softbreak, Hardbreak, Emph, Strong, Html, Link, Image, Code, Document, Paragraph, BlockQuote, Item, List, Heading, CodeBlock, HtmlBlock ThematicBreak.
*/
type: string;
/**
* (read-only): a Node or null.
*/
firstChild: Node;
/**
* (read-only): a Node or null.
*/
lastChild: Node;
/**
* (read-only): a Node or null.
*/
next: Node;
/**
* (read-only): a Node or null.
*/
prev: Node;
/**
* (read-only): a Node or null.
*/
parent: Node;
/**
* (read-only): an Array with the following form: [[startline, startcolumn], [endline, endcolumn]]
*/
sourcepos: Position;
/**
* the literal String content of the node or null.
*/
literal: string;
/**
* link or image destination (String) or null.
*/
destination: string;
/**
* link or image title (String) or null.
*/
title: string;
/**
* fenced code block info string (String) or null.
*/
info: string;
/**
* heading level (Number).
*/
level: number;
/**
* either Bullet or Ordered (or undefined).
*/
listType: string;
/**
* true if list is tight
*/
listTight: boolean;
/**
* a Number, the starting number of an ordered list.
*/
listStart: number;
/**
* a String, either ) or . for an ordered list.
*/
listDelimiter: string;
/**
* used only for CustomBlock or CustomInline.
*/
onEnter: string;
/**
* used only for CustomBlock or CustomInline.
*/
onExit: string;
/**
* Append a Node child to the end of the Node's children.
*/
appendChild(child: Node): void;
/**
* Prepend a Node child to the beginning of the Node's children.
*/
prependChild(child: Node): void;
/**
* Remove the Node from the tree, severing its links with siblings and parents, and closing up gaps as needed.
*/
unlink(): void;
/**
* Insert a Node sibling after the Node.
*/
insertAfter(sibling: Node): void;
/**
* Insert a Node sibling before the Node.
*/
insertBefore(sibling: Node): void;
/**
* Returns a NodeWalker that can be used to iterate through the Node tree rooted in the Node
*/
walker(): NodeWalker;
/**
* Setting the backing object of listType, listTight, listStat and listDelimiter directly.
* Not needed unless creating list nodes directly. Should be fixed from v>0.22.1
* https://github.com/jgm/commonmark.js/issues/74
*/
_listData: ListData;
}
/**
* Instead of converting Markdown directly to HTML, as most converters do, commonmark.js parses Markdown to an AST (abstract syntax tree), and then renders this AST as HTML.
* This opens up the possibility of manipulating the AST between parsing and rendering. For example, one could transform emphasis into ALL CAPS.
*/
export class Parser {
/**
* Constructs a new Parser
*/
constructor(options?: ParserOptions);
parse(input: string): Node;
}
export interface ParserOptions {
/**
* if true, straight quotes will be made curly, -- will be changed to an en dash, --- will be changed to an em dash, and ... will be changed to ellipses.
*/
smart?: boolean;
time?: boolean;
}
export interface HtmlRenderingOptions extends XmlRenderingOptions {
/**
* if true, raw HTML will not be passed through to HTML output (it will be replaced by comments), and potentially unsafe URLs in links and images (those beginning with javascript:, vbscript:, file:, and with a few exceptions data:) will be replaced with empty strings.
*/
safe?: boolean;
/**
* if true, straight quotes will be made curly, -- will be changed to an en dash, --- will be changed to an em dash, and ... will be changed to ellipses.
*/
smart?: boolean;
/**
* if true, source position information for block-level elements will be rendered in the data-sourcepos attribute (for HTML) or the sourcepos attribute (for XML).
*/
sourcepos?: boolean;
}
export class HtmlRenderer {
constructor(options?: HtmlRenderingOptions)
render(root: Node): string;
/**
* Let's you override the softbreak properties of a renderer. So, to make soft breaks render as hard breaks in HTML:
* writer.softbreak = "<br />";
*/
softbreak: string;
/**
* Override the function that will be used to escape (sanitize) the html output. Return value is used to add to the html output
* @param input the input to escape
* @param isAttributeValue indicates wheter or not the input value will be used as value of an html attribute.
*/
escape: (input: string, isAttributeValue: boolean) => string;
}
export interface XmlRenderingOptions {
time?: boolean;
sourcepos?: boolean;
}
export class XmlRenderer {
constructor(options?: XmlRenderingOptions)
render(root: Node): string;
}
}
declare module 'commonmark' {
export = commonmark;
}
+21
View File
@@ -0,0 +1,21 @@
/// <reference path="console-stamp.d.ts" />
import consoleStamp = require("console-stamp");
consoleStamp(console);
var options = {};
consoleStamp(console, options);
var options2 = {
metadata: function ():string {
return 'string';
},
colors: {
stamp: "yellow",
label: "white",
metadata: "green"
},
label: true
};
consoleStamp(console, options2);
+46
View File
@@ -0,0 +1,46 @@
// Type definitions for console-stamp 0.2.0
// Project: https://github.com/starak/node-console-stamp
// Definitions by: Eric Byers <https://github.com/ericbyers/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'console-stamp' {
function consoleStamp(console:{}, options?: {
/**
* A string with date format based on Javascript Date Format
*/
pattern?: string
/**
* If true it will show the label (LOG | INFO | WARN | ERROR)
*/
label?: boolean;
/**
* An array containing the methods to include in the patch
*/
include?: any;
/**
* An array containing the methods to exclude in the patch)
*/
exclude?: any;
/**
* Types can be String, Object (interpreted with util.inspect), or Function. See the test-metadata.js for examples.
* Note that metadata can still be sent as the third parameter (as in vesion 1.6) as a backward compatibillity feature, but this is deprecated.
*/
metadata?: any;
/**
* An object representing a color theme. More info https://www.npmjs.com/package/colors
*/
colors?: {
stamp?: any;
label?: any;
metadata?: any;
};
}): void;
export = consoleStamp;
}
@@ -0,0 +1,20 @@
/// <reference path="contentful-resolve-response.d.ts" />
import resolveResponse = require('contentful-resolve-response');
var response = {
items: [
{
someValue: 'wow',
someLink: {sys: {type: 'Link', linkType: 'Entry', id: 'suchId'}}
}
],
includes: {
Entry: [
{sys: {type: 'Entry', id: 'suchId'}, very: 'doge'}
]
}
};
var items = resolveResponse(response)
console.log(items);
@@ -0,0 +1,9 @@
// Type definitions for contentful-resolve-response v0.1.2
// Project: https://github.com/contentful/contentful-resolve-response
// Definitions by: Anton Karsten <https://github.com/antonkarsten>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'contentful-resolve-response' {
function resolveResponse(response: any): any;
export = resolveResponse;
}
+8 -13
View File
@@ -1,21 +1,16 @@
/// <reference path="couchbase.d.ts"/>
import couchbase = require('couchbase');
var db = new couchbase.Connection({ bucket: "default" }, function (err) {
if (err) throw err;
var cluster = new couchbase.Cluster('couchbase://127.0.0.1');
var bucket = cluster.openBucket('default');
// TS 0.9.5 bug https://typescript.codeplex.com/workitem/2035, todo: remove cast after fix
(<couchbase.Connection>db).set('testdoc', { name: 'Frank' }, function (err, result) {
if (err) throw err;
bucket.upsert('testdoc', { name: 'Frank' }, (error) => {
if (error) throw error;
var s: string = err.message;
bucket.get('testdoc', (err, result) => {
if (err) throw err;
// TS 0.9.5 bug https://typescript.codeplex.com/workitem/2035, todo: remove cast after fix
(<couchbase.Connection>db).get('testdoc', function (err, result) {
if (err) throw err;
console.log(result.value);
// {name: Frank}
});
console.log(result.value);
// {name: Frank}
});
});
+984 -584
View File
File diff suppressed because it is too large Load Diff
+4
View File
@@ -31,3 +31,7 @@ declare module Dagre{
}
declare var dagre: Dagre.DagreFactory;
declare module "dagre" {
export = dagre;
}
+28
View File
@@ -0,0 +1,28 @@
// From https://github.com/jprichardson/field/blob/e968fd979ba1a06e35571695ddfdad513e516eae/README.md
/// <reference path="field.d.ts" />
// get
const config = {
environment: {
production: {
port: 80
}
}
}
console.log(field.get(config, 'environment:production:port'))
// => 80
// set
var database: any = {}
console.log(field.get(database, 'production.port'))
// => undefined
// will return undefined since it never existed before
field.set(database, 'production.port', 27017)
console.log(database.production.port)
// => 27017
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for field 1.0.1
// Project: https://www.npmjs.com/package/field
// Definitions by: Leo Liang <https://github.com/aleung/DefinitelyTyped>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module field {
export function get(topObj: any, fields: string): any;
export function set(topObj: any, fields: string, value: any): any;
}
@@ -4,7 +4,7 @@
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="foundation.d.ts" />
/// <reference path="foundation-sites.d.ts" />
$(document).foundation();
$(document).foundation('method5');
@@ -1,15 +1,20 @@
// Type definitions for Foundation Sites v6.0.4
// Type definitions for Foundation Sites v6.1.1
// Project: http://foundation.zurb.com/
// Definitions by: Sam Vloeberghs <https://github.com/samvloeberghs/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// please also see the typings project and prefer to use it!
// typings project: https://github.com/typings/typings
// typings: https://github.com/samvloeberghs/foundation-sites-typings
/// <reference path="../jquery/jquery.d.ts"/>
declare module FoundationSites {
// http://foundation.zurb.com/sites/docs/abide.html#javascript-reference
interface Abide {
requiredChedck(element:Object): boolean;
requiredChecked(element:Object): boolean;
findFormError($el:Object): Object;
findLabel(element:Object): boolean;
addErrorClasses(element:Object): void;
removeErrorClasses(element:Object): void;
@@ -17,7 +22,9 @@ declare module FoundationSites {
validateForm(element:Object): void;
validateText(element:Object): boolean;
validateRadio(group:string): boolean;
matchValidation($el:Object, validators:string, required:boolean): boolean;
resetForm($form:Object): void;
destroy(): void;
}
interface IAbidePatterns {
@@ -40,9 +47,13 @@ declare module FoundationSites {
}
interface IAbideOptions {
slideSpeed?: number;
multiOpen?: boolean;
patters?: IAbidePatterns;
validateOn?: string;
labelErrorClass?: string;
inputErrorClass?: string;
formErrorSelector?: string;
formErrorClass?: string;
liveValidate?: boolean;
validators?:any;
}
// http://foundation.zurb.com/sites/docs/accordion.html#javascript-reference
@@ -56,10 +67,12 @@ declare module FoundationSites {
interface IAccordionOptions {
slideSpeed?: number
multiOpen?: boolean;
allowAllClosed?: boolean;
}
// http://foundation.zurb.com/sites/docs/accordion-menu.html#javascript-reference
interface AccordionMenu {
hideAll(): void;
toggle($target:JQuery): void;
down($target:JQuery, firstTime:boolean): void;
up($target:JQuery): void;
@@ -73,7 +86,8 @@ declare module FoundationSites {
// http://foundation.zurb.com/sites/docs/drilldown-menu.html#javascript-reference
interface Drilldown {
_hideAll($elem:JQuery): void;
_hideAll(): void;
_back($elem:JQuery): void;
_show($elem:JQuery): void;
_hide($elem:JQuery): void;
destroy(): void;
@@ -97,11 +111,13 @@ declare module FoundationSites {
interface IDropdownOptions {
hoverDelay?: number;
hover?: boolean;
hoverPane?: boolean;
vOffset?: number;
hOffset?: number;
positionClass?: string;
trapFocus?: boolean;
autoFocus?: boolean;
closeOnClick?: boolean;
}
// http://foundation.zurb.com/sites/docs/dropdown-menu.html#javascript-reference
@@ -115,21 +131,26 @@ declare module FoundationSites {
hoverDelay?: number;
clickOpen?: boolean;
closingTime?: number;
alignments?: string;
verticalClasss?: string;
rightClasss?: string;
alignment?: string;
closeOnClick?:boolean;
verticalClass?: string;
rightClass?: string;
forceFollow?: boolean;
}
// http://foundation.zurb.com/sites/docs/equalizer.html#javascript-reference
interface Equalizer {
getHeights(element:Object): Array<any>;
applyHeight($eqParent:Object, heights:Array<any>): void;
getHeightsByRow(cb:Function): void;
applyHeight(heights:Array<any>): void;
applyHeightByRow(groups:Array<any>):void;
destroy(): void;
}
interface IEqualizerOptions {
equalizeOnStack?: boolean;
throttleInterval?: number;
equalizeByRow?: boolean;
equalizeOn?:string;
}
// http://foundation.zurb.com/sites/docs/interchange.html#javascript-reference
@@ -155,13 +176,15 @@ declare module FoundationSites {
threshold?: number;
activeClass?: string;
deepLinking?: boolean;
barOffset?: number;
}
// http://foundation.zurb.com/sites/docs/offcanvas.html#javascript-reference
interface OffCanvas {
reveal(isRevealed:boolean): void;
open(event:Object, trigger:JQuery): void;
toggle(event:Object, trigger:JQuery): void;
close(): void;
toggle(event:Object, trigger:JQuery): void;
destroy(): void;
}
@@ -178,8 +201,8 @@ declare module FoundationSites {
// http://foundation.zurb.com/sites/docs/orbit.html#javascript-reference
interface Orbit {
changeSlide(isLTR:boolean, chosenSlide?:Object, idx?:number): void;
geoSync(): void;
changeSlide(isLTR:boolean, chosenSlide?:Object, idx?:number): void;
destroy(): void;
}
@@ -201,6 +224,7 @@ declare module FoundationSites {
boxOfBullets?: string;
nextClass?: string;
prevClass?: string;
useMUI?: boolean;
}
// http://foundation.zurb.com/sites/docs/reveal.html#javascript-reference
@@ -254,7 +278,7 @@ declare module FoundationSites {
_pauseListeners(scrollListener:string): void;
_calc(checkSizes:boolean, scroll:number): void;
destroy(): void;
emCalc(number:any): void;
emCalc(Number:number): void;
}
interface IStickyOptions {
@@ -279,7 +303,11 @@ declare module FoundationSites {
}
interface ITabsOptions {
animate?: boolean;
autoFocus?: boolean;
wrapOnKeys?: boolean;
matchHeight?: boolean;
linkClass?: string;
panelClass?: string;
}
// http://foundation.zurb.com/sites/docs/toggler.html#javascript-reference
@@ -328,14 +356,15 @@ declare module FoundationSites {
interface KeyBoard {
parseKey(event:any): string;
handleKey(event:any, component:any, functions:any):void;
findFocusable($element:Object): Object;
}
interface MediaQuery {
get(size:string): string;
atLeast(size:string): boolean;
queries:Array<any>;
current:any;
queries:Array<string>;
current:string;
}
interface Motion {
@@ -348,9 +377,8 @@ declare module FoundationSites {
}
interface Nest {
// TODO
//Feather: function(menu, type)
// Burn: function(menu, type){
Feather(menu:any, type:any):void;
Burn(menu:any, type:any):void;
}
interface Timer {
@@ -374,6 +402,7 @@ declare module FoundationSites {
plugin(plugin:Object, name:string): void;
registerPlugin(plugin:Object): void;
unregisterPlugin(plugin:Object): void;
reInit(plugins:Array<any>):void;
GetYoDigits(length:number, namespace?:string): string;
reflow(elem:Object, plugins?:Array<string>|string): void;
getFnName(fn:string): string;
@@ -382,7 +411,6 @@ declare module FoundationSites {
util : {
throttle(func:(...args:any[]) => any, delay:number): (...args:any[]) => any;
};
onImagesLoaded(images:Object, cb:Function): void;
Abide(element:Object, options?:IAbideOptions): Abide;
Accordion(element:Object, options?:IAccordionOptions): Accordion;
+5
View File
@@ -0,0 +1,5 @@
/// <reference path="./fullname.d.ts" />
import fullname = require("fullname");
fullname().then(function(name) { name === "string"; });
+11
View File
@@ -0,0 +1,11 @@
// Type definitions for fullname v2.1.0
// Project: https://www.npmjs.com/package/fullname
// Definitions by: Klaus Reimer <https://github.com/kayahr/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../es6-promise/es6-promise.d.ts" />
declare module "fullname" {
function fullname(): Promise<string>;
export = fullname;
}
@@ -275,12 +275,12 @@ globalShortcut.unregisterAll();
// ipcMain
// https://github.com/atom/electron/blob/master/docs/api/ipc-main-process.md
ipcMain.on('asynchronous-message', (event: any, arg: any) => {
ipcMain.on('asynchronous-message', (event: GitHubElectron.IPCMainEvent, arg: any) => {
console.log(arg); // prints "ping"
event.sender.send('asynchronous-reply', 'pong');
});
ipcMain.on('synchronous-message', (event: any, arg: any) => {
ipcMain.on('synchronous-message', (event: GitHubElectron.IPCMainEvent, arg: any) => {
console.log(arg); // prints "ping"
event.returnValue = 'pong';
});
+25 -3
View File
@@ -1193,8 +1193,12 @@ declare module GitHubElectron {
/**
* File types that can be displayed, see dialog.showOpenDialog for an example.
*/
filters?: string[];
}, callback?: (fileName: string) => void): void;
filters?: {
name: string;
extensions: string[];
}[]
}, callback?: (fileName: string) => void): string;
/**
* Shows a message box. It will block until the message box is closed. It returns .
@@ -1464,6 +1468,24 @@ declare module GitHubElectron {
sendToHost(channel: string, ...args: any[]): void;
}
class IPCMain implements NodeJS.EventEmitter {
addListener(event: string, listener: Function): IPCMain;
once(event: string, listener: Function): IPCMain;
removeListener(event: string, listener: Function): IPCMain;
removeAllListeners(event?: string): IPCMain;
setMaxListeners(n: number): IPCMain;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
on(event: string, listener: (event: IPCMainEvent, ...args: any[]) => any): IPCMain;
}
interface IPCMainEvent {
returnValue?: any;
sender: WebContents;
}
interface Remote extends CommonElectron {
/**
* @returns The object returned by require(module) in the main process.
@@ -1761,7 +1783,7 @@ declare module GitHubElectron {
BrowserWindow: typeof GitHubElectron.BrowserWindow;
contentTracing: GitHubElectron.ContentTracing;
dialog: GitHubElectron.Dialog;
ipcMain: NodeJS.EventEmitter;
ipcMain: GitHubElectron.IPCMain;
globalShortcut: GitHubElectron.GlobalShortcut;
Menu: typeof GitHubElectron.Menu;
MenuItem: typeof GitHubElectron.MenuItem;
+3 -3
View File
@@ -1,7 +1,7 @@
/// <reference path="./gulp-autoprefixer.d.ts"/>
/// <reference path="../gulp/gulp.d.ts"/>
import gulp = require("gulp");
import autoprefixer = require("gulp-autoprefixer");
import * as gulp from "gulp";
import * as autoprefixer from "gulp-autoprefixer";
gulp.src("test.css")
.pipe(autoprefixer())
@@ -17,4 +17,4 @@ gulp.src("test.css")
gulp.src("test.css")
.pipe(autoprefixer({remove: false}))
.pipe(gulp.dest("build"));
.pipe(gulp.dest("build"));
+2
View File
@@ -14,5 +14,7 @@ declare module "gulp-autoprefixer" {
function autoPrefixer(opts?: Options): NodeJS.ReadWriteStream;
namespace autoPrefixer {}
export = autoPrefixer;
}
+2 -2
View File
@@ -1,8 +1,8 @@
/// <reference path="gulp-csso.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import gulp = require('gulp');
import csso = require('gulp-csso');
import * as gulp from 'gulp';
import * as csso from 'gulp-csso';
gulp.task('default', () =>
gulp.src('./main.css')
+1 -1
View File
@@ -7,6 +7,6 @@
declare module 'gulp-csso' {
function csso(structureMinimization?: boolean): NodeJS.ReadWriteStream;
namespace csso {}
export = csso;
}
+2 -2
View File
@@ -1,8 +1,8 @@
/// <reference path="gulp-debug.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import gulp = require('gulp');
import debug = require('gulp-debug');
import * as gulp from 'gulp';
import * as debug from 'gulp-debug';
gulp.task('default', () =>
gulp.src('foo.js')
+2
View File
@@ -13,5 +13,7 @@ declare module 'gulp-debug' {
function debug(options?: IOptions): NodeJS.ReadWriteStream;
namespace debug {}
export = debug;
}
+2 -3
View File
@@ -2,10 +2,9 @@
/// <reference path="../node/node.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import dtsm = require('gulp-dtsm');
import gulp = require('gulp');
import * as dtsm from 'gulp-dtsm';
import * as gulp from 'gulp';
var stream: NodeJS.WritableStream = dtsm();
gulp.task('dtsm', () => gulp.src('./dtsm.json').pipe(dtsm()));
+2 -1
View File
@@ -8,6 +8,7 @@
declare module "gulp-dtsm" {
function dtsm(): NodeJS.WritableStream;
namespace dtsm {}
export = dtsm;
}
+2 -2
View File
@@ -1,8 +1,8 @@
/// <reference path="./gulp-flatten.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import gulp = require("gulp");
import flatten = require("gulp-flatten");
import * as gulp from "gulp";
import * as flatten from "gulp-flatten";
gulp.task("flatten:simple", () => {
gulp.src(["files/**/*.txt"])
+2
View File
@@ -13,5 +13,7 @@ declare module "gulp-flatten" {
function flatten(options?: IOptions): NodeJS.ReadWriteStream;
namespace flatten {}
export = flatten;
}
+3 -3
View File
@@ -1,7 +1,7 @@
/// <reference path="./gulp-gh-pages.d.ts"/>
/// <reference path="../gulp/gulp.d.ts"/>
import gulp = require("gulp");
import ghPages = require("gulp-gh-pages");
import * as gulp from "gulp";
import * as ghPages from "gulp-gh-pages";
gulp.src("test.css")
.pipe(ghPages());
@@ -22,4 +22,4 @@ gulp.src("test.css")
.pipe(ghPages({push: false}));
gulp.src("test.css")
.pipe(ghPages({message: "master"}));
.pipe(ghPages({message: "master"}));
+2
View File
@@ -17,5 +17,7 @@ declare module "gulp-gh-pages" {
function ghPages(opts?: Options): NodeJS.ReadWriteStream;
namespace ghPages {}
export = ghPages;
}
+2 -2
View File
@@ -1,8 +1,8 @@
/// <reference path="./gulp-inject.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import gulp = require("gulp");
import inject = require("gulp-inject");
import * as gulp from "gulp";
import * as inject from "gulp-inject";
gulp.task("inject:simple", () => {
gulp.src("src/index.html")
+2
View File
@@ -35,5 +35,7 @@ declare module "gulp-inject" {
function inject(sources: NodeJS.ReadableStream, options?: IOptions): NodeJS.ReadWriteStream;
namespace inject {}
export = inject;
}
+2 -2
View File
@@ -1,8 +1,8 @@
/// <reference path="./gulp-less.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import gulp = require("gulp");
import less = require("gulp-less");
import * as gulp from "gulp";
import * as less from "gulp-less";
// Without options
gulp.task("less", () => {
+2
View File
@@ -15,5 +15,7 @@ declare module "gulp-less" {
function less(options?: IOptions): NodeJS.ReadWriteStream;
namespace less {}
export = less;
}
+9 -9
View File
@@ -3,9 +3,9 @@
/// <reference path="../gulp-concat/gulp-concat" />
/// <reference path="gulp-load-plugins" />
import gulp = require('gulp');
import gulpConcat = require('gulp-concat');
import gulpLoadPlugins = require('gulp-load-plugins');
import * as gulp from 'gulp';
import * as gulpConcat from 'gulp-concat';
import * as gulpLoadPlugins from 'gulp-load-plugins';
interface GulpPlugins extends IGulpPlugins {
concat: typeof gulpConcat;
@@ -29,8 +29,8 @@ gulp.task('taskName', () => {
});
/*
* From 0.8.0, you can pass in an object of mappings for renaming plugins. For example,
* imagine you want to load the gulp-ruby-sass plugin, but want to refer to it as just
* From 0.8.0, you can pass in an object of mappings for renaming plugins. For example,
* imagine you want to load the gulp-ruby-sass plugin, but want to refer to it as just
* sass :
*/
plugins = gulpLoadPlugins<GulpPlugins>({
@@ -39,9 +39,9 @@ plugins = gulpLoadPlugins<GulpPlugins>({
}
});
/*
* gulp-load-plugins comes with npm scope support. The major difference is that scoped
* plugins are accessible through an object on plugins that represents the scope. For
* example, if the plugin is @myco/gulp-test-plugin then you can access the plugin as
* gulp-load-plugins comes with npm scope support. The major difference is that scoped
* plugins are accessible through an object on plugins that represents the scope. For
* example, if the plugin is @myco/gulp-test-plugin then you can access the plugin as
* shown in the following example:
*/
interface GulpPlugins {
@@ -49,5 +49,5 @@ interface GulpPlugins {
testPlugin(): NodeJS.ReadWriteStream;
}
}
plugins.myco.testPlugin();
+6 -4
View File
@@ -7,7 +7,7 @@
/** Loads in any gulp plugins and attaches them to an object, freeing you up from having to manually require each gulp plugin. */
declare module 'gulp-load-plugins' {
interface IOptions {
/** the glob(s) to search for, default ['gulp-*', 'gulp.*'] */
pattern?: string[];
@@ -24,14 +24,16 @@ declare module 'gulp-load-plugins' {
/** a mapping of plugins to rename, the key being the NPM name of the package, and the value being an alias you define */
rename?: IPluginNameMappings;
}
interface IPluginNameMappings {
[npmPackageName: string]: string
}
/** Loads in any gulp plugins and attaches them to an object, freeing you up from having to manually require each gulp plugin. */
function gulpLoadPlugins<T extends IGulpPlugins>(options?: IOptions): T;
namespace gulpLoadPlugins {}
export = gulpLoadPlugins;
}
+2 -2
View File
@@ -1,8 +1,8 @@
/// <reference path="./gulp-minify-css.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import gulp = require("gulp");
import minifyCSS = require("gulp-minify-css");
import * as gulp from "gulp";
import * as minifyCSS from "gulp-minify-css";
gulp.task("minify-css", () => {
gulp.src("css/**/*.css")
+2
View File
@@ -27,5 +27,7 @@ declare module "gulp-minify-css" {
function minifyCSS(options?: IOptions): NodeJS.ReadWriteStream;
namespace minifyCSS {}
export = minifyCSS;
}
+2 -2
View File
@@ -1,8 +1,8 @@
/// <reference path="gulp-minify-html.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import gulp = require('gulp');
import minifyHtml = require('gulp-minify-html');
import * as gulp from 'gulp';
import * as minifyHtml from 'gulp-minify-html';
minifyHtml();
minifyHtml({conditionals: true, loose: true});
+2
View File
@@ -31,5 +31,7 @@ declare module 'gulp-minify-html' {
function minifyHtml(options?: IOptions): NodeJS.ReadWriteStream;
namespace minifyHtml {}
export = minifyHtml;
}
+3 -3
View File
@@ -1,9 +1,9 @@
/// <reference path="./gulp-mocha.d.ts"/>
/// <reference path="../gulp/gulp.d.ts"/>
import gulp = require("gulp");
import mocha = require("gulp-mocha");
import * as gulp from "gulp";
import * as mocha from "gulp-mocha";
gulp.task('default', function () {
return gulp.src('test.js', {read: false})
.pipe(mocha({reporter: 'nyan'}));
});
});
+2 -1
View File
@@ -8,5 +8,6 @@
declare module "gulp-mocha" {
function mocha(setupOptions?: MochaSetupOptions): NodeJS.ReadWriteStream;
namespace mocha {}
export = mocha;
}
}
+2 -2
View File
@@ -1,7 +1,7 @@
/// <reference path="./gulp-ruby-sass.d.ts"/>
/// <reference path="../gulp/gulp.d.ts"/>
import gulp = require("gulp");
import sass = require("gulp-ruby-sass");
import * as gulp from "gulp";
import * as sass from "gulp-ruby-sass";
gulp.task('sass', function () {
sass('./scss/*.scss')
+2
View File
@@ -64,5 +64,7 @@ declare module "gulp-ruby-sass" {
*/
function sass(source: string, options?: Options): NodeJS.ReadableStream;
namespace sass {}
export = sass;
}
+3 -3
View File
@@ -2,9 +2,9 @@
/// <reference path="../gulp/gulp.d.ts" />
/// <reference path="../gulp-debug/gulp-debug.d.ts" />
import gulp = require('gulp');
import size = require('gulp-size');
import debug = require('gulp-debug');
import * as gulp from 'gulp';
import * as size from 'gulp-size';
import * as debug from 'gulp-debug';
gulp.task('default', () =>
gulp.src('fixture.js')
+2
View File
@@ -19,5 +19,7 @@ declare module 'gulp-size' {
function size(options?: IOptions): ISizeStream;
namespace size {}
export = size;
}
+5 -5
View File
@@ -3,9 +3,9 @@
/// <reference path="../gulp/gulp" />
/// <reference path="gulp-sort" />
import gulp = require('gulp');
import sort = require('gulp-sort');
import gulpUtil = require('gulp-util');
import * as gulp from 'gulp';
import * as sort from 'gulp-sort';
import * as gulpUtil from 'gulp-util';
// default sort
gulp.src('./src/js/**/*.js')
@@ -38,7 +38,7 @@ gulp.src('./src/js/**/*.js')
}
}))
.pipe(gulp.dest('./build/js'));
function customComparator(file1: gulpUtil.File, file2: gulpUtil.File) {
if (file1.path.indexOf('build') > -1) {
return 1;
@@ -47,4 +47,4 @@ function customComparator(file1: gulpUtil.File, file2: gulpUtil.File) {
return -1;
}
return 0;
}
}
+9 -7
View File
@@ -8,11 +8,11 @@
/** Sort files in stream by path or any custom sort comparator */
declare module 'gulp-sort' {
import gulpUtil = require('gulp-util');
interface IOptions {
/**
/**
* A function to compare two files.
* Returns:
* -1 if file1 should be before file2,
@@ -23,9 +23,9 @@ declare module 'gulp-sort' {
/** Whether to sort in ascending order, default is true */
asc?: boolean;
}
interface IComparatorFunction {
/**
/**
* A function to compare two files.
* Returns:
* -1 if file1 should be before file2,
@@ -34,11 +34,13 @@ declare module 'gulp-sort' {
*/
(file1: gulpUtil.File, file2: gulpUtil.File): number;
}
/** Sort files in stream by path or any custom sort comparator */
function gulpSort(): NodeJS.ReadWriteStream;
function gulpSort(comparator: IComparatorFunction): NodeJS.ReadWriteStream;
function gulpSort(options: IOptions): NodeJS.ReadWriteStream;
namespace gulpSort {}
export = gulpSort;
}
+2 -2
View File
@@ -1,8 +1,8 @@
/// <reference path="./gulp-tsd.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import gulp = require("gulp");
import tsd = require("gulp-tsd");
import * as gulp from "gulp";
import * as tsd from "gulp-tsd";
gulp.task("tsd", () => {
gulp.src("gulp_tsd.json")
+2
View File
@@ -18,5 +18,7 @@ declare module "gulp-tsd" {
function tsd(opts?: IOptions, callback?: gulp.TaskCallback): NodeJS.ReadWriteStream;
namespace tsd {}
export = tsd;
}
+2 -2
View File
@@ -1,8 +1,8 @@
/// <reference path="gulp-watch.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import gulp = require('gulp');
import watch = require('gulp-watch');
import * as gulp from 'gulp';
import * as watch from 'gulp-watch';
gulp.task('stream', () =>
gulp.src('css/**/*.css')
+1 -1
View File
@@ -22,6 +22,6 @@ declare module 'gulp-watch' {
}
function watch(glob: string | Array<string>, options?: IOptions, callback?: Function): IWatchStream;
namespace watch {}
export = watch;
}
+1 -1
View File
@@ -107,7 +107,7 @@ interface HammerManager
emit( event:string, data:any ):void;
get( recogniser:Recognizer ):Recognizer;
get( recogniser:string ):Recognizer;
off( events:string, handler:( event:HammerInput ) => void ):void;
off( events:string, handler?:( event:HammerInput ) => void ):void;
on( events:string, handler:( event:HammerInput ) => void ):void;
recognize( inputData:any ):void;
remove( recogniser:Recognizer ):HammerManager;
+177
View File
@@ -0,0 +1,177 @@
/// <reference path="icepick.d.ts" />
/// <reference path="../underscore/underscore.d.ts" />
import i = require("icepick");
"use strict"; // so attempted modifications of frozen objects will throw errors
// freeze(collection)
{
let coll = {
a: "foo",
b: [1, 2, 3],
c: {
d: "bar"
}
};
i.freeze(coll);
}
// thaw(collection)
class Foo {}
{
let coll = i.freeze({ a: "foo", b: [1, 2, 3], c: { d: "bar" }, e: new Foo() });
let thawed = i.thaw(coll);
}
// assoc(collection, key, value)
{
let coll = { a: 1, b: 2 };
let newColl = i.assoc(coll, "b", 3); // {a: 1, b: 3}
let arr = ["a", "b", "c"];
let newArr = i.assoc(arr, 2, "d"); // ["a", "b", "d"]
}
// alias: set(collection, key, value)
{
let coll = { a: 1, b: 2 };
let newColl = i.set(coll, "b", 3); // {a: 1, b: 3}
let arr = ["a", "b", "c"];
let newArr = i.set(arr, 2, "d"); // ["a", "b", "d"]
}
// dissoc(collection, key)
{
let coll = { a: 1, b: 2, c: 3 };
let newColl = i.dissoc(coll, "b"); // {a: 1, c: 3}
let arr = ["a", "b", "c"];
let newArr = i.dissoc(arr, 2); // ["a", , "c"]
}
// alias: unset(collection, key)
{
let coll = { a: 1, b: 2, c: 3 };
let newColl = i.unset(coll, "b"); // {a: 1, c: 3}
let arr = ["a", "b", "c"];
let newArr = i.unset(arr, 2); // ["a", , "c"]
}
// assocIn(collection, path, value)
{
let coll = {
a: "foo",
b: [1, 2, 3],
c: {
d: "bar"
}
};
let newColl = i.assocIn(coll, ["c", "d"], "baz");
let coll2 = {};
let newColl2 = i.assocIn(coll2, ["a", "b", "c"], 1);
}
// alias: setIn(collection, path, value)
{
let coll = {
a: "foo",
b: [1, 2, 3],
c: {
d: "bar"
}
};
let newColl = i.setIn(coll, ["c", "d"], "baz");
let coll2 = {};
let newColl2 = i.setIn(coll2, ["a", "b", "c"], 1);
}
// getIn(collection, path)
{
let coll = i.freeze([
{ a: 1 },
{ b: 2 }
]);
let result = i.getIn(coll, [1, "b"]); // 2
}
// updateIn(collection, path, callback)
{
let coll = i.freeze([
{ a: 1 },
{ b: 2 }
]);
let newColl = i.updateIn(coll, [1, "b"], function(val: number) {
return val * 2;
}); // [ {a: 1}, {b: 4} ]
}
// assign(coll1, coll2, ...)
{
let obj1 = { a: 1, b: 2, c: 3 };
let obj2 = { c: 4, d: 5 };
let result = i.assign(obj1, obj2); // {a: 1, b: 2, c: 4, d: 5}
}
// merge(target, source)
{
let defaults = { a: 1, c: { d: 1, e: [1, 2, 3], f: { g: 1 } } };
let obj = { c: { d: 2, e: [2], f: null as any } };
let result1 = i.merge(defaults, obj); // {a: 1, c: {d: 2, e: [2]}, f: null}
let obj2 = { c: { d: 2 } };
let result2 = i.merge(result1, obj2);
(result1 === result2); // true
}
// arrays
{
var a = [1];
a = i.push(a, 2); // [1, 2];
a = i.unshift(a, 0); // [0, 1, 2];
a = i.pop(a); // [0, 1];
a = i.shift(a); // [1];
}
{
i.map(function(v) { return v * 2 }, [1, 2, 3]); // [2, 4, 6]
var removeEvens = _.partial(i.filter, function(v: number) { return v % 2; });
removeEvens([1, 2, 3]); // [1, 3]
}
{
var arr = i.freeze([{ a: 1 }, { b: 2 }]);
//ECMAScript 2015
//arr.find(function(item) { return item.b != null; }); // {b: 2}
}
// chain(coll) - not defined
{
let o = {
a: [1, 2, 3],
b: { c: 1 },
d: 4
};
let result = i.chain(o)
.assocIn(["a", 2], 4)
.merge({ b: { c: 2, c2: 3 } })
.assoc("e", 2)
.dissoc("d")
.value();
}
+72
View File
@@ -0,0 +1,72 @@
// Type definitions for icepick v1.1.0
// Project: https://github.com/aearly/icepick
// Definitions by: Nathan Brown <https://github.com/ngbrown>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "icepick" {
export function freeze<T>(collection: T): T;
export function thaw<T>(collection: T): T;
export function assoc<T>(collection: T, key: number | string, value: any): T;
export function dissoc<T>(collection: T, key: number | string): T;
export function assocIn<T>(collection: T, path: Array<number | string>, value: any): T;
export function getIn<Result>(collection: any, path: Array<number | string>): Result;
export function updateIn<T, V>(collection: T, path: Array<number | string>, callback: (value: V) => V): T;
export {assoc as set};
export {dissoc as unset};
export {assocIn as setIn};
export function assign<T>(target: T): T;
export function assign<T, S1>(target: T, source1: S1): (T & S1);
export function assign<T, S1, S2>(target: T, s1: S1, s2: S2): (T & S1 & S2);
export function assign<T, S1, S2, S3>(target: T, s1: S1, s2: S2, s3: S3): (T & S1 & S2 & S3);
export function assign<T, S1, S2, S3, S4>(target: T, s1: S1, s2: S2, s3: S3, s4: S4): (T & S1 & S2 & S3 & S4);
export {assign as extend};
export function merge<T, S1>(target: T, source: S1): (T & S1);
export function push<T>(array: T[], element: T): T[];
export function pop<T>(array: T[]): T[];
export function shift<T>(array: T[]): T[];
export function unshift<T>(array: T[], element: T): T[];
export function reverse<T>(array: T[]): T[];
export function sort<T>(array: T[], compareFunction?: (a:T, b:T) => number): T[];
export function splice<T>(array: T[], start: number, deleteCount: number, ...items: T[]): T[];
export function slice<T>(array: T[], begin?: number, end?: number): T[];
export function map<T, U>(fn: (value: T) => U, array: T[]): U[];
export function filter<T>(fn: (value: T) => boolean, array: T[]): T[];
interface IcepickWrapper<T> {
value(): T;
freeze(): IcepickWrapper<T>;
thaw(): IcepickWrapper<T>;
assoc(key: number | string, value: any): IcepickWrapper<T>;
set(key: number | string, value: any): IcepickWrapper<T>;
dissoc(key: number | string): IcepickWrapper<T>;
unset(key: number | string): IcepickWrapper<T>;
assocIn(path: Array<number | string>, value: any): IcepickWrapper<T>;
setIn(path: Array<number | string>, value: any): IcepickWrapper<T>;
getIn<Result>(collection: any, path: Array<number | string>): IcepickWrapper<Result>;
updateIn<T, V>(collection: T, path: Array<number | string>, callback: (value: V) => V): IcepickWrapper<T>;
assign<S1>(source1: S1): IcepickWrapper<T & S1>;
assign<S1, S2>(s1: S1, s2: S2): IcepickWrapper<T & S1 & S2>;
assign<S1, S2, S3>(s1: S1, s2: S2, s3: S3): IcepickWrapper<T & S1 & S2 & S3>;
assign<S1, S2, S3, S4>(s1: S1, s2: S2, s3: S3, s4: S4): IcepickWrapper<T & S1 & S2 & S3 & S4>;
extend<S1>(source1: S1): IcepickWrapper<T & S1>;
extend<S1, S2>(s1: S1, s2: S2): IcepickWrapper<T & S1 & S2>;
extend<S1, S2, S3>(s1: S1, s2: S2, s3: S3): IcepickWrapper<T & S1 & S2 & S3>;
extend<S1, S2, S3, S4>(s1: S1, s2: S2, s3: S3, s4: S4): IcepickWrapper<T & S1 & S2 & S3 & S4>;
merge<S1>(source: S1): IcepickWrapper<T & S1>;
}
export function chain<T>(target: T): IcepickWrapper<T>;
}
+27
View File
@@ -0,0 +1,27 @@
/// <reference path="istanbul.d.ts" />
import * as istanbul from 'istanbul';
// Instrument code
var instrumenter = new istanbul.Instrumenter();
var generatedCode = instrumenter.instrumentSync('function meaningOfLife() { return 42; }',
'filename.js');
// Generate reports given a bunch of coverage JSON objects
var collector = new istanbul.Collector(),
reporter = new istanbul.Reporter(),
sync = false;
var obj1 = {},
obj2 = {};
collector.add(obj1);
collector.add(obj2); //etc.
reporter.add('text');
reporter.addAll([ 'lcov', 'clover' ]);
reporter.write(collector, sync, function () {
console.log('All reports generated');
});
+73
View File
@@ -0,0 +1,73 @@
// Type definitions for Istanbul v0.4.0
// Project: https://github.com/gotwarlost/istanbul
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module 'istanbul' {
namespace istanbul {
interface Istanbul {
new (options?: any): Istanbul;
Collector: Collector;
config: Config;
ContentWriter: ContentWriter;
FileWriter: FileWriter;
hook: Hook;
Instrumenter: Instrumenter;
Report: Report;
Reporter: Reporter;
Store: Store;
utils: ObjectUtils;
VERSION: string;
Writer: Writer;
}
interface Collector {
new (options?: any): Collector;
add(coverage: any, testName?: string): void;
}
interface Config {
}
interface ContentWriter {
}
interface FileWriter {
}
interface Hook {
}
interface Instrumenter {
new (options?: any): Instrumenter;
instrumentSync(code: string, filename: string): string;
}
interface Report {
}
interface Configuration {
new (obj: any, overrides: any): Configuration;
}
interface Reporter {
new (cfg?: Configuration, dir?: string): Reporter;
add(fmt: string): void;
addAll(fmts: Array<string>): void;
write(collector: Collector, sync: boolean, callback: Function): void;
}
interface Store {
}
interface ObjectUtils {
}
interface Writer {
}
}
var istanbul: istanbul.Istanbul;
export = istanbul;
}
+6 -6
View File
@@ -60,12 +60,12 @@ declare module joint {
}
interface IOptions {
width: number;
height: number;
gridSize: number;
perpendicularLinks: boolean;
elementView: ElementView;
linkView: LinkView;
width?: number;
height?: number;
gridSize?: number;
perpendicularLinks?: boolean;
elementView?: ElementView;
linkView?: LinkView;
}
class Paper extends Backbone.View<Backbone.Model> {
+80
View File
@@ -0,0 +1,80 @@
/// <reference path="jsurl.d.ts" />
interface UModel extends UrlQuery {
a: any;
b: string;
}
interface U2Model extends UrlQuery {
a: any;
}
interface U3Model extends UrlQuery {
foo: string;
}
var u = new Url<UModel>(); // curent document URL will be used
// or we can instantiate as
var u2 = new Url<U2Model>("http://example.com/some/path?a=b&c=d#someAnchor");
// it should support relative URLs also
var u3 = new Url<U3Model>("/my/site/doc/path?foo=bar#baz");
// get the value of some query string parameter
alert(u2.query.a);
// or
alert(u3.query["foo"]);
// Manupulating query string parameters
u.query.a = [1, 2, 3]; // adds/replaces in query string params a=1&a=2&a=3
u.query.b = 'woohoo'; // adds/replaces in query string param b=woohoo
if (u.query.a instanceof Array) { // the way to add a parameter
u.query.a.push(4); // now it's "a=1&a=2&a=3&a=4&b=woohoo"
}
else { // if not an array but scalar value here is a way how to convert to array
u.query.a = [u.query.a];
u.query.a.push(8)
}
// The way to remove the parameter:
delete u.query.a
// or:
delete u.query["a"]
// If you need to remove all query string params:
u.query.clear();
alert(u);
// Lookup URL parts:
alert(
'protocol = ' + u.protocol + '\n' +
'user = ' + u.user + '\n' +
'pass = ' + u.pass + '\n' +
'host = ' + u.host + '\n' +
'port = ' + u.port + '\n' +
'path = ' + u.path + '\n' +
'query = ' + u.query + '\n' +
'hash = ' + u.hash
);
// Manipulating URL parts
u.path = '/some/new/path'; // the way to change URL path
u.protocol = 'https' // the way to force https protocol on the source URL
// inject into string
var str = '<a href="' + u + '">My Cool Link</a>';
// or use in DOM context
var a = document.createElement('a');
a.href = u.toString();
a.innerHTML = 'test';
document.body.appendChild(a);
// Stringify
var su1 = u + '';
var su2 = String(u);
var su3 = u.toString();
// NOTE, that usually it will be done automatically, so only in special
// cases direct stringify is required
+23
View File
@@ -0,0 +1,23 @@
// Type definitions for jsurl 1.2.7
// Project: https://github.com/Mikhus/jsurl
// Definitions by: Alexey Gorshkov <https://github.com/agorshkov23>
// Definitions: https://github.com/agorshkov23/DefinitelyTyped
interface UrlQuery {
clear: () => void;
}
declare class Url<T> {
constructor();
constructor(url: string);
query: T;
protocol: string;
user: string;
pass: string;
host: string;
port: string;
path: string;
hash: string;
href: string;
toString: () => string;
}
+220
View File
@@ -0,0 +1,220 @@
/// <reference path="karma-coverage.d.ts" />
import * as karma from 'karma-coverage';
// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/README.md#basic
module.exports = function(config: karma.Config) {
config.set({
files: [
'src/**/*.js',
'test/**/*.js'
],
// coverage reporter generates the coverage
reporters: ['progress', 'coverage'],
preprocessors: {
// source files, that you wanna generate coverage for
// do not include tests or libraries
// (these files will be instrumented by Istanbul)
'src/**/*.js': ['coverage']
},
// optionally, configure the reporter
coverageReporter: {
type : 'html',
dir : 'coverage/'
}
});
};
// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/README.md#advanced-multiple-reporters
module.exports = function(config: karma.Config) {
config.set({
files: [
'src/**/*.js',
'test/**/*.js'
],
reporters: ['progress', 'coverage'],
preprocessors: {
'src/**/*.js': ['coverage']
},
coverageReporter: {
// specify a common output directory
dir: 'build/reports/coverage',
reporters: [
// reporters not supporting the `file` property
{ type: 'html', subdir: 'report-html' },
{ type: 'lcov', subdir: 'report-lcov' },
// reporters supporting the `file` property, use `subdir` to directly
// output them in the `dir` directory
{ type: 'cobertura', subdir: '.', file: 'cobertura.txt' },
{ type: 'lcovonly', subdir: '.', file: 'report-lcovonly.txt' },
{ type: 'teamcity', subdir: '.', file: 'teamcity.txt' },
{ type: 'text', subdir: '.', file: 'text.txt' },
{ type: 'text-summary', subdir: '.', file: 'text-summary.txt' },
]
}
});
};
// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/README.md#dont-minify-instrumenter-output
module.exports = function(config: karma.Config) {
config.set({
coverageReporter: {
instrumenterOptions: {
istanbul: { noCompact: true }
}
}
});
};
// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#subdir
module.exports = function(config: karma.Config) {
config.set({
coverageReporter: {
dir: 'coverage',
subdir: '.'
// Would output the results into: .'/coverage/'
}
});
};
module.exports = function(config: karma.Config) {
config.set({
coverageReporter: {
dir: 'coverage',
subdir: 'report'
// Would output the results into: .'/coverage/report/'
}
});
};
module.exports = function(config: karma.Config) {
config.set({
coverageReporter: {
dir: 'coverage',
subdir: function(browser) {
// normalization process to keep a consistent browser name accross different
// OS
return browser.toLowerCase().split(/[ /-]/)[0];
}
// Would output the results into: './coverage/firefox/'
}
});
};
// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#file
module.exports = function(config: karma.Config) {
config.set({
coverageReporter: {
type : 'text',
dir : 'coverage/',
file : 'coverage.txt'
}
});
};
// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#check
module.exports = function(config: karma.Config) {
config.set({
coverageReporter: {
check: {
global: {
statements: 50,
branches: 50,
functions: 50,
lines: 50,
excludes: [
'foo/bar/**/*.js'
]
},
each: {
statements: 50,
branches: 50,
functions: 50,
lines: 50,
excludes: [
'other/directory/**/*.js'
],
overrides: {
'baz/component/**/*.js': {
statements: 98
}
}
}
}
}
});
};
// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#watermarks
module.exports = function(config: karma.Config) {
config.set({
coverageReporter: {
watermarks: {
statements: [ 50, 75 ],
functions: [ 50, 75 ],
branches: [ 50, 75 ],
lines: [ 50, 75 ]
}
}
});
};
// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#sourcestore
module.exports = function(config: karma.Config) {
config.set({
coverageReporter: {
type : 'text',
dir : 'coverage/',
file : 'coverage.txt',
sourceStore : require('istanbul').Store.create('fslookup')
}
});
};
// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#reporters
module.exports = function(config: karma.Config) {
config.set({
coverageReporter: {
reporters:[
{type: 'html', dir:'coverage/'},
{type: 'teamcity'},
{type: 'text-summary'}
],
}
});
};
// See https://github.com/karma-runner/karma-coverage/blob/v0.5.3/docs/configuration.md#instrumenter
module.exports = function(config: karma.Config) {
config.set({
coverageReporter: {
instrumenters: { ibrik : require('ibrik') },
instrumenter: {
'**/*.coffee': 'ibrik'
},
// ...
}
});
};
var to5Options = { experimental: true };
// [...]
module.exports = function(config: karma.Config) {
config.set({
coverageReporter: {
instrumenters: { isparta : require('isparta') },
instrumenter: {
'**/*.js': 'isparta'
},
instrumenterOptions: {
isparta: { to5 : to5Options }
}
}
});
};
+42
View File
@@ -0,0 +1,42 @@
// Type definitions for karma-coverage v0.5.3
// Project: https://github.com/karma-runner/karma-coverage
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../karma/karma.d.ts" />
/// <reference path="../istanbul/istanbul.d.ts" />
declare module 'karma-coverage' {
import * as karma from 'karma';
import * as istanbul from 'istanbul';
namespace karmaCoverage {
interface Karma extends karma.Karma {}
interface Config extends karma.Config {
set: (config: ConfigOptions) => void;
}
interface ConfigOptions extends karma.ConfigOptions {
/**
* See https://github.com/karma-runner/karma-coverage/blob/master/docs/configuration.md
*/
coverageReporter?: (Reporter|Reporter[]);
}
interface Reporter {
type?: string;
dir?: string;
subdir?: string | ((browser: string) => string);
check?: any;
watermarks?: any;
includeAllSources?: boolean;
sourceStore?: istanbul.Store;
instrumenter?: any;
}
}
var karmaCoverage: karmaCoverage.Karma;
export = karmaCoverage;
}
+3 -3
View File
@@ -82,8 +82,8 @@ declare module 'karma' {
interface ServerCallback {
(exitCode: number): void;
}
interface Config {
interface Config {
set: (config: ConfigOptions) => void;
LOG_DISABLE: string;
LOG_ERROR: string;
@@ -91,7 +91,7 @@ declare module 'karma' {
LOG_INFO: string;
LOG_DEBUG: string;
}
interface ConfigFile {
configFile: string;
}
+8 -5
View File
@@ -30,7 +30,7 @@ import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'ke
let stream10: Stream<number, void> = Kefir.stream<number, void>(emitter => {
let count = 0;
emitter.emit(count);
let intervalId = setInterval(() => {
count++;
if (count < 4) {
@@ -39,7 +39,7 @@ import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'ke
emitter.end();
}
}, 1000);
return () => clearInterval(intervalId);
});
}
@@ -77,6 +77,7 @@ import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'ke
let observable01: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).map(x => x + 1);
let observable02: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).filter(x => x > 1);
let observable03: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).take(2);
let observable29: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).takeErrors(2);
let observable04: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).takeWhile(x => x < 3);
let observable05: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).last();
let observable06: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).skip(2);
@@ -103,14 +104,16 @@ import { Observable, ObservablePool, Stream, Property, Event, Emitter } from 'ke
}).endOnError();
let observable22: Stream<void, number> = Kefir.sequentially(100, [0, -1, 2, -3]).valuesToErrors(x => {
return {convert: x < 0, error: x};
}).skipValues();
}).ignoreValues();
let observable23: Stream<void, void> = Kefir.sequentially(100, [0, -1, 2, -3]).valuesToErrors(x => {
return {convert: x < 0, error: x};
}).skipErrors();
let observable24: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).skipEnd();
}).ignoreErrors();
let observable24: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).ignoreEnd();
let ovservable25: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3]).beforeEnd(() => 0);
let observable26: Stream<number[], void> = Kefir.sequentially(100, [1, 2, 3, 4, 5]).slidingWindow(3, 2)
let observable27: Stream<number[], void> = Kefir.sequentially(100, [1, 2, 3, 4, 5]).bufferWhile(x => x !== 3);
let observable30: Stream<number[], void> = Kefir.sequentially(100, [1, 2, 3, 4, 5]).bufferWithCount(2);
let observable31: Stream<number[], void> = Kefir.sequentially(100, [1, 2, 3, 4, 5]).bufferWithTimeOrCount(330, 10);
{
var myTransducer: any;
let observable28: Stream<number, void> = Kefir.sequentially(100, [1, 2, 3, 4, 5, 6]).transduce<number>(myTransducer);
+35 -29
View File
@@ -1,4 +1,4 @@
// Type definitions for Kefir 2.8.1
// Type definitions for Kefir 3.2.0
// Project: http://rpominov.github.io/kefir/
// Definitions by: Aya Morisawa <https://github.com/AyaMorisawa>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -6,7 +6,7 @@
/// <reference path="../node/node.d.ts" />
declare module "kefir" {
export interface Observable<T, S> {
// Subscribe / add side effects
onValue(callback: (value: T) => void): void;
@@ -19,12 +19,14 @@ declare module "kefir" {
offAny(callback: (event: Event<T | S>) => void): void;
log(name?: string): void;
offLog(name?: string): void;
flatten<U>(transformer?: (value: T) => U[]): Stream<U, S>;
toPromise(PromiseConstructor?: any): any;
toESObservable(): any;
}
export interface Stream<T, S> extends Observable<T, S> {
toProperty(getCurrent?: () => T): Property<T, S>;
// Modify an stream
map<U>(fn: (value: T) => U): Stream<U, S>;
filter(predicate?: (value: T) => boolean): Stream<T, S>;
@@ -36,24 +38,26 @@ declare module "kefir" {
skipDuplicates(comparator?: (a: T, b: T) => boolean): Stream<T, S>;
diff(fn?: (prev: T, next: T) => T, seed?: T): Stream<T, S>;
scan(fn: (prev: T, next: T) => T, seed?: T): Stream<T, S>;
flatten<U>(transformer?: (value: T) => U[]): Stream<U, S>;
delay(wait: number): Stream<T, S>;
throttle(wait: number, options?: {leading: boolean, trailing: boolean}): Stream<T, S>;
throttle(wait: number, options?: {leading?: boolean, trailing?: boolean}): Stream<T, S>;
debounce(wait: number, options?: {immediate: boolean}): Stream<T, S>;
valuesToErrors<U>(handler?: (value: T) => {convert: boolean, error: U}): Stream<void, S | U>;
errorsToValues<U>(handler?: (error: S) => {convert: boolean, value: U}): Stream<T | U, void>;
mapErrors<U>(fn: (error: S) => U): Stream<T, U>;
filterErrors(predicate?: (error: S) => boolean): Stream<T, S>;
endOnError(): Stream<T, S>;
skipValues(): Stream<void, S>;
skipErrors(): Stream<T, void>;
skipEnd(): Stream<T, S>;
takeErrors(n: number): Stream<T, S>;
ignoreValues(): Stream<void, S>;
ignoreErrors(): Stream<T, void>;
ignoreEnd(): Stream<T, S>;
beforeEnd<U>(fn: () => U): Stream<T | U, S>;
slidingWindow(max: number, mix?: number): Stream<T[], S>;
bufferWhile(predicate: (value: T) => boolean): Stream<T[], S>;
bufferWithCount(count: number, options?: {flushOnEnd: boolean}): Stream<T[], S>;
bufferWithTimeOrCount(interval: number, count: number, options?: {flushOnEnd: boolean}): Stream<T[], S>;
transduce<U>(transducer: any): Stream<U, S>;
withHandler<U, V>(handler: (emitter: Emitter<U, S>, event: Event<T | S>) => void): Stream<U, S>;
// Combine streams
combine<U, V, W>(otherObs: Stream<U, V>, combinator?: (value: T, ...values: U[]) => W): Stream<W, S | V>;
zip<U, V, W>(otherObs: Stream<U, V>, combinator?: (value: T, ...values: U[]) => W): Stream<W, S | V>;
@@ -65,20 +69,20 @@ declare module "kefir" {
flatMapConcat<U, V>(fn: (value: T) => Stream<U, V>): Stream<U, V>;
flatMapConcurLimit<U, V>(fn: (value: T) => Stream<U, V>, limit: number): Stream<U, V>;
flatMapErrors<U, V>(transform: (error: S) => Stream<U, V>): Stream<U, V>;
// Combine two streams
filterBy<U>(otherObs: Observable<boolean, U>): Stream<T, S>;
sampledBy<U, V, W>(otherObs: Observable<U, V>, combinator?: (a: T, b: U) => W): Stream<W, S>;
skipUntilBy<U, V>(otherObs: Observable<U, V>): Stream<U, V>;
takeUntilBy<U, V>(otherObs: Observable<U, V>): Stream<U, V>;
bufferBy<U, V>(otherObs: Observable<U, V>, options?: {flushOnEnd: boolean}): Stream<T[], S>;
bufferWhileBy<U>(otherObs: Observable<boolean, U>): Stream<T[], S>;
bufferWhileBy<U>(otherObs: Observable<boolean, U>, options?: {flushOnEnd?: boolean, flushOnChange?: boolean}): Stream<T[], S>;
awaiting<U, V>(otherObs: Observable<U, V>): Stream<boolean, S>;
}
export interface Property<T, S> extends Observable<T, S> {
changes(): Stream<T, S>;
// Modify an property
map<U>(fn: (value: T) => U): Property<U, S>;
filter(predicate?: (value: T) => boolean): Property<T, S>;
@@ -90,24 +94,26 @@ declare module "kefir" {
skipDuplicates(comparator?: (a: T, b: T) => boolean): Property<T, S>;
diff(fn?: (prev: T, next: T) => T, seed?: T): Property<T, S>;
scan(fn: (prev: T, next: T) => T, seed?: T): Property<T, S>;
flatten<U>(transformer?: (value: T) => U[]): Property<U, S>;
delay(wait: number): Property<T, S>;
throttle(wait: number, options?: {leading: boolean, trailing: boolean}): Property<T, S>;
throttle(wait: number, options?: {leading?: boolean, trailing?: boolean}): Property<T, S>;
debounce(wait: number, options?: {immediate: boolean}): Property<T, S>;
valuesToErrors<U>(handler?: (value: T) => {convert: boolean, error: U}): Property<void, S | U>;
errorsToValues<U>(handler?: (error: S) => {convert: boolean, value: U}): Property<T | U, void>;
mapErrors<U>(fn: (error: S) => U): Property<T, U>;
filterErrors(predicate?: (error: S) => boolean): Property<T, S>;
endOnError(): Property<T, S>;
skipValues(): Property<void, S>;
skipErrors(): Property<T, void>;
skipEnd(): Property<T, S>;
takeErrors(n: number): Stream<T, S>;
ignoreValues(): Property<void, S>;
ignoreErrors(): Property<T, void>;
ignoreEnd(): Property<T, S>;
beforeEnd<U>(fn: () => U): Property<T | U, S>;
slidingWindow(max: number, mix?: number): Property<T[], S>;
bufferWhile(predicate: (value: T) => boolean): Property<T[], S>;
bufferWithCount(count: number, options?: {flushOnEnd: boolean}): Property<T[], S>;
bufferWithTimeOrCount(interval: number, count: number, options?: {flushOnEnd: boolean}): Property<T[], S>;
transduce<U>(transducer: any): Property<U, S>;
withHandler<U, V>(handler: (emitter: Emitter<T, S>, event: Event<T | S>) => void): Property<U, S>;
// Combine properties
combine<U, V, W>(otherObs: Property<U, V>, combinator?: (value: T, ...values: U[]) => W): Property<W, S | V>;
zip<U, V, W>(otherObs: Property<U, V>, combinator?: (value: T, ...values: U[]) => W): Property<W, S | V>;
@@ -119,35 +125,34 @@ declare module "kefir" {
flatMapConcat<U, V>(fn: (value: T) => Property<U, V>): Property<U, V>;
flatMapConcurLimit<U, V>(fn: (value: T) => Property<U, V>, limit: number): Property<U, V>;
flatMapErrors<U, V>(transform: (error: S) => Property<U, V>): Property<U, V>;
// Combine two properties
filterBy<U>(otherObs: Observable<boolean, U>): Property<T, S>;
sampledBy<U, V, W>(otherObs: Observable<U, V>, combinator?: (a: T, b: U) => W): Property<W, S>;
skipUntilBy<U, V>(otherObs: Observable<U, V>): Property<U, V>;
takeUntilBy<U, V>(otherObs: Observable<U, V>): Property<U, V>;
bufferBy<U, V>(otherObs: Observable<U, V>, options?: {flushOnEnd: boolean}): Property<T[], S>;
bufferWhileBy<U>(otherObs: Observable<boolean, U>): Property<T[], S>;
bufferWhileBy<U>(otherObs: Observable<boolean, U>, options?: {flushOnEnd?: boolean, flushOnChange?: boolean}): Property<T[], S>;
awaiting<U, V>(otherObs: Observable<U, V>): Property<boolean, S>;
}
export interface ObservablePool<T, S> extends Observable<T, S> {
plug(obs: Observable<T, S>): void;
unPlug(obs: Observable<T, S>): void;
}
export interface Event<T> {
type: string;
value: T;
current: boolean;
}
export interface Emitter<T, S> {
emit(value: T): void;
error(error: S): void;
end(): void;
emitEvent(event: {type: string, value: T | S}): void;
}
// Create a stream
export function never(): Stream<void, void>;
export function later<T>(wait: number, value: T): Stream<T, void>;
@@ -159,12 +164,13 @@ declare module "kefir" {
export function fromNodeCallback<T, S>(fn: (callback: (error: S, result: T) => void) => void): Stream<T, S>;
export function fromEvents<T, S>(target: EventTarget | NodeJS.EventEmitter | { on: Function, off: Function }, eventName: string, transform?: (value: T) => S): Stream<T, S>;
export function stream<T, S>(subscribe: (emitter: Emitter<T, S>) => Function | void): Stream<T, S>;
export function fromESObservable<T, S>(observable: any): Stream<T, S>
// Create a property
export function constant<T>(value: T): Property<T, void>;
export function constantError<T>(error: T): Property<void, T>;
export function fromPromise<T, S>(promise: any): Property<T, S>;
// Combine observables
export function combine<T, S, U>(obss: Observable<T, S>[], passiveObss: Observable<T, S>[], combinator?: (...values: T[]) => U): Observable<U, S>;
export function combine<T, S, U>(obss: Observable<T, S>[], combinator?: (...values: T[]) => U): Observable<U, S>;
+11
View File
@@ -46,4 +46,15 @@ function main() {
object.set("foo", 1);
object.save();
KiiGroup.registerGroupWithID("Group ID", "Group Name", [user], {
success: function(theSavedGroup: KiiGroup) {
theSavedGroup.saveWithOwner("user ID");
},
failure: function(theGroup: KiiGroup,
anErrorString: String,
addMembersArray: KiiUser[],
removeMembersArray: KiiUser[]) {
}
});
}
+195 -12
View File
@@ -1,4 +1,4 @@
// Type definitions for Kii Cloud SDK v2.3.0
// Type definitions for Kii Cloud SDK v2.4.0
// Project: http://en.kii.com/
// Definitions by: Kii Consortium <http://jp.kii.com/consortium/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -83,6 +83,11 @@ declare module KiiCloud {
*/
_lot?: string;
/**
* product name given by thing vendor.
*/
_productName?: string;
/**
* arbitrary string field.
*/
@@ -1028,6 +1033,65 @@ declare module KiiCloud {
*/
groupWithID(group: string): KiiGroup;
/**
* Register new group own by specified user on Kii Cloud with specified ID.
* This method can be used only by app admin.
*
* <br><br>If the group that has specified id already exists, registration will be failed.
*
* @param groupID ID of the KiiGroup
* @param groupName Name of the KiiGroup
* @param user id of owner
* @param members An array of KiiUser objects to add to the group
* @param callbacks
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theSavedGroup). theSavedGroup is KiiGroup instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiGroup instance which this method was called on.</li>
* <li>error.message</li>
* <li>error.addMembersArray is array of KiiUser to be added as memebers of this group.</li>
* <li>error.removeMembersArray is array of KiiUser to be removed from the memebers list of this group.</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* Kii.authenticateAsAppAdmin("client-id", "client-secret", {
* success: function(adminContext) {
* var members = [];
* members.push(KiiUser.userWithID("Member User Id"));
* adminContext.registerGroupWithOwnerAndID("Group ID", "Group Name", "Owner User ID", members, {
* success: function(theSavedGroup) {
* // do something with the saved group
* },
* failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) {
* // do something with the error response
* }
* });
* },
* failure: function(errorString, errorCode) {
* // auth failed.
* }
* });
* // example to use Promise
* Kii.authenticateAsAppAdmin("client-id", "client-secret").then(
* function(adminContext) {
* var members = [];
* members.push(KiiUser.userWithID("Member User Id"));
* return adminContext.registerGroupWithOwnerAndID("Group ID", "Group Name", "Owner User ID", members);
* }
* ).then(
* function(group) {
* // do something with the saved group
* }
* );
*/
registerGroupWithOwnerAndID(groupID: string, groupName: string, user: string, members: KiiUser[], callbacks?: { success(adminContext: KiiAppAdminContext): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise<KiiAppAdminContext>;
/**
* Creates a reference to a group operated by app admin using group's URI.
* <br><br>
@@ -1362,7 +1426,7 @@ declare module KiiCloud {
* Register user/group as owner of specified thing by app admin.
*
* @param thingID The ID of thing
* @param owner to be registered as owner.
* @param owner instnce of KiiUser/KiiGroup to be registered as owner.
* @param callbacks object holds callback functions.
*
* @return return promise object.
@@ -1415,7 +1479,7 @@ declare module KiiCloud {
* Register user/group as owner of specified thing by app admin.
*
* @param vendorThingID The vendor thing ID of thing
* @param owner to be registered as owner.
* @param owner instance of KiiUser/KiiGroupd to be registered as owner.
* @param callbacks object holds callback functions.
*
* @return return promise object.
@@ -2205,6 +2269,58 @@ declare module KiiCloud {
*/
objectURI(): string;
/**
* Register new group own by current user on Kii Cloud with specified ID.
*
* <br><br>If the group that has specified id already exists, registration will be failed.
*
* @param groupID ID of the KiiGroup
* @param groupName Name of the KiiGroup
* @param members An array of KiiUser objects to add to the group
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theSavedGroup). theSavedGroup is KiiGroup instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiGroup instance which this method was called on.</li>
* <li>error.message</li>
* <li>error.addMembersArray is array of KiiUser to be added as memebers of this group.</li>
* <li>error.removeMembersArray is array of KiiUser to be removed from the memebers list of this group.</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var members = [];
* members.push(KiiUser.userWithID("Member User Id"));
* KiiGroup.registerGroupWithID("Group ID", "Group Name", members, {
* success: function(theSavedGroup) {
* // do something with the saved group
* },
* failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var members = [];
* members.push(KiiUser.userWithID("Member User Id"));
* KiiGroup.registerGroupWithID("Group ID", "Group Name", members).then(
* function(theSavedGroup) {
* // do something with the saved group
* },
* function(error) {
* var theGroup = error.target;
* var anErrorString = error.message;
* var addMembersArray = error.addMembersArray;
* // do something with the error response
* });
*/
static registerGroupWithID(groupID: string, groupName: string, members: KiiUser[], callbacks?: { success(theSavedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise<KiiGroup>;
/**
* Creates a reference to a bucket for this group
*
@@ -2420,6 +2536,65 @@ declare module KiiCloud {
*/
save(callbacks?: { success(theSavedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise<KiiGroup>;
/**
* Saves the latest group values to the server with specified owner.
* This method can be used only by the group owner or app admin.
*
* <br><br>If the group does not yet exist, it will be created. If the group already exists, the members and owner that have changed will be updated accordingly. If the group already exists and there is no updates of members and owner, it will allways succeed but does not execute update. To change the name of group, use {@link #changeGroupName}.
*
* @param user id of owner
* @param callbacks An object with callback methods defined
*
* @return return promise object.
* <ul>
* <li>fulfill callback function: function(theSavedGroup). theSavedGroup is KiiGroup instance.</li>
* <li>reject callback function: function(error). error is an Error instance.
* <ul>
* <li>error.target is the KiiGroup instance which this method was called on.</li>
* <li>error.message</li>
* <li>error.addMembersArray is array of KiiUser to be added as memebers of this group.</li>
* <li>error.removeMembersArray is array of KiiUser to be removed from the memebers list of this group.</li>
* </ul>
* </li>
* </ul>
*
* @example
* // example to use callbacks directly
* var group = . . .; // a KiiGroup
* group.saveWithOwner("UserID of owner", {
* success: function(theSavedGroup) {
* // do something with the saved group
* },
*
* failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) {
* // do something with the error response
* }
* });
*
* // example to use Promise
* var group = . . .; // a KiiGroup
* group.saveWithOwner("UserID of owner", {
* success: function(theSavedGroup) {
* // do something with the saved group
* },
*
* failure: function(theGroup, anErrorString, addMembersArray, removeMembersArray) {
* // do something with the error response
* }
* }).then(
* function(theSavedGroup) {
* // do something with the saved group
* },
* function(error) {
* var theGroup = error.target;
* var anErrorString = error.message;
* var addMembersArray = error.addMembersArray;
* var removeMembersArray = error.removeMembersArray;
* // do something with the error response
* });
*/
saveWithOwner(user: string, callbacks?: { success(theSavedGroup: KiiGroup): any; failure(theGroup: KiiGroup, anErrorString: string, addMembersArray: KiiUser[], removeMembersArray: KiiUser[]): any; }): Promise<KiiGroup>;
/**
* Updates the local group's data with the group data on the server
*
@@ -2735,14 +2910,14 @@ declare module KiiCloud {
/**
* Get the application-defined type name of the object
*
* @return
* @return type of this object. null or undefined if none exists
*/
getObjectType(): string;
/**
* Get the body content-type.
* It will be updated after the success of {@link KiiObject#uploadBody} and {@link KiiObject#downloadBody}
* returns null when this object doesn't have body content-type information.
* returns null or undefined when this object doesn't have body content-type information.
*
* @return content-type of object body
*/
@@ -2751,15 +2926,18 @@ declare module KiiCloud {
/**
* Sets a key/value pair to a KiiObject
*
* <br><br>If the key already exists, its value will be written over. If the object is of invalid type, it will return false and a KiiError will be thrown (quietly). Accepted types are any JSON-encodable objects.
* <br><br>If the key already exists, its value will be written over.
* <br><b>NOTE: Before involving floating point value, please consider using integer instead. For example, use percentage, permil, ppm, etc.</br></b>
* The reason is:
* <li>Will dramatically improve the performance of bucket query.</li>
* <li>Bucket query does not support the mixed result of integer and floating point.
* ex.) If you use same key for integer and floating point and inquire object with the integer value, objects which has floating point value with the key would not be evaluated in the query. (and vice versa)</li>
*
* @param key The key to set. The key must not be a system key (created, metadata, modified, type, uuid) or begin with an underscore (_)
* @param value The value to be set. Object must be of a JSON-encodable type (Ex: dictionary, array, string, number, etc)
* @param key The key to set.
* if null, empty string or string prefixed with '_' is specified, silently ignored and have no effect.
* We don't check if actual type is String or not. If non-string type is specified, it will be encoded as key by JSON.stringify()
* @param value The value to be set. Object must be JSON-encodable type (dictionary, array, string, number, boolean)
* We don't check actual type of the value. It will be encoded as value by JSON.stringify()
*
* @example
* var obj = . . .; // a KiiObject
@@ -2772,7 +2950,7 @@ declare module KiiCloud {
*
* @param key The key to retrieve
*
* @return The object associated with the key. null if none exists
* @return The object associated with the key. null or undefined if none exists
*
* @example
* var obj = . . .; // a KiiObject
@@ -4665,6 +4843,11 @@ declare module KiiCloud {
* '_thingID', '_created', '_accessToken' <br>
* Following properties are readonly after creation and will be ignored on {@link #update} of thing.<br>
* '_vendorThingID', '_password'<br>
* As Property prefixed with '_' is reserved by Kii Cloud,
* properties other than ones described in the parameter secion
* and '_layoutPosition' are ignored on creation/{@link #update} of thing.<br>
* Those ignored properties won't be removed from fields object passed as argument.
* However it won't be reflected to fields object property of created/updated Thing.
*
* @param fields of the thing to be registered.
* @param callbacks object holds callback functions.
@@ -5007,7 +5190,7 @@ declare module KiiCloud {
* API is authorized by app admin.<br>
*
* @param thingID The ID of thing
* @param owner to be registered as owner.
* @param owner instance of KiiUser/KiiGroup to be registered as owner.
* @param callbacks object holds callback functions.
*
* @return return promise object.
@@ -5059,7 +5242,7 @@ declare module KiiCloud {
* API is authorized by app admin.<br>
*
* @param vendorThingID The vendor thing ID of thing
* @param owner to be registered as owner.
* @param owner instance of KiiUser/KiiGroup to be registered as owner.
* @param callbacks object holds callback functions.
*
* @return return promise object.
@@ -5850,7 +6033,7 @@ declare module KiiCloud {
*
* @param key The key to retrieve
*
* @return The object associated with the key. null if none exists
* @return The object associated with the key. null or undefined if none exists
*
* @example
* var user = . . .; // a KiiUser
+2 -1
View File
@@ -14,7 +14,8 @@ var options: MarkedOptions = {
return '';
},
langPrefix: 'lang-',
smartypants: false
smartypants: false,
renderer: new marked.Renderer()
};
function callback() {
+38 -2
View File
@@ -3,7 +3,6 @@
// Definitions by: William Orr <https://github.com/worr>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
interface MarkedStatic {
/**
* Compiles markdown to HTML.
@@ -60,6 +59,43 @@ interface MarkedStatic {
* @param options Hash of options
*/
setOptions(options: MarkedOptions): MarkedStatic;
Renderer: {
new(): MarkedRenderer;
}
Parser: {
new(options: MarkedOptions): MarkedParser;
}
}
interface MarkedRenderer {
code(code: string, language: string): string;
blockquote(quote: string): string;
html(html: string): string;
heading(text: string, level: number): string;
hr(): string;
list(body: string, ordered: boolean): string;
listitem(text: string): string;
paragraph(text: string): string;
table(header: string, body: string): string;
tablerow(content: string): string;
tablecell(content: string, flags: {
header: boolean,
align: string
}): string;
strong(text: string): string;
em(text: string): string;
codespan(code: string): string;
br(): string;
del(text: string): string;
link(href: string, title: string, text: string): string;
image(href: string, title: string, text: string): string;
text(text: string): string;
}
interface MarkedParser {
parse(source: any[]): string
}
interface MarkedOptions {
@@ -68,7 +104,7 @@ interface MarkedOptions {
*
* An object containing functions to render tokens to HTML.
*/
renderer?: Object;
renderer?: MarkedRenderer;
/**
* Enable GitHub flavored markdown.
+30
View File
@@ -0,0 +1,30 @@
/// <reference path="mmmagic.d.ts" />
import Magic = require("mmmagic");
// get general description of a file
var magic: Magic.Magic;
magic = new Magic.Magic();
magic.detectFile('node_modules/mmmagic/build/Release/magic.node', function(err: Error, result: string) {
if (err) throw err;
console.log(result);
// output on Windows with 32-bit node:
});
// get mime type for a file
magic = new Magic.Magic(Magic.MAGIC_MIME_TYPE);
magic.detectFile('node_modules/mmmagic/build/Release/magic.node', function(err: Error, result: string) {
if (err) throw err;
console.log(result);
});
// get mime type and mime encoding for a file
magic = new Magic.Magic();
var buf = new Buffer('import Options\nfrom os import unlink, symlink');
magic.detect(buf, function(err: Error, result: string) {
if (err) throw err;
console.log(result);
// output: Python script, ASCII text executable
});
+37
View File
@@ -0,0 +1,37 @@
// Type definitions for mmmagic v0.4.1
// Project: https://github.com/mscdex/mmmagic
// Definitions by: Andrei Sebastian Cîmpean <http://andreime.com/>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "mmmagic" {
export type bitmask = number;
export class Magic {
constructor(magicPath?: string, mask?: bitmask);
constructor(mask?: bitmask);
detectFile(path: string, callback: (err: Error, result: string) => void): void;
detect(data: Buffer, callback: (err: Error, result: string) => void): void;
}
export var MAGIC_NONE: bitmask; // no flags set
export var MAGIC_DEBUG: bitmask; // turn on debugging
export var MAGIC_SYMLINK: bitmask; // follow symlinks (default for non-Windows)
export var MAGIC_DEVICES: bitmask; // look at the contents of devices
export var MAGIC_MIME_TYPE: bitmask; // return the MIME type
export var MAGIC_CONTINUE: bitmask; // return all matches (returned as an array of strings)
export var MAGIC_CHECK: bitmask; // print warnings to stderr
export var MAGIC_PRESERVE_ATIME: bitmask; // restore access time on exit
export var MAGIC_RAW: bitmask; // don't translate unprintable chars
export var MAGIC_MIME_ENCODING: bitmask; // return the MIME encoding
export var MAGIC_MIME: bitmask; // (export var MAGIC_MIME_TYPE | export var MAGIC_MIME_ENCODING)
export var MAGIC_APPLE: bitmask; // return the Apple creator and type
export var MAGIC_NO_CHECK_TAR: bitmask; // don't check for tar files
export var MAGIC_NO_CHECK_SOFT: bitmask; // don't check magic entries
export var MAGIC_NO_CHECK_APPTYPE: bitmask; // don't check application type
export var MAGIC_NO_CHECK_ELF: bitmask; // don't check for elf details
export var MAGIC_NO_CHECK_TEXT: bitmask; // don't check for text files
export var MAGIC_NO_CHECK_CDF: bitmask; // don't check for cdf files
export var MAGIC_NO_CHECK_TOKENS: bitmask; // don't check tokens
export var MAGIC_NO_CHECK_ENCODING: bitmask // don't check text encodings
}
+2 -2
View File
@@ -195,8 +195,8 @@ Model.findOneAndRemove({ type: 'iphone' }, { select: 'name' }, (err: any, res: I
Model.findOneAndRemove({ type: 'iphone' }, { select: 'name' }).exec((err: any, res: IActor) => {});
Model.findOneAndUpdate({ type: 'iphone' }, { $set: { name: 'jason borne' }}, { upsert: true }, (err: any, res: IActor) => {});
Model.geoNear([1, 3], { maxDistance : 5, spherical : true }, (err: any, res: IActor[]) => {});
Model.geoNear({ type : "Point", coordinates : [9,9] }, { maxDistance : 5, spherical : true }, (err: any, res: IActor[]) => {});
Model.geoNear([1, 3], { maxDistance : 5, spherical : true }, (err: any, res: IActor[], stats: any) => {});
Model.geoNear({ type : "Point", coordinates : [9,9] }, { maxDistance : 5, spherical : true }, (err: any, res: IActor[], stats: any) => {});
Model.geoSearch({ type : "house" }, { near: [10, 10], maxDistance: 5 }, (err: any, res: IActor[]) => {});
var o = {
+2 -2
View File
@@ -212,8 +212,8 @@ declare module "mongoose" {
findOneAndUpdate(cond: Object, update: Object, callback?: (err: any, res: T) => void): Query<T>;
findOneAndUpdate(cond: Object, update: Object, options: FindAndUpdateOption, callback?: (err: any, res: T) => void): Query<T>;
geoNear(point: { type: string; coordinates: number[] }, options: Object, callback?: (err: any, res: T[]) => void): Query<T[]>;
geoNear(point: number[], options: Object, callback?: (err: any, res: T[]) => void): Query<T[]>;
geoNear(point: { type: string; coordinates: number[] }, options: Object, callback?: (err: any, res: T[], stats: any) => void): Query<T[]>;
geoNear(point: number[], options: Object, callback?: (err: any, res: T[], stats: any) => void): Query<T[]>;
geoSearch(cond: Object, options: GeoSearchOption, callback?: (err: any, res: T[]) => void): Query<T[]>;
increment(): T;
mapReduce<K, V>(options: MapReduceOption<T, K, V>, callback?: (err: any, res: MapReduceResult<K, V>[]) => void): Promise<MapReduceResult<K, V>[]>;
+4 -2
View File
@@ -23,7 +23,9 @@ morgan('combined', {
buffer: true,
immediate: true,
skip: function (req, res) { return res.statusCode < 400 },
stream: (str: string) => {
console.log(str);
stream: {
write: (str: string) => {
console.log(str);
}
}
});
+8 -1
View File
@@ -12,6 +12,13 @@ declare module "morgan" {
export function token<T>(name: string, callback: (req: express.Request, res: express.Response) => T): express.RequestHandler;
export interface StreamOptions {
/**
* Output stream for writing log lines
*/
write: (str: string) => void;
}
/***
* Morgan accepts these properties in the options object.
*/
@@ -36,7 +43,7 @@ declare module "morgan" {
* Output stream for writing log lines, defaults to process.stdout.
* @param str
*/
stream?: (str: string) => void;
stream?: StreamOptions;
}
}
+11 -1
View File
@@ -78,10 +78,20 @@ module NavigationTests {
// State Handler
class LogStateHandler extends Navigation.StateHandler {
getNavigationLink(state: Navigation.State, data: any): string {
console.log('get navigation link');
return super.getNavigationLink(state, data, { ids: [] });
}
getNavigationData(state: Navigation.State, url: string): any {
console.log('get navigation data');
super.getNavigationData(state, url);
super.getNavigationData(state, url, {});
}
urlEncode(state: Navigation.State, key: string, val: string, queryString: boolean): string {
return queryString ? val.replace(/\s/g, '+') : super.urlEncode(state, key, val, queryString);
}
urlDecode(state: Navigation.State, key: string, val: string, queryString: boolean): string {
return queryString ? val.replace(/\+/g, ' ') : super.urlDecode(state, key, val, queryString);
}
}
homePage.stateHandler = new LogStateHandler();
personList.stateHandler = new LogStateHandler();
+93 -3
View File
@@ -1,4 +1,4 @@
// Type definitions for Navigation 1.2.0
// Type definitions for Navigation 1.3.0
// Project: http://grahammendick.github.io/navigation/
// Definitions by: Graham Mendick <https://github.com/grahammendick>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
@@ -529,6 +529,14 @@ declare module Navigation {
* @returns The navigation link
*/
getNavigationLink(state: State, data: any): string;
/**
* Gets a link that navigates to the state passing the data
* @param state The State to navigate to
* @param data The data to pass when navigating
* @param queryStringData The query string array data
* @returns The navigation link
*/
getNavigationLink(state: State, data: any, queryStringData: { [index: string]: string[]; }): string;
/**
* Navigates to the url
* @param oldState The current State
@@ -543,6 +551,30 @@ declare module Navigation {
* @returns The navigation data
*/
getNavigationData(state: State, url: string): any;
/**
* Gets the data parsed from the url
* @param state The State navigated to
* @param url The current url
* @param queryStringData Stores query string keys
* @returns The navigation data
*/
getNavigationData(state: State, url: string, queryStringData: any): any;
/**
* Encodes the Url value
* @param state The State navigated to
* @param key The key of the navigation data item
* @param val The Url value of the navigation data item
* @param queryString A value indicating the Url value's location
*/
urlEncode?(state: State, key: string, val: string, queryString: boolean): string;
/**
* Decodes the Url value
* @param state The State navigated to
* @param key The key of the navigation data item
* @param val The Url value of the navigation data item
* @param queryString A value indicating the Url value's location
*/
urlDecode?(state: State, key: string, val: string, queryString: boolean): string;
/**
* Truncates the crumb trail
* @param The State navigated to
@@ -642,6 +674,11 @@ declare module Navigation {
* navigating back or refreshing and combineCrumbTrail is false
*/
trackAllPreviousData: boolean;
/**
* Gets or sets a value indicating whether arrays should be stored in
* a single query string parameter
*/
combineArray: boolean;
}
/**
@@ -919,6 +956,14 @@ declare module Navigation {
* @returns The navigation link
*/
getNavigationLink(state: State, data: any): string;
/**
* Gets a link that navigates to the state passing the data
* @param state The State to navigate to
* @param data The data to pass when navigating
* @param queryStringData The query string array data
* @returns The navigation link
*/
getNavigationLink(state: State, data: any, queryStringData: { [index: string]: string[]; }): string;
/**
* Navigates to the url
* @param oldState The current State
@@ -933,6 +978,30 @@ declare module Navigation {
* @returns The navigation data
*/
getNavigationData(state: State, url: string): any;
/**
* Gets the data parsed from the url
* @param state The State navigated to
* @param url The current url
* @param queryStringData Stores query string keys
* @returns The navigation data
*/
getNavigationData(state: State, url: string, queryStringData: any): any;
/**
* Encodes the Url value
* @param state The State navigated to
* @param key The key of the navigation data item
* @param val The Url value of the navigation data item
* @param queryString A value indicating the Url value's location
*/
urlEncode(state: State, key: string, val: string, queryString: boolean): string;
/**
* Decodes the Url value
* @param state The State navigated to
* @param key The key of the navigation data item
* @param val The Url value of the navigation data item
* @param queryString A value indicating the Url value's location
*/
urlDecode(state: State, key: string, val: string, queryString: boolean): string;
/**
* Truncates the crumb trail whenever a repeated or initial State is
* encountered
@@ -1043,6 +1112,13 @@ declare module Navigation {
* @returns The matched data or null if there's no match
*/
match(path: string): any;
/**
* Gets the matching data for the path
* @param path The path to match
* @param urlDecode The function that decodes the Url value
* @returns The matched data or null if there's no match
*/
match(path: string, urlDecode: (route: Route, name: string, val: string) => string): any;
/**
* Gets the route populated with default values
* @returns The built route
@@ -1050,10 +1126,17 @@ declare module Navigation {
build(): string;
/**
* Gets the route populated with data and default values
* @param The data for the route parameters
* @param data The data for the route parameters
* @returns The built route
*/
build(data: any): string;
/**
* Gets the route populated with data and default values
* @param data The data for the route parameters
* @param urlEncode The function that encodes the Url value
* @returns The built route
*/
build(data: any, urlEncode: (route: Route, name: string, val: string) => string): string;
}
/**
@@ -1075,10 +1158,17 @@ declare module Navigation {
addRoute(path: string, defaults: any): Route;
/**
* Gets the matching route and data for the path
* @param route The path to match
* @param path The path to match
* @returns The matched route and data
*/
match(path: string): { route: Route; data: any; };
/**
* Gets the matching route and data for the path
* @param path The path to match
* @param urlDecode The function that decodes the Url value
* @returns The matched route and data
*/
match(path: string, urlDecode: (route: Route, name: string, val: string) => string): { route: Route; data: any; };
/**
* Sorts the routes by the comparer
* @param compare The route comparer function
+3
View File
@@ -110,6 +110,9 @@ fooPar = P.succeed(foo);
fooArrPar = P.seq(fooPar, fooPar);
anyArrPar = P.seq(barPar, fooPar, numPar);
fooPar = P.custom<Foo>((success, failure) => (stream, i) => { str = stream; num = i; return success(num, foo); });
fooPar = P.custom<Foo>((success, failure) => (stream, i) => failure(num, str));
fooPar = P.alt(fooPar, fooPar);
anyPar = P.alt(barPar, fooPar, numPar);
+11 -1
View File
@@ -1,12 +1,14 @@
// Type definitions for Parsimmon 0.5.0
// Project: https://github.com/jneen/parsimmon
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>
// Definitions by: Bart van der Schoor <https://github.com/Bartvds>, Mizunashi Mana <https://github.com/mizunashi-mana>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
// TODO convert to generics
declare module 'parsimmon' {
module Parsimmon {
export type StreamType = string;
export interface Mark<T> {
start: number;
@@ -103,6 +105,14 @@ declare module 'parsimmon' {
export function seq<U>(...parsers: Parser<U>[]): Parser<U[]>;
export function seq(...parsers: Parser<any>[]): Parser<any[]>;
export type SuccessFunctionType<U> = (index: number, result: U) => Result<U>;
export type FailureFunctionType<U> = (index: number, msg: string) => Result<U>;
export type ParseFunctionType<U> = (stream: StreamType, index: number) => Result<U>;
/*
allows to add custom primitive parsers.
*/
export function custom<U>(parsingFunction: (success: SuccessFunctionType<U>, failure: FailureFunctionType<U>) => ParseFunctionType<U>): Parser<U>;
/*
accepts a variable number of parsers, and yields the value of the first one that succeeds, backtracking in between.
*/
+72
View File
@@ -0,0 +1,72 @@
/// <reference path="serve-index.d.ts" />
/// <reference path="../express/express.d.ts" />
import * as express from 'express';
import * as serveIndex from 'serve-index';
import * as fs from 'fs';
const app = express();
// Serve URLs like /ftp/thing as public/ftp/thing
app.use('/ftp', serveIndex('public/ftp', {'icons': true}));
app.listen(8080);
// Taken from https://github.com/expressjs/serve-index/blob/v1.7.2/test/test.js
import * as path from 'path';
var fixtures = path.join(__dirname, '/fixtures');
const createServer = serveIndex;
var server = createServer('test/fixtures', {'hidden': false});
var server = createServer('test/fixtures', {'hidden': true});
var server = createServer(fixtures, {'filter': filter});
function filter(name: string): boolean {
if (name.indexOf('foo') === -1) return true
return false
}
var server = createServer(fixtures, {'filter': filter, 'hidden': false});
var server = createServer(fixtures, {'icons': true});
var server = createServer(fixtures, {'template': __dirname + '/shared/template.html'});
var server = createServer(fixtures, {'template': function (locals, callback) {
callback(null, 'This is a template.');
}});
var server = createServer(fixtures, {'template': function (locals, callback) {
callback(new Error('boom!'));
}});
var server = createServer(fixtures, {'template': function (locals, callback) {
callback(null, JSON.stringify(locals.directory));
}});
var server = createServer(fixtures, {'template': function (locals, callback) {
callback(null, JSON.stringify(locals.displayIcons));
}});
var server = createServer(fixtures, {'template': function (locals, callback) {
callback(null, JSON.stringify(locals.fileList.map(function (file) {
//file.stat = file.stat instanceof fs.Stats;
return file;
})));
}});
var server = createServer(fixtures, {'template': function (locals, callback) {
callback(null, JSON.stringify(locals.path));
}});
var server = createServer(fixtures, {'template': function (locals, callback) {
callback(null, JSON.stringify(locals.style));
}});
var server = createServer(fixtures, {'template': function (locals, callback) {
callback(null, JSON.stringify(locals.viewName));
}});
var server = createServer(fixtures, {'stylesheet': __dirname + '/shared/styles.css'});
+44
View File
@@ -0,0 +1,44 @@
// Type definitions for serve-index v1.7.2
// Project: https://github.com/expressjs/serve-index
// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
/// <reference path="../express/express.d.ts" />
declare module 'serve-index' {
import * as express from 'express';
import * as fs from 'fs';
namespace serveIndex {
interface File {
name: string;
stat: fs.Stats;
}
interface Locals {
directory: string;
displayIcons: boolean;
fileList: Array<File>;
name: string;
stat: fs.Stats;
path: string;
style: string;
viewName: string;
}
type templateCallback = (error: Error, htmlString?: string) => void;
interface Options {
filter?: (filename: string, index: number, files: Array<File>, dir: string) => boolean;
hidden?: boolean;
icons?: boolean;
stylesheet?: string;
template?: string | ((locals: Locals, callback: templateCallback) => void);
view?: string;
}
}
function serveIndex(path: string, options?: serveIndex.Options): express.Handler;
export = serveIndex;
}
+11 -11
View File
@@ -15,22 +15,22 @@
declare module "serve-static" {
import * as express from "express";
/**
* Create a new middleware function to serve files from within a given root directory.
* The file to serve will be determined by combining req.url with the provided root directory.
* Create a new middleware function to serve files from within a given root directory.
* The file to serve will be determined by combining req.url with the provided root directory.
* When a file is not found, instead of sending a 404 response, this module will instead call next() to move on to the next middleware, allowing for stacking and fall-backs.
*/
function serveStatic(root: string, options?: {
/**
* Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot (".").
* Note this check is done on the path itself without checking if the path actually exists on the disk.
* If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny").
* The default value is 'ignore'.
* 'allow' No special treatment for dotfiles
* 'deny' Send a 403 for any request for a dotfile
* 'ignore' Pretend like the dotfile does not exist and call next()
*/
* Set how "dotfiles" are treated when encountered. A dotfile is a file or directory that begins with a dot (".").
* Note this check is done on the path itself without checking if the path actually exists on the disk.
* If root is specified, only the dotfiles above the root are checked (i.e. the root itself can be within a dotfile when when set to "deny").
* The default value is 'ignore'.
* 'allow' No special treatment for dotfiles
* 'deny' Send a 403 for any request for a dotfile
* 'ignore' Pretend like the dotfile does not exist and call next()
*/
dotfiles?: string;
/**
+2
View File
@@ -67,6 +67,8 @@ function testMkdirSync() {
function testPath() {
const p = temp.path({ suffix: "justSuffix" }, "defaultPrefix");
p.length;
const p2: string = temp.path("prefix");
const p3: string = temp.path({ prefix: "prefix" });
}
function testTrack() {
+2 -2
View File
@@ -31,8 +31,8 @@ declare module "temp" {
export function openSync(affixes: string): { path: string, fd: number };
export function openSync(affixes: AffixOptions): { path: string, fd: number };
export function path(affixes: string, defaultPrefix: string): string;
export function path(affixes: AffixOptions, defaultPrefix: string): string;
export function path(affixes: string, defaultPrefix?: string): string;
export function path(affixes: AffixOptions, defaultPrefix?: string): string;
export function cleanup(callback?: (result: boolean | {files: number, dirs?: number}) => void): void;
+2 -1
View File
@@ -23,6 +23,7 @@ declare module THREE {
export interface CanvasRendererParameters {
canvas?: HTMLCanvasElement;
devicePixelRatio?: number;
alpha?: boolean;
}
export class CanvasRenderer implements Renderer {
@@ -55,4 +56,4 @@ declare module THREE {
clearStencil(): void;
render(scene: Scene, camera: Camera): void;
}
}
}
+13 -10
View File
@@ -7,10 +7,10 @@
declare module THREE {
class OrbitControls {
constructor(object:Camera, domElement?:HTMLElement);
constructor(object: Camera, domElement?: HTMLElement);
object:Camera;
domElement:HTMLElement;
object: Camera;
domElement: HTMLElement;
// API
enabled: boolean;
@@ -19,13 +19,13 @@ declare module THREE {
// deprecated
center: THREE.Vector3;
noZoom: boolean;
enableZoom: boolean;
zoomSpeed: number;
minDistance: number;
maxDistance: number;
noRotate: boolean;
enableRotate: boolean;
rotateSpeed: number;
noPan: boolean;
enablePan: boolean;
keyPanSpeed: number;
autoRotate: boolean;
autoRotateSpeed: number;
@@ -33,24 +33,27 @@ declare module THREE {
maxPolarAngle: number;
minAzimuthAngle: number;
maxAzimuthAngle: number;
noKeys: boolean;
enableKeys: boolean;
keys: { LEFT: number; UP: number; RIGHT: number; BOTTOM: number; };
mouseButtons: { ORBIT: MOUSE; ZOOM: MOUSE; PAN: MOUSE; };
enableDamping: boolean;
dampingFactor: number;
rotateLeft(angle?: number): void;
rotateUp(angle?: number): void;
panLeft(distance?: number): void;
panUp(distance?: number): void;
pan( deltaX: number, deltaY: number): void;
pan(deltaX: number, deltaY: number): void;
dollyIn(dollyScale: number): void;
dollyOut(dollyScale: number): void;
update(): void;
reset(): void;
getPolarAngle() : number;
getPolarAngle(): number;
getAzimuthalAngle(): number;
// EventDispatcher mixins
addEventListener(type: string, listener: (event: any) => void ): void;
addEventListener(type: string, listener: (event: any) => void): void;
hasEventListener(type: string, listener: (event: any) => void): void;
removeEventListener(type: string, listener: (event: any) => void): void;
dispatchEvent(event: { type: string; target: any; }): void;

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