// Type definitions for node-scanf // Project: https://github.com/Lellansin/node-scanf // Definitions by: Jeongho Nam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module "scanf" { export = __node_scanf.scanf; } declare namespace __node_scanf { /* ------------------------------------------------------------ SCANF - FROM STDIN ------------------------------------------------------------ */ /** *

Read formatted word from stdin.

* *

Reads a word from stdin and returns it according to parameter format.

* * @param format The format represents a word. * @return A word. */ function scanf(format: "%s"): string; /** *

Read formatted line from stdin.

* *

Reads a word from stdin and returns it according to parameter format.

* * @param format The format represents a word. * @return A word. */ function scanf(format: "%S"): string; /** *

Read formatted integer from stdin.

* *

Reads an integer from stdin and returns it according to parameter format.

* * @param format The format represents an integer value. * @return An integer. */ function scanf(format: "%d"): number; /** *

Read formatted float from stdin.

* *

Reads a float from stdin and returns it according to parameter format.

* * @param format The format represents an float value. * @return A float. */ function scanf(format: "%f"): number; /** *

Read formatted octal from stdin.

* *

Reads an octal from stdin and returns it according to parameter format.

* * @param format The format represents an octal value. * @return An octal. */ function scanf(format: "%o"): number; /** *

Read formatted hex from stdin.

* *

Reads a hex from stdin and returns it according to parameter format.

* * @param format The format represents a hex value. * @return A hex. */ function scanf(format: "%x"): number; /** *

Reads formatted data from stdin.

* *

Reads data from stdin and stores them according to the parameter format into an array to be returned.

* * @param format The format contains a sequence of characters that control how characters extracted from the stream are tread. * @return An array containing data constructed from stdin with the format. */ function scanf(format: string): Array; /** *

Reads formatted data from stdin.

* *

Reads data from stdin and stores them according to the parameter format into a JSON object following sequence of names.

* * @param format The format contains a sequence of characters that control how characters extracted from the stream are tread. * @param names Names of data constructed from stdin with the format. * * @return A JSON object containing data constructed from stdin with the format and following names. */ function scanf(format: string, ...names: string[]): Object; /* ------------------------------------------------------------ SSCANF - FROM SOURCE STRING ------------------------------------------------------------ */ namespace scanf { /** *

Read formatted word from string.

* *

Reads a word from source and returns it according to parameter format.

* * @param source Source string to retrieve data. * @param format The format represents a word. * * @return A word. */ function sscanf(source: string, format: "%s"): string; /** *

Read formatted line from string.

* *

Reads a word from source and returns it according to parameter format.

* * @param source Source string to retrieve data. * @param format The format represents a word. * * @return A word. */ function sscanf(source: string, format: "%S"): string; /** *

Read formatted integer from string.

* *

Reads an integer from source and returns it according to parameter format.

* * @param source Source string to retrieve data. * @param format The format represents an integer value. * * @return An integer. */ function sscanf(source: string, format: "%d"): number; /** *

Read formatted float from string.

* *

Reads a float from source and returns it according to parameter format.

* * @param source Source string to retrieve data. * @param format The format represents an float value. * * @return A float. */ function sscanf(source: string, format: "%f"): number; /** *

Read formatted octal from string.

* *

Reads an octal from source and returns it according to parameter format.

* * @param source Source string to retrieve data. * @param format The format represents an octal value. * * @return An octal. */ function sscanf(source: string, format: "%o"): number; /** *

Read formatted hex from string.

* *

Reads a hex from source and returns it according to parameter format.

* * @param source Source string to retrieve data. * @param format The format represents a hex value. * * @return A hex. */ function sscanf(source: string, format: "%x"): number; /** *

Reads formatted data from string.

* *

Reads data from source and stores them according to the parameter format into an array to be returned.

* * @param source Source string to retrieve data. * @param format The format contains a sequence of characters that control how characters extracted from the stream are tread. * * @return An array containing data constructed from string with the format. */ function sscanf(source: string, format: string): Array; /** *

Reads formatted data from string.

* *

Reads data from source and stores them according to the parameter format into a JSON object following sequence of names.

* * @param source Source string to retrieve data. * @param format The format contains a sequence of characters that control how characters extracted from the stream are tread. * @param names Names of data constructed from string with the format. * * @return A JSON object containing data constructed from string with the format and following names. */ function sscanf(source: string, format: string, ...names: string[]): Object; } }