Merge branch 'master' into rename-repo-url

This commit is contained in:
vvakame
2016-03-17 21:06:54 +09:00
1140 changed files with 179704 additions and 179635 deletions
+26 -26
View File
@@ -3,54 +3,54 @@
// Definitions by: Pedro Flemming <https://github.com/torpedro>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module PapaParse {
declare namespace PapaParse {
interface Static {
/**
* Parse a csv string or a csv file
*/
parse(csvString: string, config?: ParseConfig): ParseResult;
parse(file: File, config?: ParseConfig): ParseResult;
/**
* Unparses javascript data objects and returns a csv string
*/
unparse(data: Array<Object>, config?: UnparseConfig): string;
unparse(data: Array<Array<any>>, config?: UnparseConfig): string;
unparse(data: UnparseObject, config?: UnparseConfig): string;
/**
* Read-Only Properties
*/
// An array of characters that are not allowed as delimiters.
BAD_DELIMETERS: Array<string>;
// The true delimiter. Invisible. ASCII code 30. Should be doing the job we strangely rely upon commas and tabs for.
RECORD_SEP: string;
// Also sometimes used as a delimiting character. ASCII code 31.
UNIT_SEP: string;
// Whether or not the browser supports HTML5 Web Workers. If false, worker: true will have no effect.
WORKERS_SUPPORTED: boolean;
// The relative path to Papa Parse. This is automatically detected when Papa Parse is loaded synchronously.
SCRIPT_PATH: string;
/**
* Configurable Properties
*/
// The size in bytes of each file chunk. Used when streaming files obtained from the DOM that exist on the local computer. Default 10 MB.
LocalChunkSize: string;
// Same as LocalChunkSize, but for downloading files from remote locations. Default 5 MB.
RemoteChunkSize: string;
// The delimiter used when it is left unspecified and cannot be detected automatically. Default is comma.
DefaultDelimiter: string;
/**
* On Papa there are actually more classes exposed
* but none of them are officially documented
@@ -59,7 +59,7 @@ declare module PapaParse {
*/
Parser: ParserConstructor;
}
interface ParseConfig {
delimiter?: string; // default: ""
newline?: string; // default: ""
@@ -72,7 +72,7 @@ declare module PapaParse {
download?: boolean; // default: false
skipEmptyLines?: boolean; // default: false
fastMode?: boolean; // default: undefined
// Callbacks
step?(results: ParseResult, parser: Parser): void; // default: undefined
complete?(results: ParseResult, file?: File): void; // default: undefined
@@ -80,25 +80,25 @@ declare module PapaParse {
chunk?(results: ParseResult, parser: Parser): void; // default: undefined
beforeFirstChunk?(chunk: string): string|void; // default: undefined
}
interface UnparseConfig {
quotes: boolean; // default: false
delimiter: string; // default: ","
newline: string; // default: "\r\n"
}
interface UnparseObject {
fields: Array<any>;
data: string | Array<any>;
}
interface ParseError {
type: string; // A generalization of the error
code: string; // Standardized error code
message: string; // Human-readable details
row: number; // Row index of parsed data where error is
}
interface ParseMeta {
delimiter: string; // Delimiter used
linebreak: string; // Line break sequence used
@@ -106,10 +106,10 @@ declare module PapaParse {
fields: Array<string>; // Array of field names
truncated: boolean; // Whether preview consumed all input
}
/**
* @interface ParseResult
*
*
* data: is an array of rows. If header is false, rows are arrays; otherwise they are objects of data keyed by the field name.
* errors: is an array of errors
* meta: contains extra information about the parse, such as delimiter used, the newline sequence, whether the process was aborted, etc. Properties in this object are not guaranteed to exist in all situations
@@ -119,7 +119,7 @@ declare module PapaParse {
errors: Array<ParseError>;
meta: ParseMeta;
}
/**
* Parser
*/
@@ -127,13 +127,13 @@ declare module PapaParse {
interface Parser {
// Parses the input
parse(input: string, baseIndex: number, ignoreLastRow: boolean): any;
// Sets the abort flag
abort(): void;
// Gets the cursor position
getCharIndex(): number;
}
}
}
declare var Papa: PapaParse.Static;