-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b9cbf86
commit 2a9a4d9
Showing
9 changed files
with
73 additions
and
4 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "tarantoolscript", | ||
"version": "0.5.3", | ||
"version": "0.6.0", | ||
"author": "Vitaliy Artemov [email protected]", | ||
"description": "TypeScript definitions for Tarantool Lua API.", | ||
"repository": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/** @noSelfInFile */ | ||
|
||
import { CsvOptions } from './CsvOptions'; | ||
import { CsvReadable } from './CsvReadable'; | ||
import { CsvWritable } from './CsvWritable'; | ||
|
||
/** | ||
* Get CSV-formatted input from `readable` and return a table as output. | ||
* Usually `readable` is either a string or a file opened for reading. | ||
* Usually `options` is not specified. | ||
* @param readable A string, or any object which has a `read()` method, formatted according to the CSV rules. | ||
* @param options An options table. | ||
* @returns Table - loaded value. | ||
*/ | ||
export declare function load(readable: CsvReadable, options?: CsvOptions): unknown[]; | ||
|
||
/** | ||
* Get table input from `csv-table` and return a CSV-formatted string as output. | ||
* Or, get table input from `csv-table` and put the output in `writable`. | ||
* Usually `options` is not specified. | ||
* Usually `writable`, if specified, is a file opened for writing. | ||
* `csv.dump()` is the reverse of `csv.load()`. | ||
* @param csvTable A table which can be formatted according to the CSV rules. | ||
* @param options An options table. | ||
* @param writable Any object which has a `write()` method. | ||
* @returns String, which is written to `writable` if specified. | ||
*/ | ||
export declare function dump(csvTable: unknown[], options?: CsvOptions): string; | ||
export declare function dump(csvTable: unknown[], options?: CsvOptions, writable: CsvWritable): void; | ||
|
||
/** | ||
* Form a Lua iterator function for going through CSV records one field at a time. | ||
* Use of an iterator is strongly recommended if the amount of data is large (ten or more megabytes). | ||
* @param input A string, or any object which has a `read()` method, formatted according to che CSV rules. | ||
* @param options An options table. | ||
* @returns Lua iterator. | ||
*/ | ||
export declare function iterate(input: CsvReadable, options?: CsvOptions): LuaIterable<LuaMultiReturn<number, unknown[]>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export interface CsvOptions { | ||
/** | ||
* Single-byte character to designate end-of-field. | ||
*/ | ||
delimiter?: string; | ||
|
||
/** | ||
* Single-byte character to designate encloser of string. | ||
*/ | ||
quote_char?: string; | ||
|
||
/** | ||
* Number of characters to read at once (usually for file-IO efficiency). | ||
*/ | ||
chunk_size?: number; | ||
|
||
/** | ||
* Number of lines to skip at the start (usually for a header). | ||
*/ | ||
skip_head_lines?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export type CsvReadable = | ||
| string | ||
| { read(): unknown } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export interface CsvWritable { | ||
write(...args: unknown[]): unknown; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export * from './CsvOptions'; | ||
export * from './CsvReadable'; | ||
export * from './CsvWritable'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './builtin/csv/Csv'; |